Update README.md
Browse files
README.md
CHANGED
|
@@ -1,199 +1,201 @@
|
|
| 1 |
---
|
| 2 |
-
library_name:
|
| 3 |
-
tags:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
|
| 8 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
-
|
| 10 |
|
|
|
|
| 11 |
|
| 12 |
## Model Details
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
- **
|
| 21 |
-
- **
|
| 22 |
-
- **
|
| 23 |
-
- **
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
###
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
## Training Details
|
| 77 |
|
| 78 |
### Training Data
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
[
|
|
|
|
| 83 |
|
| 84 |
-
|
| 85 |
|
| 86 |
-
|
| 87 |
|
| 88 |
-
|
| 89 |
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
|
|
|
| 92 |
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
-
|
| 96 |
|
| 97 |
-
|
| 98 |
|
| 99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
-
|
| 102 |
|
| 103 |
## Evaluation
|
| 104 |
|
| 105 |
-
|
| 106 |
|
| 107 |
-
|
|
|
|
|
|
|
| 108 |
|
| 109 |
-
|
| 110 |
|
| 111 |
-
|
| 112 |
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
-
|
| 116 |
|
| 117 |
-
|
|
|
|
|
|
|
| 118 |
|
| 119 |
-
|
| 120 |
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
-
|
| 125 |
-
[More Information Needed]
|
| 126 |
-
|
| 127 |
-
### Results
|
| 128 |
-
|
| 129 |
-
[More Information Needed]
|
| 130 |
-
|
| 131 |
-
#### Summary
|
| 132 |
|
|
|
|
| 133 |
|
|
|
|
| 134 |
|
| 135 |
-
|
|
|
|
|
|
|
|
|
|
| 136 |
|
| 137 |
-
|
| 138 |
|
| 139 |
-
|
|
|
|
|
|
|
| 140 |
|
| 141 |
## Environmental Impact
|
| 142 |
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
### Compute Infrastructure
|
| 160 |
-
|
| 161 |
-
[More Information Needed]
|
| 162 |
-
|
| 163 |
-
#### Hardware
|
| 164 |
-
|
| 165 |
-
[More Information Needed]
|
| 166 |
-
|
| 167 |
-
#### Software
|
| 168 |
-
|
| 169 |
-
[More Information Needed]
|
| 170 |
-
|
| 171 |
-
## Citation [optional]
|
| 172 |
-
|
| 173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
-
|
| 175 |
-
**BibTeX:**
|
| 176 |
-
|
| 177 |
-
[More Information Needed]
|
| 178 |
-
|
| 179 |
-
**APA:**
|
| 180 |
-
|
| 181 |
-
[More Information Needed]
|
| 182 |
-
|
| 183 |
-
## Glossary [optional]
|
| 184 |
-
|
| 185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
-
|
| 187 |
-
[More Information Needed]
|
| 188 |
-
|
| 189 |
-
## More Information [optional]
|
| 190 |
-
|
| 191 |
-
[More Information Needed]
|
| 192 |
-
|
| 193 |
-
## Model Card Authors [optional]
|
| 194 |
-
|
| 195 |
-
[More Information Needed]
|
| 196 |
-
|
| 197 |
-
## Model Card Contact
|
| 198 |
-
|
| 199 |
-
[More Information Needed]
|
|
|
|
| 1 |
---
|
| 2 |
+
library_name: peft
|
| 3 |
+
tags:
|
| 4 |
+
- elden-ring
|
| 5 |
+
- question-answering
|
| 6 |
+
- gaming
|
| 7 |
+
- domain-specific
|
| 8 |
+
- qlora
|
| 9 |
+
- lora
|
| 10 |
+
- phi-2
|
| 11 |
+
base_model: microsoft/phi-2
|
| 12 |
+
license: cc-by-sa-4.0
|
| 13 |
+
language:
|
| 14 |
+
- en
|
| 15 |
+
pipeline_tag: text-generation
|
| 16 |
---
|
| 17 |
|
| 18 |
+
# 🗡️ Elden Ring QA — Phi-2 QLoRA Adapter
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
A QLoRA fine-tuned adapter for [Microsoft Phi-2](https://huggingface.co/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.
|
| 21 |
|
| 22 |
## Model Details
|
| 23 |
|
| 24 |
+
- **Base model:** [microsoft/phi-2](https://huggingface.co/microsoft/phi-2) (2.7B parameters)
|
| 25 |
+
- **Fine-tuning method:** QLoRA (4-bit NF4 quantization + LoRA adapters)
|
| 26 |
+
- **LoRA rank:** 8
|
| 27 |
+
- **LoRA alpha:** 16
|
| 28 |
+
- **LoRA target modules:** `q_proj`, `k_proj`, `v_proj`, `dense`
|
| 29 |
+
- **Trainable parameters:** ~5.2M (0.34% of total)
|
| 30 |
+
- **Adapter size:** 21 MB
|
| 31 |
+
- **Training data:** [ArenaRune/elden-ring-qa-dataset](https://huggingface.co/datasets/ArenaRune/elden-ring-qa-dataset)
|
| 32 |
+
- **Language:** English
|
| 33 |
+
- **Developed by:** [ArenaRune]
|
| 34 |
+
|
| 35 |
+
## Quick Start
|
| 36 |
+
|
| 37 |
+
```python
|
| 38 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
|
| 39 |
+
from peft import PeftModel
|
| 40 |
+
import torch
|
| 41 |
+
|
| 42 |
+
# Quantization config (must match training)
|
| 43 |
+
bnb_config = BitsAndBytesConfig(
|
| 44 |
+
load_in_4bit=True,
|
| 45 |
+
bnb_4bit_quant_type="nf4",
|
| 46 |
+
bnb_4bit_compute_dtype=torch.float16,
|
| 47 |
+
bnb_4bit_use_double_quant=True,
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
# Load base model + adapter
|
| 51 |
+
base = AutoModelForCausalLM.from_pretrained(
|
| 52 |
+
"microsoft/phi-2",
|
| 53 |
+
quantization_config=bnb_config,
|
| 54 |
+
device_map="auto",
|
| 55 |
+
trust_remote_code=True,
|
| 56 |
+
)
|
| 57 |
+
model = PeftModel.from_pretrained(base, "ArenaRune/elden-ring-phi2-qlora")
|
| 58 |
+
tokenizer = AutoTokenizer.from_pretrained("ArenaRune/elden-ring-phi2-qlora")
|
| 59 |
+
model.eval()
|
| 60 |
+
|
| 61 |
+
# Ask a question
|
| 62 |
+
prompt = """### Instruction:
|
| 63 |
+
What weapons are good against Mohg, Lord of Blood?
|
| 64 |
+
|
| 65 |
+
### Response:
|
| 66 |
+
"""
|
| 67 |
+
|
| 68 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 69 |
+
with torch.no_grad():
|
| 70 |
+
outputs = model.generate(
|
| 71 |
+
**inputs,
|
| 72 |
+
max_new_tokens=128,
|
| 73 |
+
do_sample=False,
|
| 74 |
+
repetition_penalty=1.5,
|
| 75 |
+
no_repeat_ngram_size=3,
|
| 76 |
+
pad_token_id=tokenizer.eos_token_id,
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
answer = tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
|
| 80 |
+
print(answer)
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
## Prompt Format
|
| 84 |
+
|
| 85 |
+
The model expects this instruction template:
|
| 86 |
+
|
| 87 |
+
```
|
| 88 |
+
### Instruction:
|
| 89 |
+
{your question about Elden Ring}
|
| 90 |
+
|
| 91 |
+
### Response:
|
| 92 |
+
```
|
| 93 |
|
| 94 |
## Training Details
|
| 95 |
|
| 96 |
### Training Data
|
| 97 |
|
| 98 |
+
Custom dataset built from 3 public sources:
|
| 99 |
+
- **Kaggle** — Ultimate Elden Ring with Shadow of the Erdtree DLC (12 structured CSVs)
|
| 100 |
+
- **GitHub** — [Impalers-Archive](https://github.com/ividyon/Impalers-Archive) (DLC text dump)
|
| 101 |
+
- **GitHub** — [Carian-Archive](https://github.com/AsteriskAmpersand/Carian-Archive) (base game text dump)
|
| 102 |
|
| 103 |
+
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.
|
| 104 |
|
| 105 |
+
Full dataset: [ArenaRune/elden-ring-qa-dataset](https://huggingface.co/datasets/ArenaRune/elden-ring-qa-dataset)
|
| 106 |
|
| 107 |
+
### Training Procedure
|
| 108 |
|
| 109 |
+
- **Framework:** HuggingFace Transformers + PEFT
|
| 110 |
+
- **Method:** QLoRA (4-bit NF4 quantization + LoRA)
|
| 111 |
+
- **Precision:** FP16 mixed precision
|
| 112 |
+
- **Optimizer:** Paged AdamW 8-bit
|
| 113 |
+
- **LR schedule:** Cosine with 10% warmup
|
| 114 |
+
- **GPU:** NVIDIA A100 (80GB)
|
| 115 |
+
- **Platform:** Google Colab
|
| 116 |
|
| 117 |
+
### Training Hyperparameters
|
| 118 |
|
| 119 |
+
| Parameter | Value |
|
| 120 |
+
|-----------|-------|
|
| 121 |
+
| Learning rate | 2e-4 |
|
| 122 |
+
| LoRA rank (r) | 8 |
|
| 123 |
+
| LoRA alpha | 16 |
|
| 124 |
+
| LoRA dropout | 0.1 |
|
| 125 |
+
| Epochs | 3 |
|
| 126 |
+
| Batch size (effective) | 16 (8 × 2 grad accum) |
|
| 127 |
+
| Max sequence length | 512 |
|
| 128 |
+
| Weight decay | 0.01 |
|
| 129 |
+
| Warmup ratio | 0.1 |
|
| 130 |
|
| 131 |
+
### Hyperparameter Search
|
| 132 |
|
| 133 |
+
Three configurations were tested:
|
| 134 |
|
| 135 |
+
| Config | LR | Rank | Alpha | Description |
|
| 136 |
+
|--------|-----|------|-------|-------------|
|
| 137 |
+
| **A (selected)** | **2e-4** | **8** | **16** | **Conservative — fast convergence** |
|
| 138 |
+
| B | 1e-4 | 16 | 32 | Balanced |
|
| 139 |
+
| C | 5e-5 | 32 | 64 | Aggressive — high capacity |
|
| 140 |
|
| 141 |
+
Config A achieved the lowest validation loss. Higher-rank configs underfit due to insufficient training steps at their lower learning rates.
|
| 142 |
|
| 143 |
## Evaluation
|
| 144 |
|
| 145 |
+
### Metrics
|
| 146 |
|
| 147 |
+
Evaluated on 100 held-out test examples against unmodified Phi-2 baseline using:
|
| 148 |
+
- **ROUGE-1/2/L** — n-gram overlap (lexical similarity)
|
| 149 |
+
- **BERTScore F1** — semantic similarity via RoBERTa-Large embeddings
|
| 150 |
|
| 151 |
+
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.
|
| 152 |
|
| 153 |
+
### What the Model Learned
|
| 154 |
|
| 155 |
+
- Elden Ring domain vocabulary (Hemorrhage, Scarlet Rot, Frostbite, damage negation, FP cost)
|
| 156 |
+
- Entity type awareness (distinguishes weapons, bosses, spells, NPCs)
|
| 157 |
+
- Structured response formatting ("The {weapon} requires {X} Str, {Y} Dex to wield")
|
| 158 |
+
- Build archetype understanding (strength, dexterity, intelligence, faith, arcane)
|
| 159 |
|
| 160 |
+
### Known Limitations
|
| 161 |
|
| 162 |
+
- **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.
|
| 163 |
+
- **Repetitive generation:** Some outputs may loop despite anti-repetition measures. Use `repetition_penalty=1.5` and `no_repeat_ngram_size=3`.
|
| 164 |
+
- **Cross-entity confusion:** May attribute one entity's properties to another similar entity.
|
| 165 |
|
| 166 |
+
### Recommended Improvement: RAG
|
| 167 |
|
| 168 |
+
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
|
| 170 |
+
## Uses
|
| 171 |
|
| 172 |
+
### Intended Uses
|
| 173 |
|
| 174 |
+
- Elden Ring game knowledge QA
|
| 175 |
+
- Demonstrating QLoRA fine-tuning on domain-specific data
|
| 176 |
+
- Base for RAG-augmented game assistant systems
|
| 177 |
+
- Educational reference for parameter-efficient fine-tuning
|
| 178 |
|
| 179 |
+
### Out-of-Scope Uses
|
| 180 |
|
| 181 |
+
- Factual reference without verification (values may be hallucinated)
|
| 182 |
+
- Commercial game guide products
|
| 183 |
+
- General-purpose question answering outside Elden Ring
|
| 184 |
|
| 185 |
## Environmental Impact
|
| 186 |
|
| 187 |
+
- **Hardware:** NVIDIA A100 (40GB)
|
| 188 |
+
- **Training time:** ~48 minutes (3 configs × ~16 min each)
|
| 189 |
+
- **Cloud provider:** Google Colab
|
| 190 |
+
|
| 191 |
+
## Citation
|
| 192 |
+
|
| 193 |
+
```bibtex
|
| 194 |
+
@misc{eldenring-phi2-qlora-2026,
|
| 195 |
+
author = {ArenaRune},
|
| 196 |
+
title = {Elden Ring QA — Phi-2 QLoRA Adapter},
|
| 197 |
+
year = {2026},
|
| 198 |
+
publisher = {HuggingFace},
|
| 199 |
+
url = {https://huggingface.co/ArenaRune/elden-ring-phi2-qlora}
|
| 200 |
+
}
|
| 201 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|