ArenaRune commited on
Commit
d83be04
·
verified ·
1 Parent(s): e8d4231

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +160 -158
README.md CHANGED
@@ -1,199 +1,201 @@
1
  ---
2
- library_name: transformers
3
- tags: []
 
 
 
 
 
 
 
 
 
 
 
 
4
  ---
5
 
6
- # Model Card for Model ID
7
-
8
- <!-- Provide a quick summary of what the model is/does. -->
9
-
10
 
 
11
 
12
  ## Model Details
13
 
14
- ### Model Description
15
-
16
- <!-- Provide a longer summary of what this model is. -->
17
-
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
-
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
-
28
- ### Model Sources [optional]
29
-
30
- <!-- Provide the basic links for the model. -->
31
-
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
-
36
- ## Uses
37
-
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
-
40
- ### Direct Use
41
-
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
-
44
- [More Information Needed]
45
-
46
- ### Downstream Use [optional]
47
-
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
-
50
- [More Information Needed]
51
-
52
- ### Out-of-Scope Use
53
-
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
-
56
- [More Information Needed]
57
-
58
- ## Bias, Risks, and Limitations
59
-
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
-
62
- [More Information Needed]
63
-
64
- ### Recommendations
65
-
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
-
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
-
70
- ## How to Get Started with the Model
71
-
72
- Use the code below to get started with the model.
73
-
74
- [More Information Needed]
 
 
 
 
 
 
 
 
75
 
76
  ## Training Details
77
 
78
  ### Training Data
79
 
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
-
82
- [More Information Needed]
 
83
 
84
- ### Training Procedure
85
 
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
 
88
- #### Preprocessing [optional]
89
 
90
- [More Information Needed]
 
 
 
 
 
 
91
 
 
92
 
93
- #### Training Hyperparameters
 
 
 
 
 
 
 
 
 
 
94
 
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
 
97
- #### Speeds, Sizes, Times [optional]
98
 
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
 
 
 
 
100
 
101
- [More Information Needed]
102
 
103
  ## Evaluation
104
 
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
 
107
- ### Testing Data, Factors & Metrics
 
 
108
 
109
- #### Testing Data
110
 
111
- <!-- This should link to a Dataset Card if possible. -->
112
 
113
- [More Information Needed]
 
 
 
114
 
115
- #### Factors
116
 
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
 
 
118
 
119
- [More Information Needed]
120
 
121
- #### Metrics
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
- ## Model Examination [optional]
 
 
 
136
 
137
- <!-- Relevant interpretability work for the model goes here -->
138
 
139
- [More Information Needed]
 
 
140
 
141
  ## Environmental Impact
142
 
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
-
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
-
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
-
153
- ## Technical Specifications [optional]
154
-
155
- ### Model Architecture and Objective
156
-
157
- [More Information Needed]
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
+ ```