Skip to content

Basics Β· text-generation Β· CPU WASM int8 Β· 368.5 MB Β· onnx-community/MNN-Pocket-0.3B-ONNX

Decoding Lab β€” determinism, repetition penalty & the ChatML wire format

Three experiments that show what a 0.3B LLM actually does per token: greedy decoding (T=0.0) is bit-for-bit repeatable while sampling (T=0.7) is not; repetition_penalty trades loops for drift; and every prompt is just ChatML text with control tokens the model learned.

1. Greedy T=0.0 vs sampled T=0.7 determinism

2. Repetition-penalty ablation (greedy, same prompt)

Greedy story continuation (120 new tokens) at penalties 1.00 / 1.15 / 1.35 β€” the penalty scales down logits of already-generated tokens. Distinct-n rises as loops vanish; too high a penalty starts dodging words it needs.

Repetition-penalty ablation metrics per run
penalty distinct-1 distinct-2 repeated 3-grams max run tok/s output
Run the ablation to fill this table.

3. ChatML & <think> formatting inspector


            

Real token ids appear after Tokenize.

The model initialises above (auto when cached).

Show the code

mnn-core.mjs parseThinkBlocks(): split a completion into <think> trace + answer
mnn-core.mjs repetitionStats(): distinct-1/2, repeated trigram ratio, max run