Skip to context-window sensitivity lab

Basics · Bidirectional Context Window · 16 Left + 4 Right · WASM · quint8 · 3.55 MB · MIT

Context-Window Sensitivity Lab

Hold the same typed word constant (form, their, to, your, its) across two different surrounding sentences and inspect how paperweight/tinyfix's left-to-right (16 words) and right-to-left (4 words) GRUs flip the top-1 candidate and raw logits in real time.

1 · Minimal-Pair Bidirectional Context Probe

Context A

Context B

Initialise paperweight/tinyfix to run live bidirectional GRU probes.

Context A top-1–
Context A margin–
Context B top-1–
Context B margin–
Top-1 flipped?–
Lookahead4 words
NaN / Latency–

2 · Raw GRU Logits & Tensor Windows

Indigo bars = Context A raw GRU logits; green bars = Context B raw GRU logits for the exact same target word. Lower the right-to-left lookahead slider to 0 words to see how removing future context weakens or breaks disambiguation.

Context A candidates

Non-pad left tokens → [SLOT] → right tokens fed into wrong-word.onnx:

Context B candidates

Non-pad left tokens → [SLOT] → right tokens fed into wrong-word.onnx:

See inside the code

Show the code — worker.js: runGruBatch() (int64 left[B,16], right[B,4], candidates[B,9] ORT run)
Show the code — worker.js: checkContextSwap() (bidirectional neighbor lookup & margin scoring)