Home
Downloads
Licenses Contact

OshonSoft

25th Anniversary - 25+ years of results to be continued

2026 - 25th Anniversary of the
OSHONSOFT PROJECT
OshonSoft © 2001 - 2026

OshonSoft AI Language Model Lab
Finding the Smallest Language Model That Can Learn Three-Digit Addition

PRODUCT HOMEPAGE - GUIDED EXAMPLES AND SCREENSHOTS - USER MANUAL

Three-digit addition capacity study

Experiments with random training examples, small MLPs and Transformers.

Give the model two numbers from 000 to 999. The reply shows the ones, tens and hundreds calculations, including each carry, then writes the sum with four digits.

With 7,000 random training examples, a 24,870-parameter MLP after seven epochs and a 7,144-parameter Transformer after fourteen both gave 3,472/3,472 exact replies on the shared Final evaluation. These were the smallest successful configurations within the study's fourteen-epoch reporting budget.

DOWNLOAD PDF

BRACKET LOGIC - THREE-DIGIT ADDITION - TRANSLATION PATTERNS

On this page
1. Try the trained models
2. Read the carry trace
3. Compare saved replies during training
4. See what changed with more examples and smaller models
5. Repeat the training

1. Try the trained models

The download contains four projects, their initial and trained models, and complete saved replies. The primary MLP and Transformer both reproduced 3,472/3,472 exact Final evaluation replies with the current Lab training and generation code. The second-seed results are included as well.

DOWNLOAD PROJECTS AND MODELS - DOWNLOAD THE LAB

The trained model is supplied as models/selected.osai in its project. Load it through Persistence, using Choose load file and Load checkpoint. In Conversation, choose Greedy, set the reply limit shown below and clear the conversation before each independent question.

The mlp and transformer folders hold the primary recipes. Use a reply limit of 128 and ask, for example, Add 325 and 386.

Click either screenshot to open it at full size.

The 24,870-parameter MLP shows two carries and writes 0711.
The 24,870-parameter MLP shows two carries and writes 0711.
The 7,144-parameter Transformer carries into the thousands and writes 1413.
The 7,144-parameter Transformer carries into the thousands and writes 1413.

WATCH THE TRANSFORMER GENERATE THE REPLY (MP4)

24,870-parameter MLP / saved native reply on the shared Final evaluation
Add 325 and 386.

5 + 6 + ↑0 -> 1 ↑1
2 + 8 + ↑1 -> 1 ↑1
3 + 3 + ↑1 -> 7 ↑0
result: 0711
[EOT]
7,144-parameter Transformer / saved native reply on the shared Final evaluation
Add 468 and 945.

8 + 5 + ↑0 -> 3 ↑1
6 + 4 + ↑1 -> 1 ↑1
4 + 9 + ↑1 -> 4 ↑1
result: 1413
[EOT]

Back to contents

2. Read the carry trace

Each line adds the two digits for that column and the incoming carry. The digit after the arrow stays in that column. The carry goes into the next column. For 325 + 386, the ones column adds 5 + 6 + 0 to give digit 1 and carry 1. The tens column uses that carry. The four-digit result is 0711.

The numeric tokenizer keeps digits, carry markers and line breaks. An exact reply has all three correct lines, the four-digit sum and the end-of-turn token. Gold answers are the reference for scoring. Each saved model reply was generated from the prompt with its own preceding tokens.

The training examples and the questions were split by operand pair, including the reversed order. TRAIN teaches the task. Training checks show progress during training. The shared random Final evaluation is scored at the planned endpoint.

A right sum can still have a wrong trace. In this saved 105,584-parameter MLP reply, the tens column ends with a bare 6 where the reference has an outgoing carry ↑1. The final sum 0332 is correct.

Add 266 and 066.

6 + 6 + ↑0 -> 2 ↑1
6 + 6 + ↑1 -> 3 6
2 + 0 + ↑1 -> 3 ↑0
result: 0332
[EOT]

Back to contents

3. Compare saved replies during training

Choose a run, a Training checks question and a saved epoch. The two panels show the generated reply and the reference. Use the token view to see <lf>, digit joins and <eot>.


Saved model reply

Reference answer

Back to contents

4. See what changed with more examples and smaller models

How much practice? The three random training sets below use the same 105,584-parameter MLP and the same Training checks and Final evaluation questions. Seven epochs on more examples also mean more SGD updates. All three training sets contain the 500 local digit and incoming carry facts. The rarest fact occurs 1, 8 and 18 times in the three sets, respectively.

The same MLP at seven epochs
TRAIN examplesSGD updatesTRAIN exactTraining checks exactShared Final evaluation exact
1,000280,000941/1,000804/1,1682,337/3,472
3,7401,047,2003,740/3,7401,168/1,1683,470/3,472
7,0001,960,0007,000/7,0001,168/1,1683,472/3,472

Exact whole-reply Training checks scores for three random training sets

How small? These runs used the same 7,000 TRAIN examples, numeric vocabulary and 80-token context. A successful endpoint had exact replies on all TRAIN examples and on both of its last two Training checks and known-question checkpoints. The shared Final evaluation is reported separately.

Completed qualifying runs within fourteen epochs
ModelParametersEpochsFirst perfect Training checks epochShared Final evaluation exact
MLP24,870743,472/3,472
MLP50,090733,471/3,472
MLP105,584733,472/3,472
Transformer7,14414103,472/3,472
Transformer13,07214103,472/3,472
Transformer23,664733,472/3,472
Transformer49,592743,472/3,472

At roughly 25,000 parameters, the D4/H70 MLP reached 3,472/3,472 on the shared Final evaluation. D16/H19 reached 650/3,472 with the same seven-epoch budget. The best of the five approximately 10,000-parameter MLPs within fourteen epochs reached 750/3,472. The 13,072-parameter Transformer had 3/3,472 after seven epochs and 3,472/3,472 after fourteen.

How well did it repeat? The second seed used the same dimensions and learning rate, with its own initial weights and shuffled training order. The small Transformer gave very different outcomes in the two runs.

Same configuration and learning rate, two seeds
ModelSeedEpochsTRAIN exactTraining checks exactShared Final evaluation exact
MLP 24,8701234577,000/7,0001,168/1,1683,472/3,472
MLP 24,87023456147,000/7,0001,167/1,1683,465/3,472
Transformer 7,14412345147,000/7,0001,168/1,1683,472/3,472
Transformer 7,144234561416/7,0004/1,16810/3,472

The separate MLP final set, supplied as test_capacity.txt, gave 3,472/3,472 for the primary model and 3,465/3,472 for its confirmation. The table above uses test_random.txt; the two final sets are scored separately.

Back to contents

5. Repeat the training

On an AMD Ryzen 7 7735HS laptop, the repeated primary MLP run took about 1 h 10 min and the primary Transformer run 2 h 9 min. These times include training and all configured checks while several projects shared the CPU. Time spent paused is excluded. Other hardware and workloads will give different timings.

Extract the projects into Documents/OshonSoft AI Language Model Lab. Choose three_digit_addition/mlp or three_digit_addition/transformer. Each already contains its training file and questions. The mlp_confirmation and transformer_confirmation folders use seed 23456.

Settings of the supplied projects
SettingMLPTransformer
DimensionsV32 / C80 / D4 / H70V32 / C80 / D14 / F56; 2 heads, 2 blocks
Parameters24,8707,144
InitializationWider embeddings, +/-1.0Standard Transformer
Primary seed / SGD12345 / 0.0112345 / 0.003
Epoch target7; confirmation 1414; confirmation 14
Checks / reply limitEvery epoch / 128Every epoch / 128

Use the numeric tokenizer with Preserve line breaks, Global epochs and MODEL body/EOT targets. Standalone carry signs ↑0 and ↑1 each form one token. Each complete reply has 40 targets including EOT. With 7,000 training conversations, one epoch contains 280,000 updates: 1,960,000 for seven epochs or 3,920,000 for fourteen. Model dimensions and parameter counts stay the same. Train fresh models with this token sequence; checkpoints trained with split carry signs cannot be reused.

  1. Open the installed OshonSoft AI Language Model Lab. On Project, click Choose project... and select the folder containing experiment.json. The saved settings fill the controls; this does not start training.
  2. Review the dimensions, tokenizer, initialization, learning rate and target. Click Prepare and initialize model. Use the prepared target count to read the update budget.
  3. Start a fresh run. The Lab saves checkpoints and full Prompt/Gold/Raw replies under runs/run-000001/. Use Open run folder or Read replies... to inspect them.
  4. Use Pause + save before closing. Later choose the saved run.json, click Open / recover run, then Resume. Resume keeps the original target.

Use questions/ for Training checks. Select the checkpoint under the study's stated rule, then use Use checkpoint... and Final evaluation for questions/final/. Reusing these already evaluated question sets is a reproduction check; it is not a new unseen test.

For the original capacity comparison, a qualifying endpoint had exact replies on every training example and on both of its last two Training checks and known-question checkpoints. The shared benchmark and fresh MLP evaluation remained separate. Retain the second-seed failures when interpreting the smallest successful run.

Each project supplies models/initial.osai and models/selected.osai. Complete replies are grouped by update in answers/, including the full training check at the endpoint; answers/final/ keeps each final set in its own file. A fresh run creates its own runs/ folder.

Back to contents