TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Fully client-side GPT2 prediction visualizer

153 pointsby thesephistover 1 year ago
Hi HN! I&#x27;ve found this visualization tool immensely helpful over the years for getting an intuition for how an LLM &quot;sees&quot; some piece of text, and with a bit of elbow grease decided to move all compute to client side so I could make it publicly available.<p>I&#x27;ve found it particularly useful for<p>- Understanding exactly how repetition and patterns affect a small LM&#x27;s ability to predict correctly<p>- Understanding different tokenization patterns and how it affects model output<p>- Getting a general sense of how &quot;hard&quot; different prediction tasks are for GPT-style models<p>Known problems (that I probably won&#x27;t fix, since this was a kind of one-off project)<p>- Doesn&#x27;t work well with Unicode grapheme clusters that are multiple GPT-2 tokens (e.g. emoji, smart quotes)<p>- Support for other models (maybe later?)

7 comments

simonwover 1 year ago
There&#x27;s a video of a previous version of this tool here which I found really helped me understand what it was demonstrating: <a href="https:&#x2F;&#x2F;twitter.com&#x2F;thesephist&#x2F;status&#x2F;1617747154231259137" rel="nofollow noreferrer">https:&#x2F;&#x2F;twitter.com&#x2F;thesephist&#x2F;status&#x2F;1617747154231259137</a><p>It&#x27;s really neat to see how this sentence:<p>&gt; The first time I write this sentence, the model is quite confused about what token is about to come next, especially if I throw in weird words like pumpkin, clown, tweets, alpha, teddy bear.<p>Shows that the words pumpkin, clown etc are considered really unlikely. But when the sentence is repeated a moment later, all of the words become extremely predictable to the model.<p>Also worth noting: this demo runs entirely in the browser! It loads a 120MB ONNX version of GPT-2 using Transformers.js.
didgeoridooover 1 year ago
Really interesting! I wonder how well this syncs up with human intuition and general “information density”. If it’s a close match, maybe you could use this as a tool to help with skimming documents — the red (“hard to predict”) areas might be a good hint to slow down and read more carefully, while the green (“easy to predict”) areas might mean you could skim without losing too much unpredictable information.
评论 #37402997 未加载
评论 #37401390 未加载
thomasfromcdnjsover 1 year ago
This is beautiful. Needs to be a standard tool for all models.<p>Great work!
netipulkover 1 year ago
The highlights being very similar in red and green is a complete nightmare for me because I have deuteranopia. You should probably fix that.
skybrianover 1 year ago
I’m sure it’s neat but it shouldn’t start running on load, because some people are browsing on mobile.
Scene_Cast2over 1 year ago
Any chance of Llama2 support?
评论 #37401398 未加载
atgctgover 1 year ago
It would be interesting to have attention visualized as well, similar to how it&#x27;s done in BertViz:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;jessevig&#x2F;bertviz">https:&#x2F;&#x2F;github.com&#x2F;jessevig&#x2F;bertviz</a>
评论 #37403694 未加载
评论 #37403029 未加载
评论 #37401921 未加载