--- base_model: meta-llama/Meta-Llama-3.1-8B-Instruct library_name: peft license: llama3.1 tags: - lora - sft - npc - roleplay - dialogue - game-ai language: - en --- # NPCAlign SFT — NPC Quest Dialogue LoRA LoRA adapter fine-tuned on top of Llama-3.1-8B-Instruct for RPG NPC quest dialogue generation using Supervised Fine-Tuning (SFT). ## Model Details - **Base model**: meta-llama/Meta-Llama-3.1-8B-Instruct - **Training data**: chimbiwide/NPC-Quest-Dialogue (~1,584 training conversations) - **Method**: SFT with LoRA (rank 16, all attention + MLP projections) - **Task**: Given NPC background, generate character-consistent quest dialogue ## Usage > **Note:** The base model [`meta-llama/Meta-Llama-3.1-8B-Instruct`](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct) is a gated model. You must accept Meta's license and set your `HF_TOKEN` before loading. ``` from transformers import AutoModelForCausalLM, AutoTokenizer from peft import PeftModel import torch base = AutoModelForCausalLM.from_pretrained( "meta-llama/Meta-Llama-3.1-8B-Instruct", torch_dtype=torch.bfloat16, device_map="auto" ) model = PeftModel.from_pretrained(base, "HermitQ/NPCAlign-SFT") tokenizer = AutoTokenizer.from_pretrained("HermitQ/NPCAlign-SFT") ``` ## Training Details | Parameter | Value | |---|---| | LoRA rank | 16 | | LoRA alpha | 32 | | Epochs | 3 | | Learning rate | 2e-4 | | Max length | 3072 tokens | | Loss masking | Assistant turns only | ## Evaluation (Test Set, Phase-Stratified) | Phase | ROUGE-L | Self-BLEU | BERTScore-F1 | BLEURT | | ---------- | ------- | --------- | ------------ | ------ | | Openning | 0.264 | 0.208 | 0.883 | -0.692 | | Dvelopment | 0.231 | 0.150 | 0.880 | -0.719 | | Resolution | 0.259 | 0.269 | 0.885 | -0.719 | | Overall | 0.251 | 0.264 | 0.883 | -0.710 |