File size: 11,805 Bytes
e22b6ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f9038e1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e22b6ce
f9038e1
e22b6ce
f9038e1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e22b6ce
f9038e1
e22b6ce
f9038e1
e22b6ce
f9038e1
 
 
 
 
 
e22b6ce
f9038e1
e22b6ce
f9038e1
e22b6ce
f9038e1
 
 
e22b6ce
f9038e1
 
 
 
e22b6ce
f9038e1
e22b6ce
f9038e1
 
e22b6ce
f9038e1
e22b6ce
f9038e1
e22b6ce
f9038e1
 
e22b6ce
f9038e1
e22b6ce
f9038e1
 
 
 
 
e22b6ce
f9038e1
e22b6ce
f9038e1
e22b6ce
f9038e1
 
 
 
e22b6ce
 
f9038e1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e22b6ce
f9038e1
e22b6ce
f9038e1
 
 
 
 
 
 
 
 
 
 
e22b6ce
 
 
 
 
 
 
 
f9038e1
e22b6ce
 
 
 
 
 
f9038e1
 
e22b6ce
 
 
 
f9038e1
e22b6ce
f9038e1
e22b6ce
 
 
f9038e1
 
 
 
 
 
e22b6ce
f9038e1
 
 
e22b6ce
f9038e1
e22b6ce
f9038e1
 
 
e22b6ce
 
 
f9038e1
e22b6ce
 
 
 
 
 
 
 
 
f9038e1
e22b6ce
f9038e1
 
 
 
 
e22b6ce
f9038e1
e22b6ce
 
 
f9038e1
 
 
 
e22b6ce
f9038e1
 
 
e22b6ce
 
 
 
f9038e1
e22b6ce
 
 
 
 
 
f9038e1
 
 
e22b6ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f9038e1
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
---
license: apache-2.0
language:
- en
pipeline_tag: text-generation
library_name: transformers
tags:
- pebblegpt
- small-language-model
base_model: strectelite/PebbleGPT-320M
datasets:
- HuggingFaceFW/fineweb-edu
- HuggingFaceTB/dclm-edu
- HuggingFaceTB/finemath
- HuggingFaceTB/cosmopedia
- HuggingFaceTB/smoltalk
---

# PebbleGPT-320M-Instruct

## The Story

This model started as a straightforward question: how much of a real language model
pipeline can one person build and run alone, following the published methodology of
a real lab, on a small budget?

The starting point was Hugging Face's Smol Training Playbook, the account of how
SmolLM3 was built. Rather than improvise architecture and training decisions, this
project borrowed them directly wherever the Playbook had already run the ablation.
Grouped query attention at ratio 4, tied embeddings, SwiGLU, no QK-norm, no Z-loss,
embeddings excluded from weight decay, the AdamW hyperparameter triplet that has gone
unchanged from Llama 1 through DeepSeek V3, and a Warmup-Stable-Decay learning rate
schedule. The data mixture ratios (FineWeb-Edu and DCLM-Edu split 50/50, code capped
at 10 percent, math at 5 percent) and the evaluation suite (HellaSwag, PIQA, ARC-easy,
with the noisier benchmarks the Playbook itself flagged as unreliable dropped) came
from the same source. The one deliberate departure was the tokenizer: SmolLM3 uses a
128k vocabulary that makes sense at 3B parameters, but at 320M it would consume 37
percent of the parameter budget as a lookup table, so the smaller 49k SmolLM2
tokenizer was used instead.

Pretraining ran for 10B tokens on a single rented H100. The result was a functioning
base model with loss 2.507 and benchmark scores in the expected range for a model this
small and this undertrained relative to modern practice. Preparing the data, debugging
the pipeline, and a handful of false starts added real cost on top of the clean run
time, all folded into the totals below.

At that point the model was evaluated against a set of comparable public models,
matched as closely as possible on parameter count and training scale. Two benchmarks
stood out as places where the model was underperforming what the token budget should
have allowed: PIQA, which measures physical commonsense reasoning, and ARC-easy, which
measures grade school science reasoning. Rather than accept that gap or retrain from
scratch, the model went through a short mid-training pass (an annealing phase in the
Playbook's terminology) aimed specifically at those two benchmarks.

The mixture for that phase was 40 percent replay of the original pretraining data,
mixed with Cosmopedia's `wikihow` and `stories` splits for PIQA and its `openstax` and
`khanacademy` splits for ARC-easy. The run was a warm restart from the fully decayed
pretraining checkpoint, 300M tokens, 30 minutes, on a rented RTX PRO 6000. It was the
single highest return step in the entire project: HellaSwag rose from 30.5 to 40.4,
PIQA from 55.5 to 67.7, and ARC-easy from 37.7 to 56.4.

Supervised fine-tuning followed, using SmolTalk with ChatML formatting and loss
masked to assistant response tokens only. This phase was free. As a student with
Colab Pro access, the fine-tuning run used a Colab-provisioned A100 rather than a
rented one, and took about 20 minutes for 50,000 conversations across 2 epochs.

## Usage

```bash
pip install transformers torch
```

```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

checkpoint = "strectelite/PebbleGPT-320M-Instruct"
device = "cuda"  # or "cpu"

tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForCausalLM.from_pretrained(
    checkpoint, trust_remote_code=True
).to(device)

prompt = "Explain what recursion is in simple terms."
text = f"<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n"

inputs = tokenizer(text, return_tensors="pt").to(device)
outputs = model.generate(
    **inputs,
    max_new_tokens=150,
    do_sample=True,
    temperature=0.7,
    top_k=40,
    eos_token_id=tokenizer.convert_tokens_to_ids("<|im_end|>"),
)
print(tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
```

`trust_remote_code=True` is required. The architecture is not registered in
`transformers`, so the model source ships alongside the weights. There is currently
no GGUF conversion, so this model does not run in llama.cpp or Ollama.

### Chat format

The model uses ChatML.

```
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant
{response}<|im_end|>
```

### Sample outputs

Write a Python function that reverses a string.

```python
def reverse_string(s):
    return s[::-1]

# Test the function
s = "Hello"
print(reverse_string(s))
```

Explain what recursion is in simple terms.

> Recursion is a technique in programming to solve a problem by breaking it down into
> smaller, simpler parts, each of which can be solved independently.

Summarize why the sky is blue in one sentence.

> The sky is blue because it has a rich blue color.

The third example shows a common failure mode: fluent, correctly formatted, and
substantively empty.

## Results

All scores are zero-shot, full test sets, measured with
[lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness). The
comparison models below were evaluated with the identical harness, task versions, and
batch size, rather than taken from other papers, so the numbers are directly
comparable.

### Across this model's own training phases

| Benchmark | After pretraining | After mid-training | After SFT (this model) |
|---|---|---|---|
| HellaSwag (acc_norm) | 30.5 | 40.4 | 40.60 |
| PIQA (acc_norm) | 55.5 | 67.7 | 66.76 |
| ARC-easy (acc_norm) | 37.7 | 56.4 | 53.79 |
| ARC-challenge (acc_norm) | n/a | 31.1 | 29.95 |
| Training loss | 2.507 | 2.067 | n/a |

Mid-training produced most of the movement. Supervised fine-tuning held those gains
within one to three points, which is the ordinary cost of instruction tuning rather
than a sign that anything went wrong.

### Against comparable public models

| Model | Params | Training tokens | HellaSwag | PIQA | ARC-easy | ARC-challenge |
|---|---|---|---|---|---|---|
| GPT-2 | 124M | ~8-10B | 31.14 | 62.51 | 39.48 | 22.70 |
| Pythia-160M | 160M | 300B | 30.15 | 61.70 | 39.56 | 23.81 |
| Pythia-410M | 410M | 300B | 40.61 | 66.97 | 45.92 | 24.40 |
| SmolLM2-135M | 135M | 2T | 43.10 | 68.34 | 58.54 | 29.86 |
| **PebbleGPT-320M-Instruct** | **320M** | **10.4B** | **40.60** | **66.76** | **53.79** | **29.95** |
| SmolLM2-360M | 360M | 4T | 56.36 | 72.03 | 68.01 | 38.05 |
| Qwen3-0.6B-Base | 600M | 36T | 53.83 | 70.02 | 57.91 | 38.40 |

The closest comparison on training budget is GPT-2, which used a similar token count
to this model. At nearly identical data scale, this model is ahead on both ARC
benchmarks and roughly level on HellaSwag and PIQA. Against models trained on 30 to
3,500 times more data, the gap is real and is the honest limit of a 10.4B token
budget, not something the mid-training pass could fully close.

### Instruction following

Measured after supervised fine-tuning, since the base and mid-trained checkpoints
have no instruction-following behavior to measure.

| Metric | Score |
|---|---|
| IFEval inst-level loose | 27.8 |
| IFEval inst-level strict | 27.2 |
| IFEval prompt-level loose | 14.4 |
| IFEval prompt-level strict | 13.7 |

## Architecture

| Parameter | Value |
|---|---|
| Total parameters | 320.9M |
| Non-embedding parameters | 270.6M |
| Layers | 24 |
| Hidden size | 1024 |
| Intermediate size | 2816 |
| Attention | Grouped query attention, 16 query heads, 4 KV heads |
| Head dimension | 64 |
| Activation | SwiGLU |
| Normalization | RMSNorm, pre-norm |
| Positional encoding | RoPE, theta 10000 |
| Embeddings | Tied input and output |
| Context length | 2048 |
| Vocabulary size | 49,152, SmolLM2 tokenizer |
| Precision | bfloat16 mixed precision, fp32 master weights |

The intermediate size of 2816 is roughly 8/3 of the hidden size rather than the more
common 4x. SwiGLU uses three weight matrices where a standard feedforward layer uses
two, so the 8/3 ratio keeps the parameter count comparable to a non-gated layer at 4x
width, and matches what SmolLM2-135M and SmolLM2-360M both use at this scale.

### Pretraining

10B tokens, 19,073 steps at 524,288 tokens per step.

| Source | Share |
|---|---|
| FineWeb-Edu | 42.5% |
| DCLM-Edu, filtered to edu_int_score >= 3 | 42.5% |
| Python-Edu | 10% |
| FineMath-4+ | 5% |

AdamW, betas 0.9 and 0.95, weight decay 0.1 excluding embeddings and norms, gradient
clipping 1.0. Warmup-Stable-Decay schedule, peak learning rate 5e-4, minimum 5e-5,
2,000 warmup steps, 10 percent decay window.

### Mid-training

300M tokens, warm restart from the fully decayed pretraining checkpoint with a fresh
optimizer state. Peak learning rate 1.2e-4, roughly 25 percent of the original peak,
30 warmup steps, 85 percent decay window, 572 steps.

| Source | Share | Purpose |
|---|---|---|
| Baseline replay from pretraining mixture | 40% | Prevent narrowing |
| Cosmopedia wikihow | 20% | Procedural and physical reasoning |
| Cosmopedia stories | 10% | Everyday world knowledge |
| Cosmopedia openstax | 15% | Science curriculum content |
| Cosmopedia khanacademy | 15% | Science curriculum content |

Cosmopedia is synthetic data generated by Mixtral-8x7B-Instruct-v0.1. Its authors
decontaminated it against ARC, PIQA, HellaSwag, OpenBookQA, WinoGrande, MMLU, and
BoolQ using 10-gram overlap detection.

### Supervised fine-tuning

50,000 conversations from
[SmolTalk](https://huggingface.co/datasets/HuggingFaceTB/smoltalk), 2 epochs. ChatML
format, loss masked to assistant response tokens only. AdamW at 2e-5, weight decay
0.01, OneCycleLR cosine schedule, 3 percent warmup, batch size 32, sequence length
1,024, 3,126 steps.

## Compute Cost

| Phase | Hardware | Duration | Cost |
|---|---|---|---|
| Pretraining, including data preparation and debugging | H100 SXM, plus a 32 vCPU instance for data prep | ~24 hours combined | $50 |
| Mid-training, including the data pipeline for it | RTX PRO 6000 | ~30 minutes | $1 |
| Supervised fine-tuning | A100, Colab Pro | ~20 minutes | $0 |
| **Total** | | | **~$60** |

Roughly a third of the pretraining figure was spent on debugging rather than clean
training time. That cost is included rather than hidden, because it is a real part of
what a first solo attempt at this actually takes.

## Limitations

Factual reliability is poor. Asked for the capital of France, the model correctly
answers Paris and then places it in a charming town called Marseille. A 10.4B token
budget does not encode reliable world knowledge at this parameter count.

Instruction following is partial. An IFEval prompt-level strict score of 13.7 means
the model satisfies every constraint in a prompt roughly one time in seven.

Benchmark gains are concentrated. PIQA and ARC-easy improved most because the
mid-training data was selected to target them. This is a documented technique rather
than contamination, but it means the model is not uniformly stronger. Knowledge and
mathematical reasoning benchmarks remain at chance.

No safety alignment. Fine-tuned on SmolTalk only. No preference optimization, no red
teaming, no safety evaluation.

Short context. 2,048 tokens, with no long context extension.

Research and education only. Not suitable for production use, factual lookup, or any
application where being wrong has consequences.

## License

Apache 2.0

## Citation

```bibtex
@software{pebblegpt2026,
  author = {Sriram, Sanjay},
  title = {PebbleGPT: an exploratory study in training a language model
           from scratch on a small budget},
  year = {2026},
  url = {https://huggingface.co/strectelite/PebbleGPT-320M-Instruct}
}
```