Kept beam node Pruned candidate
⚠ Couldn't load the 3D engineThree.js failed to load from the CDN. Check your connection and reload.

AI Writer: Beam Search Story Generator

This simulation puts a real text-decoding algorithm on stage. Instead of hand-waving "the AI thinks of the next word," it runs an actual beam-search decoder: at every step each active beam branches into several candidate next words, every candidate is scored by a cumulative log-probability (with a repetition penalty and temperature-controlled exploration noise standing in for a trained language model's next-token distribution), and only the top-K highest-scoring paths survive into the next round while the rest are visibly pruned. Widen the beam and the writer considers more alternatives before committing; raise the diversity penalty and the surviving beams are pushed away from repeating each other's words, which is exactly the mechanism a real AI writer needs to trade off coherence against originality. Live readouts track the best beam's cumulative score and perplexity alongside a lexical-diversity "originality" score computed across every beam's final sentence.