Home▸AI & Machine Learning▸BERT's Blindfold 2D: Bidirectional vs Causal Masked-Word Prediction

BERT's Blindfold 2D: Bidirectional vs Causal Masked-Word Prediction

Interactive 2D self-attention diagram: mask a word in a sentence and watch a stacked encoder guess it from bidirectional context (BERT-style) or from left-only causal context (GPT-style), with live pannable/zoomable attention arcs, entropy and top-prediction readouts.

AI & Machine Learning2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-ds-topic-85 ↗ Open standalone

This simulator runs a small, real multi-layer self-attention engine over a sentence with one word hidden behind a [MASK] token, then asks it to guess the missing word — exactly the masked-language-model objective BERT is pretrained on. A toggle swaps the encoder between full bidirectional attention (every token can see every other token, left and right) and a causal mask that blocks the mask position from seeing anything to its right, the same constraint that forces GPT-style decoders to generate strictly left-to-right. Stacked attention layers, softmax temperature and live entropy/coverage readouts show, token by token, exactly which words the model is allowed to lean on before it commits to a guess — plotted here as a flat, pannable and zoomable 2D diagram of tokens and attention arcs — and why hiding the right-hand context can turn an easy fill-in-the-blank into a coin flip.

⚙ Under the hood

A 2D pannable/zoomable diagram of the same multi-layer self-attention engine as the 3D version: mask a word in a sentence and watch stacked attention layers guess it from full bidirectional context (BERT-style) or from left-only causal context (GPT-style), with live attention arcs, entropy and top-prediction readouts.

nlptransformerself-attentionbertgptmasked-language-modelmachine learning

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)