Downloads · 30 days
6
27% of all-time downloads
Ace-2504/gemma-2-2b-yugioh-rag
gemma-2-2b-yugioh-rag is a question answering model from Ace-2504. Use it when the input is a question plus a passage. It is set up for peft. The card lists the license as gemma.
System C of a fine-tune-vs-retrieval experiment on the Yu-Gi-Oh! domain: the QLoRA adapter served with a hybrid retriever that supplies real passages at inference. This is where the facts arrive — it is the decisive w…
Downloads · 30 days
6
27% of all-time downloads
All-time downloads
22
Public
Repo size
105 MB
Likes
0
Public
Click a slice to open those files.
.safetensors83.1 MB · 79%
From the Hugging Face model README
System C of a fine-tune-vs-retrieval experiment on the Yu-Gi-Oh! domain: the QLoRA adapter served with a hybrid retriever that supplies real passages at inference. This is where the facts arrive — it is the decisive winner of the experiment.
Ace-2504/gemma-2-2b-yugioh-qa
(System B). The weights are identical — the difference is entirely at inference: a retriever fetches
passages and prepends them to the prompt before the model answers.all-MiniLM-L6-v2 dense embeddings + BM25 lexical, fused by Reciprocal
Rank Fusion, top-5 over 42,412 chunks (1000/150 chars, title-augmented) of the Yu-Gi-Oh corpus
(Yugipedia CC BY-SA prose + YGOPRODeck card facts). Retriever recall@5 = 0.93.On 60 held-out questions scored 0–10 by a reference-grounded blind judge:
| System | Judge /10 | Correctness /5 | Groundedness /2 |
|---|---|---|---|
| A · base, closed | 3.98 | 1.83 | 0.18 |
| B · fine-tune, closed | 5.25 | 2.35 | 0.87 |
| C · fine-tune + retrieval | 8.05 | 3.85 | 1.65 |
Fine-tuning alone (B) lifts the answer shape (groundedness 0.18 → 0.87) but barely moves correctness — the card facts are not in the weights. Retrieval (C) is what supplies them: +2.80 over B (p < 0.001), correctness 2.35 → 3.85. The thesis in one line: fine-tuning teaches the shape, retrieval supplies the facts.
Load the adapter exactly as the QA model, retrieve the top-5 passages for the question from the corpus index, and pass them as context:
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("google/gemma-2-2b-it")
base = AutoModelForCausalLM.from_pretrained("google/gemma-2-2b-it", device_map="auto")
model = PeftModel.from_pretrained(base, "Ace-2504/gemma-2-2b-yugioh-rag")
context = retrieve(question, k=5) # your hybrid MiniLM + BM25 retriever
prompt = f"Use ONLY the following context to answer.\n\nContext:\n{context}\n\nQuestion: {question}"
The retriever (index build + /retrieve endpoint) and the serving glue are on GitHub; the index is
rebuilt from the public corpus rather than shipped here (it embeds © Konami card effect text used only
as fair-use context).
Identical to the QA model — QLoRA (4-bit NF4 base, bf16 compute; LoRA r=16, α=32, dropout 0.05, all linear modules), LR 2e-4 cosine, seq len 512, early-stopped at the best validation checkpoint (~1 epoch; 3 epochs overfit), validation perplexity 3.872, on a single L4 on Modal. Trained on 2,683 grounded QA pairs distilled from the Yu-Gi-Oh corpus.