use case · basics · greedy vs top-k/top-p sampling & few-shot priming ablation · q8 WASM · 366.64 MB

Inside SmolLM2-360M Base: Sampling & Few-Shot Priming

Compare deterministic Greedy decoding against Focused (T=0.4, top_k=40) and Creative (T=1.0, top_k=60) sampling on the same base prefix, then ablate raw zero-shot chat instructions against few-shot exemplar prefixes to see how format delimiters reshape the 49,152-vocab distribution.

1 · SmolLM2-360M worker (366.64 MB q8 WASM · Apache-2.0)

2 · Greedy vs Top-K / Top-P Sampling Ablation

Curated base prefixes (Astrophysics Prose, JS Helper, Narrative Opening)

Prepare SmolLM2-360M above to compare greedy vs stochastic top-k/top-p sampling live.

Prompt BPE tokens—
Next-tok Entropy—
Focused vs Greedy—
Creative vs Greedy—
NaN count—

Greedy (do_sample=false)

—
Waiting for comparison…

Focused (T=0.4 · K=40)

—
Waiting for comparison…

Creative (T=1.0 · K=60)

—
Waiting for comparison…

3 · Zero-Shot Chat Instruction vs Few-Shot Exemplar Prefix Ablation

Without instruction tuning, bare requests invite document drift. Compare Arm A (bare instruction) against Arm B (delimited few-shot exemplars) and inspect how the first predicted token probability shifts.

Select a priming pair above to compare bare zero-shot prompting vs few-shot delimiters.
—
Waiting for ablation…
—
Waiting for ablation…

Ready to ablate zero-shot vs few-shot priming once the model loads.

Arm A Entropy · PPL—
Arm B Entropy · PPL—
Entropy Reduction—
Top-1 Token Shift—
NaN count—

4 · Inspect Sampling & Priming Ablation Worker Code

Show the code — Off-main-thread Greedy vs Focused vs Creative sampling comparison
Show the code — Paired Zero-Shot vs Few-Shot priming + next-token probability shift