HomeAI & Machine LearningBERT's Blindfold: Bidirectional vs Causal Masked-Word Prediction

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

Interactive 3D self-attention engine: 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 attention edges, entropy and top-prediction readouts.

AI & Machine Learning3DAdvanced60 FPS📱 Mobile-adapted
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 — and why hiding the right-hand context can turn an easy fill-in-the-blank into a coin flip.

⚙ Under the hood

A real multi-layer self-attention engine masks one word in a sentence and predicts it, letting you toggle between BERT-style bidirectional attention and GPT-style causal (left-only) masking to see how hiding right-side context changes the guess.

nlptransformersbertself-attentionmasked-language-modelgpt

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)