LogoAIAny
Icon for item

LLM Transparency Tool

LLM Transparency Tool (LLM-TT) is an open-source interactive toolkit from Facebook Research for analyzing the internal workings of Transformer-based language models. It lets users run inferences, explore contribution graphs tied to selected tokens, inspect representations after any block, and drill down to attention heads, FFN blocks and individual neurons to see how they promote or suppress output tokens. The project provides Docker and local installation instructions and a live demo hosted on Hugging Face.

Introduction

LLM Transparency Tool (LLM-TT)

LLM Transparency Tool is an open-source, interactive visualization and analysis toolkit developed by Facebook Research for understanding how Transformer-based language models produce outputs. It focuses on making internal model computations (attention, feed-forward activations, token representations and contribution paths) explorable and interpretable by researchers and practitioners.

主要功能
  • 运行模型推理:选择或添加 prompt、选择模型并运行推理以获得分步表示与贡献信息。
  • 贡献图 (contribution graph):选择一个目标 token,从该 token 构建贡献路径图,调整贡献阈值以过滤弱连接。
  • 表示与投影查看:查看任意层/块后的 token 表示,并将其投影到输出词表,分析哪些 token 被提升或抑制。
  • 可交互的深度探索:图中的边可点击以查看对应的注意力头信息;选择头后可查看其促进/抑制的 token;FFN 块与单独神经元也可以被选中和分析。
使用与部署

提供多种运行方式:

  • Docker 化运行(快速启动):构建镜像并在本地暴露端口运行前端/后端服务。
  • 本地安装:通过克隆仓库、创建 conda 环境并安装依赖,然后构建前端并运行 Streamlit 服务。
  • 示例命令和配置已写入 README,便于在本地或容器中复现实验流程。
支持模型与扩展性
  • 工具默认支持若干由 TransformerLens 管理的模型(README 指出如何将 TransformerLens 已支持模型加入配置)。
  • 如果使用的是 TransformerLens 支持的模型,只需在配置 JSON 中添加名称即可快速接入。
  • 对于经过微调但基于支持模型的情况,可以在配置中指定权重位置以使用该版本。
  • 若模型不被 TransformerLens 支持,需要实现工具中定义的 TransparentLlm 接口并在 Streamlit 应用中做少量改动以接入新的模型后端。
演示与引用
  • 作者在 README 中给出了 Hugging Face Spaces 的 demo 链接(例如:facebook/llm-transparency-tool-demo),便于在线体验工具功能。
  • 若在研究中使用该工具,README 提供了推荐引用:Tufanov et al. (2024) 的 ArXiv 报告《LM Transparency Tool: Interactive Tool for Analyzing Transformer Language Models》以及相关的 Ferrando & Voita (2024) 工作。
许可证与注意事项
  • 代码在仓库中以 CC BY-NC 4.0 许可证发布(见 LICENSE),这对学术研究和非商业使用友好,但商业使用可能受限或需遵守其他第三方模型的服务条款。
适用场景与局限
  • 适合模型可解释性研究、教学演示以及诊断特定 token/头/神经元对预测的影响。
  • 目前需要一定工程工作来接入不被 TransformerLens 支持的模型;对于超大模型或受限权重访问(私有/闭源权重)时,功能可能受限。
总结

LLM-TT 将可视化与可交互的分析结合起来,使研究人员能够以直观方式追踪信息流(attention 与 FFN 路径)、解析表示的逐层变化,并在 token 级别理解模型的促进/抑制行为,是一个面向 Transformer 模型可解释性与调试的强大工具。

Information

  • Websitegithub.com
  • Authorsfacebookresearch, Igor Tufanov, Karen Hambardzumyan, Javier Ferrando, Elena Voita
  • Published date2023/12/21

Categories