Skip to main content
Build in public

BentoLM

Training a bilingual Chinese and English small model from scratch, in the open.

Experiments
25
Spent so far
¥523
Running for
21days
Current model
307M

Updated 2026-11-10

Progress

  1. 0Infrastructure
  2. In progress
  3. 5Multimodal
  4. 6Agentic training
  5. 7Inference and deployment

Experiment log

1Pre-trainingE001–E015

  1. E001zh/en ratio for the bilingual tokenizer

    Finding
    Question
    For a bilingual BPE tokenizer with a 32768 vocabulary, what share of the training text should be Chinese?
    Finding

    zh compression saturates quickly (raising the Chinese share from 25% to 75% improves zh by only 5%), while en keeps benefiting (it drops 12% over the same range).

    The overall compression difference between the three ratios is within 3%. zh50 is the tentative default tokenizer (decent on both zh and en); the final choice will be validated with S-model bpb.

    Cost¥0.4
  2. E002zh/en ratio of the pretraining data

    Adopted
    Question
    For bilingual pretraining of the S model (55M), what share of the tokens should be zh and what share en?
    Finding

    5:5 is the most balanced and becomes the V2 default ratio.

    Moving away from 5:5 in either direction gains less than it costs: raising zh from 50% to 70% lowers zh bpb by only 0.013 but raises en bpb by 0.047; lowering zh from 50% to 30% lowers en bpb by only 0.021 but raises zh bpb by 0.067.

    Cost¥12Training curves
  3. E003Choosing the bilingual tokenizer

    Adopted
    Question
    The three tokenizers trained in E001 (training text 25% / 50% / 75% Chinese) differ in compression by less than 3%. Which one is better when actually training a model?
    Finding

    zh50 is the most balanced and becomes the V2 tokenizer.

    With less Chinese vocabulary (zh25), zh gets clearly worse and en does not get better; with more Chinese vocabulary (zh75), zh is only slightly better (0.008) while en gets worse by more (0.016).

    Cost¥2.6Training curves
  4. E004Run-to-run noise for a fixed config

    Finding
    Question
    If the same config is trained repeatedly, how much does validation set bpb vary? Below what difference should an ablation result not be trusted?
    Finding

    For the same config, zh bpb ranges from 1.433 to 1.455.

    Four of five runs fall within 1.449 to 1.455, and one is clearly better. A single-run comparison with a gap within 0.015 cannot support a conclusion. Runs with the same seed diverge early in training, regardless of GPU model.

    Cost¥10.2Training curves
  5. E005Attention head size and KV sharing

    Kept
    Question
    The S model (dim 512) uses 4 heads of 128 dims. How do quality and speed change if we switch to 8 heads of 64 dims, or let several query heads share KV (GQA, MQA)?
    Finding

    Keep 4 heads of 128 dims, with one KV group per query head.

    GQA (2 KV groups) is clearly worse; 64-dim heads are slightly worse and not faster. MQA was not run: GQA is already worse, and sharing a single KV group can only be worse.

    bpbChinese +0.022English +0.019Cost¥4.9Training curves
  6. E006SwiGLU vs ReLU²

    Adopted
    Question
    What happens if the MLP switches from V1's ReLU² (hidden size 2048) to SwiGLU (hidden size 1344, about the same parameter count)?
    Finding

    Adopt SwiGLU.

    One run on each of the two GPU types: zh and en bpb both drop by about 0.01, and answer bpb is better in both. Each single gap is slightly below the 0.015 threshold, but the two independent runs agree in direction, and both are below all four typical baseline runs. Only 2% slower.

    bpbChinese −0.010English −0.006Cost¥5.2Training curves
  7. E007Local attention

    Rejected
    Question
    If 3 out of every 4 layers attend only to the most recent 256 tokens (sliding window) and the last layer attends globally, can we save compute without losing quality?
    Finding

    Not adopted.

    Quality is a tie, but training is actually 14% slower. The window-128 run was not done: window 256 already shows no benefit, and a smaller window can only be worse.

    bpbChinese +0.000English −0.003Cost¥3Training curves
  8. E008Partial RoPE

    Kept
    Question
    What happens if each head applies rotary position embedding to only part of its dimensions, and the remaining dimensions match on content only?
    Finding

    Keep rotating all dimensions for now.

    Rotating only a quarter (rope25) is clearly worse; rotating half (rope50) is a tie with the baseline. Partial RoPE may help long-context extrapolation, so test it again in the mid-training stage (context extension).

    bpbChinese +0.015English +0.012Cost¥5.1Training curves
  9. E009Attention output gate

    Adopted
    Question
    What happens if we multiply the attention output by an input-dependent sigmoid gate (one extra dim × dim projection per layer)?
    Finding

    Adopt; the biggest improvement of week 1.

    The zh bpb drops by 0.047 and the en bpb by 0.033, and answer bpb is better in every task group, far beyond run-to-run noise. The cost is 3.1M more parameters (+5.8%) and 5.5% slower training.

    bpbChinese −0.045English −0.031Cost¥2.7Training curves
  10. E010Quality-sorted data order

    Rejected
    Question
    For the same set of documents, does sorting them by Ultra-FineWeb quality score from low to high, so that the high-quality documents land in the learning rate decay phase (following Puro-2B), beat random order?
    Finding

    Not adopted for pretraining.

    After sorting, validation set bpb got worse (zh +0.017, en +0.013); only the answer bpb on knowledge tasks improved. Checkpoint averaging over the learning rate decay phase did not help either. The constant learning rate plus checkpoint averaging (CMA) pair is postponed to week 2, to be run together with the learning rate schedule experiments.

    bpbChinese +0.017English +0.013Cost¥5.4Training curves
  11. E011AdamW learning rate and Muon

    Adopted
    Question
    Under recipe v1, is the AdamW learning rate of 3e-3 a good choice? How much better is Muon (Muon for the 2D matrices inside Transformer blocks, AdamW for all other parameters)? What learning rate should Muon use?
    Finding

    Adopt Muon, learning rate 0.02.

    Muon is 0.025 lower in zh bpb and 0.022 lower in en bpb than the best AdamW, at the same speed. Muon learning rates from 0.01 to 0.02 make almost no difference; 0.04 is clearly worse. AdamW's 3e-3 is itself close to optimal.

    bpbChinese −0.025English −0.022Cost¥16Training curves
  12. E012Learning rate schedule

    Kept
    Question
    Under Muon (E011), which of three schedules is best: WSD, cosine, or constant learning rate plus checkpoint averaging (CMA)?
    Finding

    Keep WSD.

    Cosine and WSD are a tie (zh difference 0.005); WSD is slightly better, and its training length can be extended after the fact. CMA cannot catch up with learning rate decay: even after averaging the last 10 checkpoints it is still 0.032 worse than WSD.

    bpbChinese +0.005English +0.004Cost¥5.5Training curves
  13. E013Scaling law

    Finding
    Question
    Under recipe v2, how does validation loss change with model size N and training tokens D? Can we use it to predict the loss of a 1B model and decide how large the model should be and how many tokens to train on?
    Finding

    L(N, D) = E + A/N^α + B/D^β fits well (20 points, error 0.004, below the run-to-run noise of 0.008).

    For a 1B model (2048 × 18) trained on 30B tokens it predicts zh bpb about 1.07 and en about 0.86. After adding points at 5 and 80 tokens per parameter, which widens the data range from 4x to 16x, the exponent intervals shrank by nearly half, and for the same compute, a larger model beats more data is now better supported; the fitted optimal ratio (3 to 5 tokens per parameter) is still an extrapolation and is not used directly to set the 1B training length.

    Cost¥149Training curves
  14. E014Learning-rate transfer

    Finding
    Question
    Muon's learning rate of 0.02 was tuned on S (57.3M parameters, E011). Is it still optimal for the larger ml (96.1M)? Is the growing annealing gain in E013 caused by this learning rate being too high for larger models?
    Finding

    It carries over.

    0.01 and 0.02 are a tie (zh differs by 0.004, en by 0.002); 0.04 is clearly worse (zh +0.021, en +0.016). The optimum lies between 0.01 and 0.02, and 0.01 is slightly better on knowledge answer bpb (by 0.023). The course's main model (about 300M parameters) uses 0.01, since a learning rate that is too high costs much more than one that is too low. The growing annealing gain in E013 is mainly not caused by the learning rate.

    Cost¥17Training curves
  15. E015Course main model (307M parameters)

    Finding
    Question
    Train the course's main model with the frozen recipe v2; mid-training, SFT, RL, multimodal and agent work all build on it. Along the way, test E013's scaling law: the prediction written down before training was zh 1.164 and en 0.938, and the criterion fixed in advance was that a zh result between 1.15 and 1.18 counts as correct.
    Finding

    The model beat the prediction, so the prediction missed.

    Final zh 1.1410 and en 0.9259, 0.023 and 0.013 below the prediction and outside both bootstrap intervals; the zh miss is about 3 times the run-to-run noise (0.008). The miss is not in the final decay (the decay gain is almost the same as for the 148M model) but in the gain from scaling up itself: with the parameters going from 148M to 307M and the training tokens doubling with them, zh fell by 0.093, while the fit gave 0.073. The fit is conservative at the large end.

    Cost¥152Training curves

2Mid-trainingE017–E018

  1. E017Long context: taking the main model from 512 to 2048 tokens

    Adopted
    Question
    The main model was pre-trained at 512 tokens. When extending it to 2048, should RoPE change, and how? Three options: no change, raising the base from 10,000 to 100,000, and YaRN.
    Finding

    Adopt YaRN.

    Inside 2048 the three are equally good (passkey 99% to 100%, validation bpb within 0.005). The difference shows at 4096, a length none of them trained on: with no change the passkey drops to 48% (zh) and 59% (en), and the farther the key sits from the question the less often it is found, yet the loss does not get worse, so the loss alone hides the problem. The larger base and YaRN both keep 93% and 99%, but the larger base has 0.06 (zh) and 0.04 (en) higher loss between 2048 and 4096; YaRN does not. E018's 2048 mid-training uses YaRN.

  2. E018Mid-training: redoing the main model's decay on higher-quality data

    Adopted
    Question
    the main model's last 20% (the learning-rate decay, 1.23B tokens) used ordinary web data. Does a mix of high-quality web, math, code, textbooks and encyclopedia text make it better? Does doing it at 2048 tokens hurt short text? Do the differences survive SFT?
    Finding

    Adopt M2 (mid-training at 2048 with YaRN) as the base from here on.

    Mid-training makes math text easier to predict: GSM8K solution bpb drops from 0.887 to 0.795, and after SFT still from 0.851 to 0.801. The SFT chat validation loss is 0.02 lower in both languages, and the context reaches 2048 with full passkey scores. The cost is about 0.02 higher bpb on ordinary web text; multiple-choice scores (including the GSM8K and MGSM choice tasks) show no change beyond noise, before or after SFT. Mid-training at 2048 and at 512 come out the same on short text.

    Cost¥68Training curves

3SFTE016, E023, E025

  1. E016First SFT of the main model

    Finding
    Question
    What does the 300M main model learn from SFT straight after pre-training, how much of its pre-training ability does it lose, and do a lower learning rate and replaying pre-training text reduce that loss?
    Finding

    Learning rate 1e-4, with 15% pre-training text mixed in.

    The default 3e-4 forgets badly: zh bpb on web text goes from 1.141 to 2.024, and the English multiple-choice tasks drop 5 to 9 points. At 1e-4 the chat data is learned better (lower SFT validation loss) and the forgetting is about halved. Mixing in 15% of web text the base model never saw leaves the chat loss unchanged and brings the task scores almost back to their pre-SFT values; web bpb is still 0.2 (zh) and 0.1 (en) higher. Later SFT runs use this setting.

    Cost¥24Training curves
  2. E023GSM8K with a Python interpreter: one whole program, or one calculator call per step

    Finding
    Question
    E021's tool SFT has the model call the calculator at every step and read the result before writing on; greedy GSM8K with the calculator is 11.0%. With a Python interpreter the model has to write the whole program before anything runs, keeping intermediate results in variables. Same problems, same training: which way suits a 307M model better?
    Finding

    Level.

    Greedy GSM8K with the Python tool is 10.0%, with the calculator 11.0%, 14 against 17 problem by problem (p about 0.72); sampling is the same too (pass@32 48% against 50%, pass@1 5.4% against 5.3%). 99% of the finished programs run without an error, and the wrong answers are almost all wrongly set-up calculations, not wrong arithmetic. The Python version has one problem of its own: on 13% of problems the model writes the same lines over and over until the 384 tokens run out, so the program is never finished and never runs.

    Cost¥1.4Training curves
  3. E025Knowledge-base search: with a search tool, how many factual questions does the model get right

    Finding
    Question
    a 307M model remembers few facts and can hardly answer questions about Wikipedia without material. Given a search tool over a local knowledge base, searching first and then answering, how many Chinese and English factual questions does it get right? Do the queries the model writes itself find the right passage?
    Finding

    both checks pass; search takes factual questions from almost never right to right about half the time.

    EM with the tool: SQuAD (English) 44.0%, CMRC2018 (Chinese) 52.0%; the starting point sft_tool2 scores 0.0% and 0.0% closed book, so 44 and 52 points higher (the bar is 20). The model's first search finds the passage 78.7% and 98.3% of the time (bars 73.7% and 93.3%), but on all 300 of 300 questions the query is the question copied verbatim, so the hit rate is exactly that of searching with the question: it learned to call the tool, not to rewrite a query, and it never searches a second time. In English most errors are reading: the 236 questions whose passage was found score 55.1% EM, the 64 not found 3.1%. Forgetting: arithmetic with the calculator stays all right, multiple choice is 0.4 points lower on average, web bpb is 0.018 higher in Chinese and 0.012 in English, more than earlier tool SFT.

    Cost¥1.3Training curves

4Preference tuning and RLE019–E022, E024

  1. E019RL: teaching the 300M model arithmetic with a right/wrong reward

    Rejected
    Question
    can the main model (E018's sft_m2) learn arithmetic from RL with only a right/wrong reward? How does it compare with SFT on the answers? Does it forget anything?
    Finding

    RL not adopted: it does not make the model solve more problems; the SFT control scores higher, also on unseen problems, but part of it is remembered answers.

    500 RL steps raise the mean test accuracy from 25.4% to 47.6% (lenient 29.7% to 47.8%, same direction) with no loss on multiple choice or web bpb, so by the plan's criteria RL works. But nearly all of the gain is on problems the model could already sample right: the share with at least one right answer in 32 samples (pass@32) goes from 61.0% to 61.3%, unchanged; only how often it samples them changes (pass@1 20.1% to 46.3%). The SFT control, 500 steps on program-written answers, reaches 67.4% and a pass@32 of 96.0%. But on average 91% of the test expressions also appear among the SFT training problems (100% on 5 of the 8 levels). On problems neither run saw, re-evaluated for three levels, SFT is still well above the start and RL (two-digit addition 12.0% vs 1.5% and 7.0%, three numbers added 23.5% vs 2.0% and 6.0%, two-digit subtraction 46.8% vs 14.9% and 19.1%), with pass@32 at 81% to 98%, so SFT's lead is not only remembered answers; but on two-digit addition it gets 22.6% of the seen problems right and only 12.0% of the unseen ones, so part of it is. On the other 5 levels SFT saw every possible expression, so they cannot be tested. Neither transfers to GSM8K.

    Cost¥2.6Training curves
  2. E020Calculator tool: tool SFT and multi-turn RL

    Adopted
    Question
    can the main model learn to call a calculator? Does it learn the method or remember answers? After SFT, how much more does multi-turn RL bring?
    Finding

    Adopt tool SFT (sft_tool2's recipe): with the calculator every test problem is right, including three-digit addition and three-digit × one-digit, which were never trained on, and every calculator error is fixed on the next call; RL was not run, because after SFT there is nothing left to learn from.

    Test expressions are kept out of the training problems by construction, so this is the method (write the expression, read back the result), not remembered answers. The first SFT (sft_tool) had two problems: with no tool declared, it still called a made-up tool on 96.8% of the arithmetic problems; and web bpb rose 0.014 to 0.020, past the plan's 0.01. The variant sft_tool2 adds 20% arithmetic with no tool, answered directly, and lowers the learning rate from 1e-4 to 3e-5; both problems are gone and it is still always right with the tool.

    Cost¥2.5Training curves
  3. E021GSM8K with a calculator: tool SFT and multi-turn RL

    Finding
    Question
    in E020 one SFT step got the arithmetic right and left RL nothing to learn. On grade-school word problems (GSM8K), which SFT does not saturate, how much more does multi-turn RL with a calculator bring over SFT alone?
    Finding

    RL works, at a cost: GSM8K with the calculator goes from 11.0% to 16.3% greedy and from 5.3% to 13.3% sampled, but the share with at least one right answer in 32 samples falls from 50% to 38%, and web bpb rises about 0.013.

    RL mostly makes reliable what the model could already get right now and then, and gives up part of what it got right only sometimes, as E019 found on arithmetic. Trained on English problems only, MGSM zh with the calculator also goes from 3% to 8%. Another side effect: E020's two-step word problems with the calculator fall from 100% to 79.5%; after RL the model splits even these into several calls and sets up a step wrongly.

  4. E022GSM8K RL with two guards: arithmetic mixed in, and a KL term

    Finding
    Question
    E021's RL took greedy GSM8K with the calculator from 11.0% to 16.3%, at three costs: the share of problems solved at least once in 32 samples fell from 50% to 38%, E020's two-step word problems fell from 100% to 79.5%, and web bpb rose by about 0.013. The two usual remedies are mixing other tasks into the RL problems and adding a KL to the starting point. With both, does the gain stay and do the three costs go away?
    Finding

    All four checks pass, so later RL runs use both guards by default, but the gain is smaller than E021's and the Chinese gain is gone.

    Greedy GSM8K with the calculator is 16.0%, level with E021's 16.3% and exactly on the 16.0% bar. At least one right in 32 samples: 46% (start 50%, E021 38%). E020's two-step word problems: 99.5% (E021 79.5%). Web bpb rises by only 0.001. Two costs: sampled accuracy reaches only 10.2% (E021 13.3%), and E021's gain on Chinese MGSM (3% to 8%) is gone: 1% this time, with Chinese replies again failing to stop, as at the start.

    Cost¥6.5Training curves
  5. E024GSM8K RL with the Python tool: can it teach the model to finish its programs

    Finding
    Question
    E023's Python SFT was level with the calculator (greedy 10.0% against 11.0%), but on 13% of problems the model repeated the same lines and never finished the program. RL gives an unfinished reply 0. Can RL on E023 teach those 13% and raise the score? Afterwards, how does it compare with the calculator's RL (E022, 16.0%)?
    Finding

    RL taught the model to finish its programs and raised the score, but by the bars set beforehand only one of three checks passes.

    GSM8K replies that finish went from 86.7% to 96.7% (bar 95%): passed. Greedy went from 10.0% to 14.7%, 24 against 10 problem by problem (p about 0.02), a real gain, but one problem short of the 15.0% bar: not passed. At least one right in 32 samples fell from 48% to 40% (bar 43%): not passed; two-step word problems at 98% and web bpb (+0.001) are within their bars. Level with the calculator's RL (E022, 16.0%; 17 against 21, p about 0.63). One surprise: trained on English problems only, MGSM zh went from 1% to 10%, and Chinese replies that finish from 62% to 90%.

    Cost¥7.4Training curves