Show HN: LLM Attention Visualization
A developer released a browser-based tool that visualizes which past tokens influence each LLM output token using aggregated, value-weighted attention scores.
A Show HN project presents a React application built on Transformers.js that renders per-token attention influence by aggregating attention weights scaled by value-vector magnitudes across all attention heads and layers. To expose internal tensors, the author instrumented the ONNX computation graph, hosted a modified model on Hugging Face, and pre-generated prompts to avoid long model downloads in the browser. Demos with a 600-million-parameter model show how verbatim copying draws heavily on source tokens and how single outputs blend information from multiple phrases.
- Attention weights scaled by value magnitude, aggregated across heads and layers
- Instrumented ONNX model hosted on Hugging Face exposes internal generation values
- Pre-generated prompts sidestep hundreds-of-megabytes model downloads in the browser
- Products
- Transformers.js
- Organizations
- Hugging Face
From the original article
3 min read at ishamf.devOne interesting thing about transformer-based large language models are that, during the generation phase, it is able to draw information from any of its previous tokens. But it needs to be selective; if every token affects the generation equally, it won't be very effective. This process needs a mechanism to decide how much a token affects the next token.
By ifz · ishamf.dev
A short excerpt; the article and its images belong to the publisher. Summary, key facts and assessment above are AI-written from the article and can be wrong.