Xenron-50M: A compact decoder-only model trained from scratch
2 min readupdated
Xenron-50M is a compact language model based on the Llama architecture (a type of transformer) with 50 million parameters, trained from scratch on the FineWeb-Edu dataset. Built using the JAX / Flax NNX stack and optimized for the transformers library, it generates English text and achieves high training speeds on two NVIDIA T4 GPUs. This model is well-suited for fine-tuning experiments, exploring compact language models, and deploying on modest hardware.
Key features
- Compact size: just 50.15M parameters and a 1024-token context.
- Trained from scratch: processed about 1 billion tokens on FineWeb-Edu.
- Llama architecture: uses SwiGLU, RMSNorm, and RoPE positional embeddings.
- High performance: average processing speed exceeded 36,600 tokens per second.
What you can do
- Run generation: test the base model using a standard PyTorch script.
- Explore code: examine the JAX pre-training scripts and the conversion of Orbax checkpoints to Hugging Face safetensors format.
- Run experiments: use the model as a base for your own lightweight language model experiments.
Example
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_dir = "Anon170/xenron-50m"
tokenizer = AutoTokenizer.from_pretrained(model_dir)
model = AutoModelForCausalLM.from_pretrained(model_dir, dtype=torch.float16)
model.eval()
inputs = tokenizer("The history of artificial intelligence", return_tensors="pt")
with torch.no_grad():
out = model.generate(
**inputs,
max_new_tokens=50,
do_sample=True,
temperature=0.8,
top_p=0.95,
repetition_penalty=1.1,
pad_token_id=tokenizer.eos_token_id,
)
print(tokenizer.decode(out[0], skip_special_tokens=True))Read more
DetailsBenchmarks: final val_loss = 3.2427, val_ppl = 25.60
Training: 2× NVIDIA T4 GPUs (FP16), about 7 hours and 39 minutes of pure runtime
Tokenizer: Byte-Level BPE with a vocabulary size of 16,384
License: MIT License










Comments