Downloads · 30 days
354
10% of all-time downloads
codelion/gpt-2-70m
gpt-2-70m is a text generation model from codelion. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
A 70M parameter GPT-2 model trained on 1 billion tokens using an optimized 50-30-20 dataset mixing strategy.
Downloads · 30 days
354
10% of all-time downloads
All-time downloads
3.7K
Public
Parameters
64.1M
769 MB on disk
Likes
21
Public
Click a slice to open those files.
.pt513 MB · 66%
From the Hugging Face model README
A 70M parameter GPT-2 model trained on 1 billion tokens using an optimized 50-30-20 dataset mixing strategy.
This model demonstrates the effectiveness of careful dataset composition for efficient language model pretraining. Despite using 10x less training data than GPT-2 (1B vs 10B tokens), it achieves competitive performance by leveraging an optimal mixture of high-quality data sources.
Architecture: GPT-2
The model was trained on 1 billion tokens with the following composition:
This 50-30-20 mixing ratio was identified through systematic experimentation as optimal for balanced performance across multiple domains.
| Benchmark | Our Model | Random | GPT-2 | vs Random | vs GPT-2 |
|---|---|---|---|---|---|
| MMLU (5-shot) | 24.11% | 25.00% | 26.00% | -0.89% | -1.89% |
| HellaSwag (0-shot) | 27.03% | 25.00% | 30.00% | +2.03% | -2.97% |
| ARC-Challenge (0-shot) | 21.67% | 25.00% | 24.00% | -3.33% | -2.33% |
| PIQA (0-shot) | 57.29% | 50.00% | 63.00% | +7.29% | -5.71% |
| WinoGrande (0-shot) | 51.46% | 50.00% | 51.00% | +1.46% | +0.46% |
| TruthfulQA MC2 (0-shot) | 47.31% | 25.00% | 40.00% | +22.31% | +7.31% |
| Average | 38.15% | 33.33% | 39.00% | +4.81% | -0.85% |
from transformers import AutoTokenizer, AutoModelForCausalLM
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("codelion/gpt-2-70m")
model = AutoModelForCausalLM.from_pretrained("codelion/gpt-2-70m")
# Generate text with better sampling parameters
inputs = tokenizer("The future of AI is", return_tensors="pt")
outputs = model.generate(
**inputs,
max_length=50,
do_sample=True, # Enable sampling
temperature=0.8, # Control randomness
top_p=0.9, # Nucleus sampling
pad_token_id=tokenizer.eos_token_id
)
print(tokenizer.decode(outputs[0]))
If you use this model/dataset, please cite:
@article{sharma2025billion,
title={The 1 Billion Token Challenge: Finding the Perfect Pre-training Mix},
author={Sharma, Asankhaya},
year={2025},
url={https://huggingface.co/blog/codelion/optimal-dataset-mixing/}
}
For more details, see the blog post.
codelion
For questions or issues, please open an issue on the model repository.