T5-small for English news summarization
This checkpoint fine-tunes Google's T5-small to summarize English news articles. It uses the original T5 tokenizer and the summarize: prefix.
Training and evaluation
The experiment used CNN/DailyMail 3.0.0 with 1,000 training articles, 100 validation articles, and 100 test articles. Fine-tuning ran for one epoch on an Apple M5 GPU with seed 42, a learning rate of 5e-05, and an effective batch size of 8. The training limits were 1,024 input tokens and 128 target tokens.
The original and fine-tuned checkpoints generated summaries for the same test articles. We chose greedy decoding and a 512-token input limit on the validation sample, then used up to 96 new tokens on test. Scores are average ROUGE F1 multiplied by 100.
| Checkpoint | ROUGE-1 | ROUGE-2 | ROUGE-L |
|---|---|---|---|
| Before fine-tuning | 30.82 | 12.35 | 23.07 |
| After fine-tuning | 31.66 | 13.19 | 23.51 |
Try it with Transformers
Run this from a local copy of the model folder.
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained(".")
model = AutoModelForSeq2SeqLM.from_pretrained(".")
article = (
"The city library reopened its east branch on Monday after a three-month renovation. "
"The branch added a reading room and expanded its weekend hours. "
"The renovation was paid for by a local grant."
)
inputs = tokenizer("summarize: " + article, max_length=512, truncation=True, return_tensors="pt")
output = model.generate(**inputs, max_new_tokens=96, num_beams=1, do_sample=False)
print(tokenizer.decode(output[0], skip_special_tokens=True))
Limitations
The scores describe a small sample of English news. The model can repeat itself, omit important details, or get facts such as dates and names wrong. The 512-token limit can also cut off information near the end of a long article.
Credits
This checkpoint modifies Google's original T5-small weights by fine-tuning them on CNN/DailyMail. See the T5 paper and the CNN/DailyMail dataset card.