AI Skills AI技能 4h ago Updated 2h ago 更新于 2小时前 51

The Complete Guide to Reading a Model's Hidden Layers with Anthropic's Jacobian Lens Anthropic Jacobian Lens 完全指南:解读模型隐藏层

Anthropic introduced the Jacobian Lens (J-lens), a new interpretability tool that corrects the basis mismatch problem inherent in the older logit lens technique for reading hidden layer representations in language models The J-lens fits a learned projection matrix J_l ≈ E[∂h_L/∂h_l] for each layer, approximating what the remaining network does to a given activation before unembedding, enabling legible reading of intermediate representations Causal evidence was demonstrated through a blackmail sc Anthropic于2026年7月发表研究,提出Jacobian Lens(雅可比透镜)技术,用于解读语言模型隐藏层的内部表示,解决传统logit lens在早期层失效的问题 研究发现隐藏层存在"全局工作空间"(J-space),模型在输出前已内部处理概念,因果干预实验证实该空间对决策具有实际影响 Jacobian Lens通过学习修正矩阵J_l ≈ E[∂h_L/∂h_l]来补偿基不匹配,相比logit lens能更早、更准确地解码中间层表示 文章提供完整可复现代码,可在免费Colab T4上运行,使用Qwen3.5-4B模型演示两种方法的对比效果

72
Hot 热度
78
Quality 质量
70
Impact 影响力

Analysis 深度分析

TL;DR

  • Anthropic introduced the Jacobian Lens (J-lens), a new interpretability tool that corrects the basis mismatch problem inherent in the older logit lens technique for reading hidden layer representations in language models
  • The J-lens fits a learned projection matrix J_l ≈ E[∂h_L/∂h_l] for each layer, approximating what the remaining network does to a given activation before unembedding, enabling legible reading of intermediate representations
  • Causal evidence was demonstrated through a blackmail scenario where suppressing J-space (the global workspace) changed model behavior, proving hidden representations are not merely correlational but causally influential
  • In practical evaluation on Qwen3.5-4B, the Jacobian lens recovered the correct answer "Paris" at layer 26 while the logit lens produced zero meaningful outputs across all 29 tested layers
  • The companion library jlens is available on GitHub and supports fitting custom lenses, applying them to prompts, and interactive visualization through a slice-stack viewer

Why It Matters

This represents a genuinely new class of interpretability results with causal evidence, moving mechanistic interpretability beyond correlation-based analysis into territory where hidden representations can be directly read and manipulated. For AI practitioners and researchers, it provides a practical, runnable tool (on free Colab T4 hardware) to probe model internals, which is critical for building trust, safety, and alignment in increasingly capable language models.

Technical Details

  • Logit Lens Limitation: The logit lens applies the unembedding matrix W_U directly to hidden states h_l, assuming downstream layers don't significantly transform representations. This fails in early layers (e.g., layer 5 of a 30-layer model) because the activation hasn't been rotated into the vocabulary basis, producing garbled output like punctuation or unrelated characters.
  • Jacobian Lens Formula: J_l ≈ E[∂h_L/∂h_l], a d×d projection matrix fit by averaging real gradients across many prompts. The decoded probability becomes P_jacobian = softmax(W_U · LayerNorm(J_l · h_l)), where J_l transports the hidden state through an approximation of what the remaining layers would do.
  • J-space as Global Workspace: A small, low-dimensional slice of hidden layers behaves like a global workspace where concepts the model is "leaning toward" surface before commitment. In the blackmail test, words like "blackmail" and "fake" appeared in hidden space before the model wrote its response, and suppressing this space causally changed behavior.
  • Implementation: The jlens library (from GitHub, not PyPI) wraps Hugging Face models, supports pre-fitted lenses hosted on Hugging Face Hub, and requires matching the lens to the exact model architecture. A single NVIDIA T4 with 16GB VRAM is sufficient for probing models like Qwen3.5-4B (~8GB in bf16).
  • Evaluation Method: Token rank trajectories across layers on a log scale reveal when target tokens (e.g., "Paris") emerge in confidence. The Jacobian lens showed the correct answer at layers 26 and 30, while the logit lens never recovered it across all tested layers.

Industry Insight

  • The causal manipulation results (suppressing J-space changing model behavior) establish a new experimental paradigm for interpretability research, enabling not just observation but intervention in model reasoning—this could accelerate safety auditing and red-teaming workflows.
  • The practical accessibility of jlens on free Colab T4 hardware democratizes mechanistic interpretability research, allowing smaller teams and individual researchers to probe model internals without expensive compute, potentially accelerating the pace of interpretability breakthroughs across the industry.
  • The basis mismatch problem was a known bottleneck in the field; solving it with a gradient-based correction that generalizes across prompts suggests this approach could become a standard tool in the interpretability practitioner's toolkit, much like attention visualization became routine.

TL;DR

  • Anthropic于2026年7月发表研究,提出Jacobian Lens(雅可比透镜)技术,用于解读语言模型隐藏层的内部表示,解决传统logit lens在早期层失效的问题
  • 研究发现隐藏层存在"全局工作空间"(J-space),模型在输出前已内部处理概念,因果干预实验证实该空间对决策具有实际影响
  • Jacobian Lens通过学习修正矩阵J_l ≈ E[∂h_L/∂h_l]来补偿基不匹配,相比logit lens能更早、更准确地解码中间层表示
  • 文章提供完整可复现代码,可在免费Colab T4上运行,使用Qwen3.5-4B模型演示两种方法的对比效果

为什么值得看

本文首次展示了通过因果干预验证模型隐藏层"全局工作空间"的实验证据,为 mechanistic interpretability 领域提供了新的研究范式。Jacobian Lens作为可复现的工具,降低了可解释性研究的门槛,使从业者能在消费级GPU上探索模型内部机制。

技术解析

  • Logit Lens的局限性:直接将隐藏状态通过输出矩阵解码,假设下游层不改变表示,但在30层模型中早期层(如第5层)距离输出空间过远,导致解码结果混乱(乱码、标点、无关字符)
  • Jacobian Lens核心公式:P_jacobian = softmax(W_U · LayerNorm(J_l · h_l)),其中J_l是d×d的修正矩阵,通过平均多个prompt的梯度拟合:J_l ≈ E[∂h_L/∂h_l]
  • 实验验证:在Qwen3.5-4B上测试"埃菲尔铁塔所在国家的首都是",Logit Lens在所有29层均未解码出正确答案,而Jacobian Lens在第26层和第30层成功输出"Paris"
  • 工具实现:jlens库提供拟合、应用、可视化功能,支持交互式slice-stack viewer,预训练透镜托管在HuggingFace Hub,但需与模型严格匹配

行业启示

  • 可解释性研究进入因果验证阶段:从相关性分析转向因果干预,证明隐藏空间对模型行为具有实际影响,为AI安全研究提供更可靠的工具
  • 降低可解释性研究门槛:免费Colab环境+开源代码使中小团队也能参与 mechanistic interpretability 研究,可能加速该领域的开源生态发展
  • 模型内部表示的可读性仍有限:Jacobian Lens仅在少数层成功解码,大部分层仍为噪声,说明当前技术尚无法全面"阅读"模型思维,需持续改进

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

Research 科学研究 LLM 大模型 Claude Claude Alignment 对齐 Evaluation 评测