Views
No views yet
google-t5/t5-large, trained for extractive QA on SQuAD.
Rank 8 on the q and v projections only → ~2.4M trainable params (0.32% of the model).This repo contains the PEFT adapter only (adapter_model.safetensors, ~9.5 MB). The base weights are pulled fromgoogle-t5/t5-largeat load time.
| Model | Architecture | Trainable / Total | EM | Token F1 |
|---|---|---|---|---|
| GPT-2-large | decoder-only | 774M / 774M | 0.3516 | 0.5041 |
| T5-large XA-only | enc-dec | 100.7M / 737M | 0.6406 | 0.8128 |
| T5-large LoRA r=8 (this adapter) | enc-dec | 2.4M / 740M | 0.6445 | 0.8152 |
| T5-large full fine-tune | enc-dec | 737M / 737M | 0.6602 | 0.8162 |
Eval note: T5 numbers use a 256-example SQuAD-validation generation subset (4-beam search); GPT-2-large uses 512. Magnitudes are comparable and reproduce the paper's ordering.
answer question: prepended to a
question: ... context: ... source string — match it exactly at inference:1from transformers import T5ForConditionalGeneration, AutoTokenizer
2from peft import PeftModel
3
4base = "google-t5/t5-large"
5adapter = "medelharchaoui/t5-large-lora-r8-squad"
6
7tok = AutoTokenizer.from_pretrained(adapter)
8model = T5ForConditionalGeneration.from_pretrained(base)
9model = PeftModel.from_pretrained(model, adapter)
10model = model.merge_and_unload() # optional: fold LoRA into base for faster inference
11
12question = "What culture do 'bairn' and 'hyem' originate from?"
13context = ("'bairn' and 'hyem' are geordie words with origins in scandinavia; barn and hjem "
14 "are the corresponding modern norwegian and danish words.")
15text = f"answer question: question: {question} context: {context}"
16ids = tok(text, return_tensors="pt", truncation=True, max_length=384).input_ids
17print(tok.decode(model.generate(ids, num_beams=4, max_new_tokens=16)[0], skip_special_tokens=True))| Setting | Value |
|---|---|
| Base model | google-t5/t5-large (737M) |
| LoRA | r=8, alpha=32, dropout=0.05, target modules ["q", "v"] |
| Trainable params | ~2.4M (0.32%) |
| Dataset | rajpurkar/squad, 30,000 train examples |
| Precision | bf16 |
| Optimizer steps | 3,000 (batch 4 × grad-accum 8 = eff. batch 32) |
| LR / warmup | 3e-4, 300 warmup, weight decay 0.01 |
| Source / target max len | 384 / 32 |
| PEFT version | 0.19.1 |
| Seed | 37 |
| Hardware | 1× NVIDIA RTX 3060 (12 GB), local |
google-t5/t5-large as the base model at load time.