LFM2.5 350M NPC LoRA

This is a LoRA adapter for LiquidAI/LFM2.5-350M, fine-tuned for medieval fantasy RPG NPC dialogue.

The adapter is designed to generate structured NPC responses from two inputs:

  • An NPC system prompt containing the NPC's name, job, location, and available abilities.
  • A player prompt containing the player's name, reputation, and message.

It outputs the NPC response in the same schema used by the training data:

Message: <NPC dialogue>
Reputation: <reputation delta>
Abilities: <optional ability or abilities used>

Dataset

Trained on ItsHotdogFred/npc-training-data-v1, an English SFT dataset for GregAI NPC behavior.

Each row has three columns:

Column Description
system_message NPC identity, job, current location, and abilities
player_message Player name, reputation, and message
ai_message Target NPC response, reputation change, and abilities used

Prompt Format

Use the same prompt format that was used during training:

You are controlling a medieval fantasy RPG NPC. Use the NPC identity, location, abilities, and the player's reputation/message to answer exactly in the requested NPC output format.

NPC state:
Name: Richard
Job: Stable Hand
Current_location: Plain : Neutral
Abilities: "[Flee : Get away from the current area]"

Player input:
Name: Claire
Reputation: Bad
Message: Run while you still can

NPC output:

Example output:

Message: What is the meaning of this? I'm leaving right now!
Reputation: -2
Abilities: "[Flee : Get away from the current area]"

Usage

import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

base_model_id = "LiquidAI/LFM2.5-350M"
adapter_id = "ItsHotdogFred/lfm2.5-350m-npc-lora"

tokenizer = AutoTokenizer.from_pretrained(adapter_id, trust_remote_code=True)
base_model = AutoModelForCausalLM.from_pretrained(
    base_model_id,
    dtype=torch.float16,
    device_map="auto",
    trust_remote_code=True,
)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()

prompt = """You are controlling a medieval fantasy RPG NPC. Use the NPC identity, location, abilities, and the player's reputation/message to answer exactly in the requested NPC output format.

NPC state:
Name: Richard
Job: Stable Hand
Current_location: Plain : Neutral
Abilities: "[Flee : Get away from the current area]"

Player input:
Name: Claire
Reputation: Bad
Message: Run while you still can

NPC output:
"""

inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
    output_ids = model.generate(
        **inputs,
        max_new_tokens=120,
        do_sample=True,
        temperature=0.7,
        top_p=0.9,
        pad_token_id=tokenizer.eos_token_id,
    )

generated_ids = output_ids[0, inputs["input_ids"].shape[-1]:]
print(tokenizer.decode(generated_ids, skip_special_tokens=True).strip())

Training

This adapter was trained with supervised fine-tuning using TRL and PEFT LoRA.

Key settings:

  • Base model: LiquidAI/LFM2.5-350M
  • Method: LoRA SFT
  • LoRA rank: 16
  • LoRA alpha: 32
  • LoRA dropout: 0.05
  • Max sequence length: 512
  • Epochs: 3.2
  • Learning rate: 2e-4
  • Train/eval split: 90/10

Intended Use

This adapter is intended for game prototyping and NPC dialogue generation in a medieval fantasy RPG setting. It is best used when the caller provides structured NPC and player context in the training format.

Limitations

  • The adapter is specialized for short, structured NPC turns and may not behave well as a general chatbot.
  • It may invent details if the prompt omits important NPC state or abilities.
  • Reputation changes and ability selection should be treated as model suggestions and validated by game logic before use.
  • The training data is fantasy RPG themed, so outputs may not transfer cleanly to modern, sci-fi, or non-game settings without more data.

Base Model License

This adapter depends on LiquidAI/LFM2.5-350M. Check the base model card and license terms before commercial use or redistribution.

Citation

@misc{vonwerra2022trl,
  title        = {{TRL: Transformer Reinforcement Learning}},
  author       = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin GalloueDec},
  year         = 2020,
  journal      = {GitHub repository},
  publisher    = {GitHub},
  howpublished = {\url{https://github.com/huggingface/trl}}
}
Downloads last month
43
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for ItsHotdogFred/lfm2.5-350m-npc-lora

Adapter
(11)
this model

Dataset used to train ItsHotdogFred/lfm2.5-350m-npc-lora