Views
No views yet
google-t5/t5-large by training only the
decoder cross-attention (EncDecAttention) blocks plus the decoder final layer norm.
The encoder, decoder self-attention, and all feed-forward weights are frozen at their
pretrained values.| Model | Architecture | Trainable / Total | EM | Token F1 |
|---|---|---|---|---|
| GPT-2-large | decoder-only | 774M / 774M | 0.3516 | 0.5041 |
| T5-large XA-only (this model) | enc-dec | 100.7M / 737M | 0.6406 | 0.8128 |
| T5-large LoRA r=8 | enc-dec | 2.4M / 740M | 0.6445 | 0.8152 |
| T5-large full fine-tune | enc-dec | 737M / 737M | 0.6602 | 0.8162 |
| T5-small XA-only | enc-dec | 6.3M / 60.5M | 0.5293 | 0.7075 |
Eval note: T5 numbers are computed on a 256-example SQuAD-validation generation subset (beam search, 4 beams). GPT-2-large is on 512 examples. Numbers are comparable in magnitude and reproduce the paper's headline ordering.
answer question: prepended to a
question: ... context: ... source string. Match this format exactly at inference:1from transformers import T5ForConditionalGeneration, AutoTokenizer
2
3repo = "medelharchaoui/t5-large-xa-only-squad"
4tok = AutoTokenizer.from_pretrained(repo)
5model = T5ForConditionalGeneration.from_pretrained(repo)
6
7question = "What culture do 'bairn' and 'hyem' originate from?"
8context = ("'bairn' and 'hyem', meaning 'child' and 'home', are examples of geordie "
9 "words with origins in scandinavia; barn and hjem are the corresponding "
10 "modern norwegian and danish words.")
11
12text = f"answer question: question: {question} context: {context}"
13ids = tok(text, return_tensors="pt", truncation=True, max_length=384).input_ids
14out = model.generate(ids, num_beams=4, max_new_tokens=16)
15print(tok.decode(out[0], skip_special_tokens=True)) # -> scandinavia| Setting | Value |
|---|---|
| Base model | google-t5/t5-large (737M) |
| Trainable params | *.EncDecAttention.* + decoder.final_layer_norm (~100.7M) |
| Dataset | rajpurkar/squad, 30,000 train examples |
| Objective | extractive QA (seq2seq) |
| Precision | bf16 |
| Optimizer steps | 3,000 (batch 4 × grad-accum 8 = eff. batch 32) |
| LR / warmup | 2e-4, 300 warmup, weight decay 0.01 |
| Source / target max len | 384 / 32 |
| Seed | 37 |
| Hardware | 1× NVIDIA RTX 3060 (12 GB), local |