Reuters GPT-2 (five epochs)

A small GPT-2 causal language model trained from random weights, not fine-tuned from a pretrained GPT model. The only borrowed artifact is ingeniumacademy/gpt2-reuters-tokenizer.

  • Architecture: 3 layers, 4 heads, 192-dimensional embeddings, 128-token context, 52,000-token vocabulary; 11,343,552 parameters.
  • Data: all 17,262 Reuters training articles; each title joined to its body with a newline and terminated with EOS. Packed into 23,781 blocks of 128 tokens. Validation/test remain separate.
  • Training: seed 4681, batch size 32, AdamW, learning rate 0.0005, 100 warmup steps, fp16 on Tesla T4, five epochs (331.7 seconds of training).
  • Final validation loss: 4.2158; test loss: 4.0209 on the 128-token packed splits. Training and evaluation evidence: setup.json, epochs_5/results.json, and the independent baseline epochs_2/results.json, alongside train_and_analyze.py and reuters_gpt2.ipynb in this repository.

Usage

from transformers import AutoTokenizer, GPT2LMHeadModel

tokenizer = AutoTokenizer.from_pretrained("Ke-vin-S/reuters-gpt2")
model = GPT2LMHeadModel.from_pretrained("Ke-vin-S/reuters-gpt2")
ids = tokenizer("AMEX SAYS SHORT INTEREST", return_tensors="pt").input_ids
print(tokenizer.decode(model.generate(ids, max_new_tokens=64, do_sample=False)[0]))

This model has limited context and a small training corpus. Its output may repeat phrases or invent financial facts; do not use it as a reliable news source. The public notebook contains the pipeline and clearly labeled recorded outputs.

Downloads last month
4
Safetensors
Model size
11.3M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Dataset used to train Ke-vin-S/reuters-gpt2