Agent skill · AI & Agents

logit-lens

Decode intermediate layer predictions using the Logit Lens technique. Use when analyzing what a model predicts at each layer, understanding information flow, or visualizing layer-wise processing.

majiayu000github.com/majiayu000GitHub ↗
claude-codeMIT
Install
npx skills add majiayu000/claude-skill-registry --skill logit-lens --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 5 KB
Bundled scripts: none
Path: skills/ai-ml/logit-lens/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Logit Lens Logit Lens decodes intermediate layer activations into vocabulary predictions, revealing what the model "thinks" at each processing step rather than just the final output. ## Concept Transformer language models build predictions incrementally across layers. By applying the final layer norm and unembedding head to intermediate hidden states, we can see evolving predictions. ## Basic Implementation ```python from nnsight import LanguageModel import torch model = LanguageModel("openai-community/gpt2", device_map="auto", dispatch=True) prompt = "The Eiffel Tower is in the city of" layers = model.transformer.h probs_layers = [] with model.trace(prompt): for layer_idx, layer in enumerate(layers): # Get layer output, apply final layer norm, then lm_head hidden = layer.output[0] normed = model.transformer.ln_f(hidden) logits = model.lm_head(normed) # Convert to probabilities probs = torch.nn.functional.softmax(logits, dim=-1).save() probs_layers.append(probs) ``` ## Extract Top Predictions ```python # Stack all layer probabilities all_probs = torch.stack([p.value for p in probs_layers]) # [n_layers, batch, seq, vocab] # Get top prediction at each layer for final token final_to

What's inside
Steps it walks through
  1. Concept
  2. Basic Implementation
  3. Extract Top Predictions
  4. Full Sequence Visualization
  5. Efficient Batched Version
  6. Remote Execution for Large Models
  7. Interpretation Tips
  8. Visualization with Plotly
  9. Use Cases
Ships with 1 file
  • metadata.json
More from claude-skill-registry
All skills →
About this skill
What does the logit-lens skill do?

Decode intermediate layer predictions using the Logit Lens technique. Use when analyzing what a model predicts at each layer, understanding information flow, or visualizing layer-wise processing.

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill logit-lens --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going