CoolFace
Modelpublic

ArenaRune/elden-ring-phi2-qlora

sourceHugging Facecc-by-sa-4.0updated 7mo agoView on Hugging Face
0likes9downloads
Model Card

๐Ÿ—ก๏ธ Elden Ring QA โ€” Phi-2 QLoRA Adapter

A QLoRA fine-tuned adapter for Microsoft Phi-2 (2.7B) trained on a custom Elden Ring question-answering dataset. The model answers questions about weapons, bosses, spells, NPCs, locations, armor, and creatures โ€” including boss vulnerability analysis and per-build weapon recommendations.

Model Details

  • โ€”Base model: microsoft/phi-2 (2.7B parameters)
  • โ€”Fine-tuning method: QLoRA (4-bit NF4 quantization + LoRA adapters)
  • โ€”LoRA rank: 8
  • โ€”LoRA alpha: 16
  • โ€”LoRA target modules: q_proj, k_proj, v_proj, dense
  • โ€”Trainable parameters: ~5.2M (0.34% of total)
  • โ€”Adapter size: 21 MB
  • โ€”Training data: ArenaRune/elden-ring-qa-dataset
  • โ€”Language: English
  • โ€”Developed by: ArenaRune

Quick Start

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

# Quantization config (must match training)
bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.float16,
    bnb_4bit_use_double_quant=True,
)

# Load base model + adapter
base = AutoModelForCausalLM.from_pretrained(
    "microsoft/phi-2",
    quantization_config=bnb_config,
    device_map="auto",
    trust_remote_code=True,
)
model = PeftModel.from_pretrained(base, "ArenaRune/elden-ring-phi2-qlora")
tokenizer = AutoTokenizer.from_pretrained("ArenaRune/elden-ring-phi2-qlora")
model.eval()

# Ask a question
prompt = """### Instruction:
What weapons are good against Mohg, Lord of Blood?

### Response:
"""

inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_new_tokens=128,
        do_sample=False,
        repetition_penalty=1.5,
        no_repeat_ngram_size=3,
        pad_token_id=tokenizer.eos_token_id,
    )

answer = tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
print(answer)

Prompt Format

The model expects this instruction template:

### Instruction:
{your question about Elden Ring}

### Response:

Training Details

Training Data

Custom dataset built from 3 public sources:

  • โ€”Kaggle โ€” Ultimate Elden Ring with Shadow of the Erdtree DLC (12 structured CSVs)
  • โ€”GitHub โ€” Impalers-Archive (DLC text dump)
  • โ€”GitHub โ€” Carian-Archive (base game text dump)

Dataset covers 10 entity types (weapons, bosses, armors, spells, NPCs, locations, creatures, skills, ashes of war) with 20+ question categories including cross-entity boss vulnerability analysis and per-build weapon recommendations.

Full dataset: ArenaRune/elden-ring-qa-dataset

Training Procedure

  • โ€”Framework: HuggingFace Transformers + PEFT
  • โ€”Method: QLoRA (4-bit NF4 quantization + LoRA)
  • โ€”Precision: FP16 mixed precision
  • โ€”Optimizer: Paged AdamW 8-bit
  • โ€”LR schedule: Cosine with 10% warmup
  • โ€”GPU: NVIDIA A100 (80GB)
  • โ€”Platform: Google Colab

Training Hyperparameters

ParameterValue
Learning rate2e-4
LoRA rank (r)8
LoRA alpha16
LoRA dropout0.1
Epochs3
Batch size (effective)16 (8 ร— 2 grad accum)
Max sequence length512
Weight decay0.01
Warmup ratio0.1

Hyperparameter Search

Three configurations were tested:

ConfigLRRankAlphaDescription
A (selected)2e-4816Conservative โ€” fast convergence
B1e-41632Balanced
C5e-53264Aggressive โ€” high capacity

Config A achieved the lowest validation loss. Higher-rank configs underfit due to insufficient training steps at their lower learning rates.

Evaluation

Metrics

Evaluated on 100 held-out test examples against unmodified Phi-2 baseline using:

  • โ€”ROUGE-1/2/L โ€” n-gram overlap (lexical similarity)
  • โ€”BERTScore F1 โ€” semantic similarity via RoBERTa-Large embeddings

Key finding: significant ROUGE-2 improvement over baseline, confirming domain vocabulary acquisition. The model learned Elden Ring terminology and response structure. See the training notebook for exact metrics and visualizations.

What the Model Learned

  • โ€”Elden Ring domain vocabulary (Hemorrhage, Scarlet Rot, Frostbite, damage negation, FP cost)
  • โ€”Entity type awareness (distinguishes weapons, bosses, spells, NPCs)
  • โ€”Structured response formatting ("The {weapon} requires {X} Str, {Y} Dex to wield")
  • โ€”Build archetype understanding (strength, dexterity, intelligence, faith, arcane)

Known Limitations

  • โ€”Factual hallucination: The model learned the correct output format but hallucinates specific values (wrong stat numbers, incorrect skill names, approximate weights). This is due to LoRA rank 8 having insufficient capacity to memorize entity-specific facts across hundreds of items.
  • โ€”Repetitive generation: Some outputs may loop despite anti-repetition measures. Use repetition_penalty=1.5 and no_repeat_ngram_size=3.
  • โ€”Cross-entity confusion: May attribute one entity's properties to another similar entity.

Recommended Improvement: RAG

The model's domain fluency + factual hallucination makes it ideal for Retrieval-Augmented Generation: retrieve entity data from the enriched dataset at inference time and inject it as context. The model already knows how to format the data โ€” RAG just ensures it has the correct facts.

Uses

Intended Uses

  • โ€”Elden Ring game knowledge QA
  • โ€”Demonstrating QLoRA fine-tuning on domain-specific data
  • โ€”Base for RAG-augmented game assistant systems
  • โ€”Educational reference for parameter-efficient fine-tuning

Out-of-Scope Uses

  • โ€”Factual reference without verification (values may be hallucinated)
  • โ€”Commercial game guide products
  • โ€”General-purpose question answering outside Elden Ring

Environmental Impact

  • โ€”Hardware: NVIDIA A100 (40GB)
  • โ€”Training time: ~48 minutes (3 configs ร— ~16 min each)
  • โ€”Cloud provider: Google Colab

Citation

bibtex
@misc{eldenring-phi2-qlora-2026,
  author = {ArenaRune},
  title = {Elden Ring QA โ€” Phi-2 QLoRA Adapter},
  year = {2026},
  publisher = {HuggingFace},
  url = {https://huggingface.co/ArenaRune/elden-ring-phi2-qlora}
}