Pronghorn-5M-v2-Buck

A 5.49-million-parameter decoder-only language model trained from scratch

Pronghorn-5M-v2-Buck is a compact autoregressive language model developed as an experiment in small-scale language-model pretraining. It uses a decoder-only Transformer architecture and was trained from randomly initialized weights on a large, curated collection of children's stories.

The project explores how a small Transformer behaves when trained on substantially more data than its smaller predecessor, Pronghorn-5M-v2-Fawn.

Rather than relying on an existing pretrained language model, Pronghorn-5M-v2-Buck was built and trained from scratch, including its tokenizer, model architecture, and training pipeline.


Model Overview

Property Value
Model name Pronghorn-5M-v2-Buck
Model family Pronghorn-5M-v2
Architecture Decoder-only Transformer
Parameters 5,489,856
Vocabulary size 4,000
Model dimension 192
Transformer layers 8
Attention heads 6
Head dimension 32
Feed-forward dimension 768
Context length 256 tokens
Normalization RMSNorm
Positional encoding Rotary Position Embeddings (RoPE)
Feed-forward activation SwiGLU
Attention implementation PyTorch scaled dot-product attention
Embeddings Tied token embeddings and language-model head
Tokenizer Custom 4K Byte-Level BPE
Training objective Causal next-token prediction
Training initialization Random initialization
Training framework PyTorch
Model format PyTorch state dictionary
License MIT

Architecture

Pronghorn-5M-v2-Buck uses a pre-normalized decoder-only Transformer.

Its architecture was deliberately kept compact while incorporating several techniques used in modern Transformer language models.

Transformer components

RMSNorm

Root Mean Square Layer Normalization is applied before the attention and feed-forward sublayers.

Rotary Position Embeddings (RoPE)

Rotary positional embeddings are applied to query and key representations within each attention layer.

Multi-head causal self-attention

The model uses six attention heads, each with a dimension of 32. Causal masking prevents tokens from attending to future positions.

SwiGLU feed-forward network

Each Transformer block uses a gated feed-forward network with a hidden dimension of 768.

Residual connections

Both attention and feed-forward sublayers use residual connections.

Weight tying

The token embedding matrix and language-model output projection share their weights, reducing the number of independent parameters.

Architecture configuration

Vocabulary size:       4,000
Embedding dimension:   192
Transformer layers:    8
Attention heads:       6
Head dimension:        32
SwiGLU hidden size:    768
Context length:        256

Normalization:         RMSNorm
Position encoding:     RoPE
Attention:             Causal self-attention
Feed-forward:          SwiGLU
Embedding weights:     Tied

Total parameters:      5,489,856

Training Data

Pronghorn-5M-v2-Buck was trained on Taleweave-1B-4K, a curated tokenized dataset containing approximately 929.5 million training tokens.

The dataset combines two children's-story collections:

Source dataset Contribution
TinyStories 50% target mixture
Children Stories Collection 50% target mixture

The two sources were combined using an interleaved 50/50 sampling strategy. The resulting training stream contains approximately 2.92 million cleaned stories.

Dataset preparation

The dataset preparation pipeline included:

  • Cleaning non-printable control characters while preserving newlines and tabs.
  • Collapsing sequences of three or more consecutive newlines.
  • Filtering stories shorter than 40 characters.
  • Training a custom 4,000-token Byte-Level BPE tokenizer.
  • Excluding tokenizer-fitting stories from the training stream.
  • Separating a held-out validation collection before generating the training binary.

The tokenizer was fitted using 80,000 stories excluded from model training.

Dataset split

Split Size
Training tokens 929,495,205
Validation tokens 5,000,000
Validation stories 13,742
Cleaned story collection Approximately 2.92 million

The validation collection was kept separate from the training stream.

Tokenizer

The model uses a custom Byte-Level BPE tokenizer with a vocabulary of 4,000 tokens.

Special tokens:

Token ID Purpose
`< endoftext >`
`< pad >`
`< unk >`

The tokenizer is distributed with the model repository as tokenizer_4k.json.

The training dataset is published separately in the Taleweave-1B-4K repository.

Training Configuration

The larger Buck experiment uses the same model architecture and core optimization configuration as Pronghorn-5M-v2-Fawn. This allows the two experiments to be compared without intentionally changing the architecture.

Training setting Configuration
Training approach From-scratch pretraining
Training objective Next-token prediction
Training passes 1
Training token exposures Approximately 929.5 million
Global batch size 64 sequences
Per-GPU batch size 32 sequences
Context length 256
Tokens per optimizer step 16,384
Hardware 2 Γ— NVIDIA Tesla T4 GPUs
Optimizer AdamW
Adam betas (0.9, 0.95)
Peak learning rate 1 Γ— 10⁻³
Minimum learning rate 1 Γ— 10⁻⁴
Warmup 300 optimizer steps
Learning-rate schedule Cosine decay
Weight decay 0.1 for matrix parameters; 0 for one-dimensional parameters
Gradient clipping 1.0

The training pipeline uses PyTorch distributed training with NVIDIA NCCL.

The model uses random initialization, with scaled initialization for residual output projections.

Training Results

The repository includes training artifacts when available:

  • training_metrics.csv β€” recorded training and validation metrics.
  • generated_samples.txt β€” text samples generated by the trained model.
  • model_weights.pt β€” exported model weights.

The best model checkpoint was selected using validation loss.

Important: Validation loss and perplexity should be taken from the actual training logs and checkpoint metadata. No benchmark results or performance claims are presented here without corresponding measurements.

For the full experiment history, consult the included metrics file.

Installation

Install the required Python packages:

pip install torch tokenizers huggingface_hub

Download the model repository:

from huggingface_hub import snapshot_download

model_dir = snapshot_download(
    repo_id="AlmostNobody/Pronghorn-5M-v2-Buck"
)

Loading the Model

The repository contains a standalone model implementation in modeling_pronghorn.py.

import sys
import torch
from pathlib import Path
from tokenizers import Tokenizer
from huggingface_hub import snapshot_download

model_dir = Path(snapshot_download(
    repo_id="AlmostNobody/Pronghorn-5M-v2-Buck"
))

sys.path.insert(0, str(model_dir))

from modeling_pronghorn import Pronghorn

device = "cuda" if torch.cuda.is_available() else "cpu"

model = Pronghorn(
    vocab=4000,
    dim=192,
    n_layers=8,
    n_heads=6,
    hidden=768,
)

state_dict = torch.load(
    model_dir / "model_weights.pt",
    map_location="cpu",
    weights_only=True,
)

model.load_state_dict(state_dict)
model.to(device)
model.eval()

tokenizer = Tokenizer.from_file(
    str(model_dir / "tokenizer_4k.json")
)

print("Model loaded successfully.")
print("Device:", device)
print("Parameters:", sum(p.numel() for p in model.parameters()))

Text Generation

Once loaded, the model can generate text using its built-in generation method.

prompt = "Once upon a time, in a small village"

generated_text = model.generate(
    tokenizer=tokenizer,
    prompt=prompt,
    max_new_tokens=120,
    temperature=0.8,
    top_k=50,
    ctx=256,
    device=device,
)

print(generated_text)

Generation parameters can be adjusted:

Parameter Default Description
max_new_tokens 120 Maximum number of new tokens
temperature 0.8 Controls sampling randomness
top_k 50 Restricts sampling to the top-k logits
ctx 256 Maximum context window

The model is a small experimental language model. Generation quality and coherence are expected to differ substantially from those of larger pretrained language models.

Model Files

File Description
config.json Model configuration and experiment metadata
modeling_pronghorn.py Standalone PyTorch architecture and generation implementation
model_weights.pt Clean exported model state dictionary
tokenizer_4k.json Custom 4K Byte-Level BPE tokenizer
training_metrics.csv Training and validation metrics, if included
generated_samples.txt Example generations, if included
README.md Model documentation
LICENSE MIT License

Limitations

Pronghorn-5M-v2-Buck is an experimental small language model, not a general-purpose conversational assistant.

Its limitations include:

  • A relatively small parameter count of approximately 5.49 million.
  • A limited context window of 256 tokens.
  • A vocabulary of only 4,000 tokens. (Though the bigger question is: is that really a limitation?)

Research Context

Pronghorn-5M-v2-Buck is part of an ongoing effort to investigate small language models trained from scratch.

The Pronghorn-5M-v2 experiments use a fixed architecture while exploring the effects of training-data scale.

The smaller Pronghorn-5M-v2-Fawn experiment used approximately 148 million token exposures. Buck uses approximately 929.5 million training tokens in a single pass.

This creates an opportunity to investigate how increased training-data exposure affects optimization, validation performance, and generated text while keeping the model architecture consistent.

A meaningful comparison requires the same evaluation datasets, metrics, and generation settings. Such comparisons should be reported separately once the experiments have been evaluated.

Reproducibility

The repository provides the model implementation, exported weights, tokenizer, configuration, and available training artifacts.

The separate dataset repository provides the tokenized training and validation data.

For reproducibility, the following should be considered together:

  • Model architecture and initialization.
  • Tokenizer vocabulary and special-token IDs.
  • Training dataset and validation split.
  • Optimizer and learning-rate schedule.
  • Batch size and context length.
  • Random seeds and hardware/software environment.

Minor numerical differences may occur across hardware, PyTorch versions, and execution environments.


Author: AlmostNobody

Model: AlmostNobody/Pronghorn-5M-v2-Buck

Dataset: AlmostNobody/Taleweave-1B-4K

License: MIT

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support