[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-jalammar--ecco":3,"tool-jalammar--ecco":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",160015,2,"2026-04-18T11:30:52",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",109154,"2026-04-18T11:18:24",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[52,13,15,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":77,"owner_email":77,"owner_twitter":78,"owner_website":79,"owner_url":80,"languages":81,"stars":98,"forks":99,"last_commit_at":100,"license":101,"difficulty_score":102,"env_os":103,"env_gpu":103,"env_ram":103,"env_deps":104,"category_tags":112,"github_topics":113,"view_count":32,"oss_zip_url":77,"oss_zip_packed_at":77,"status":17,"created_at":119,"updated_at":120,"faqs":121,"releases":152},9088,"jalammar\u002Fecco","ecco","Explain, analyze, and visualize NLP language models. Ecco creates interactive visualizations directly in Jupyter notebooks explaining the behavior of Transformer-based language models (like GPT2, BERT, RoBERTA, T5, and T0).","Ecco 是一款专为自然语言处理（NLP）领域设计的 Python 开源库，旨在帮助用户在 Jupyter Notebook 环境中直观地解释、分析和可视化基于 Transformer 架构的语言模型（如 GPT-2、BERT、RoBERTa 等）。它主要解决了大模型“黑盒”难题，让开发者无需重新训练或微调模型，即可深入理解预训练模型的内部运作机制与决策逻辑。\n\n这款工具特别适合 AI 研究人员、数据科学家以及希望深入探究模型原理的开发者使用。通过交互式图表，Ecco 能清晰展示文本在模型各层中的处理演变过程、候选输出词的概率分布，甚至具体到神经元的激活模式。其技术亮点在于集成了多种先进的特征归因算法（如 IntegratedGradients、DeepLift 等），并支持利用非负矩阵分解（NMF）和中心核对齐分析（CKA）等技术来识别和对比神经元激活特征。此外，Ecco 还兼容用户本地的 Hugging Face 模型，提供了灵活的探索接口。作为当前处于 Alpha 阶段的研究项目，Ecco 为洞察复杂语言模型的行为提供了强大而友好的可视化手段。","\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_17e2b95985a4.png\" width=\"400\" style=\"background-color: white\" \u002F>\n\n\u003Cbr \u002F>\n\u003Cbr \u002F>\n\n\u003C!--- BADGES: START --->\n[![GitHub - License](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fjalammar\u002Fecco?logo=github&style=flat&color=green)][#github-license]\n[![PyPI - Latest Package Version](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fecco?logo=pypi&style=flat&color=orange)][#pypi-package]\n[![PyPI - Supported Python Versions](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Fecco?logo=pypi&style=flat&color=blue)][#pypi-package]\n[![Conda - Platform](https:\u002F\u002Fimg.shields.io\u002Fconda\u002Fpn\u002Fconda-forge\u002Fecco?logo=anaconda&style=flat)][#conda-forge-package]\n[![Conda (channel only)](https:\u002F\u002Fimg.shields.io\u002Fconda\u002Fvn\u002Fconda-forge\u002Fecco?logo=anaconda&style=flat&color=orange)][#conda-forge-package]\n[![Docs - GitHub.io](https:\u002F\u002Fimg.shields.io\u002Fstatic\u002Fv1?logo=readthedocs&style=flat&color=pink&label=docs&message=ecco)][#docs-package]\n\n\n[#github-license]: https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002FLICENSE\n[#pypi-package]: https:\u002F\u002Fpypi.org\u002Fproject\u002Fecco\u002F\n[#conda-forge-package]: https:\u002F\u002Fanaconda.org\u002Fconda-forge\u002Fecco\n[#docs-package]: https:\u002F\u002Fecco.readthedocs.io\u002F\n\u003C!--- BADGES: END --->\n\n\nEcco is a python library for exploring and explaining Natural Language Processing models using interactive visualizations. \n\n\nEcco provides multiple interfaces to aid the explanation and intuition of [Transformer](https\u002F\u002Fjalammar.github.io\u002Fillustrated-transformer\u002F)-based language models. Read: [Interfaces for Explaining Transformer Language Models](https:\u002F\u002Fjalammar.github.io\u002Fexplaining-transformers\u002F).\n\nEcco runs inside Jupyter notebooks. It is built on top of [pytorch](https:\u002F\u002Fpytorch.org\u002F) and [transformers](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers).\n\n\nEcco is not concerned with training or fine-tuning models. Only exploring and understanding existing pre-trained models. The library is currently an alpha release of a research project. You're welcome to contribute to make it better!\n\n\nDocumentation: [ecco.readthedocs.io](https:\u002F\u002Fecco.readthedocs.io\u002F)\n\n## Features\n- Support for a wide variety of language models (GPT2, BERT, RoBERTA, T5, T0, and others) [[notebook & instructions for adding more models](https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FIdentifying%20model%20configuration.ipynb)].\n- Ability to add your own **local models** (if they're based on Hugging Face pytorch models).\n- **Feature attribution** ([IntegratedGradients](https:\u002F\u002Farxiv.org\u002Fabs\u002F1703.01365), [Saliency](https:\u002F\u002Farxiv.org\u002Fabs\u002F1312.6034), [InputXGradient](https:\u002F\u002Farxiv.org\u002Fabs\u002F1412.6815), [DeepLift](https:\u002F\u002Farxiv.org\u002Fabs\u002F1704.02685), [DeepLiftShap](https:\u002F\u002Fproceedings.neurips.cc\u002Fpaper\u002F2017\u002Fhash\u002F8a20a8621978632d76c43dfd28b67767-Abstract.html), [GuidedBackprop](https:\u002F\u002Farxiv.org\u002Fabs\u002F1412.6806), [GuidedGradCam](https:\u002F\u002Farxiv.org\u002Fabs\u002F1610.02391), [Deconvolution](https:\u002F\u002Farxiv.org\u002Fabs\u002F1311.2901), and [LRP](https:\u002F\u002Fjournals.plos.org\u002Fplosone\u002Farticle?id=10.1371\u002Fjournal.pone.0130140) via [Captum](https:\u002F\u002Fcaptum.ai\u002F))\n- **Capture neuron activations** in the FFNN layer in the Transformer block\n- Identify and **visualize neuron activation patterns**  (via Non-negative Matrix Factorization)\n- Examine neuron activations via comparisons of activations spaces using [SVCCA](https:\u002F\u002Farxiv.org\u002Fabs\u002F1706.05806), [PWCCA](https:\u002F\u002Farxiv.org\u002Fabs\u002F1806.05759), and [CKA](https:\u002F\u002Farxiv.org\u002Fabs\u002F1905.00414) (See [this video on inspecting neural networks with CCA](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=u7Dvb_a1D-0))\n- Visualizations for:\n    - Evolution of processing a token through the layers of the model ([Logit lens](https:\u002F\u002Fwww.lesswrong.com\u002Fposts\u002FAcKRB8wDpdaN6v6ru\u002Finterpreting-gpt-the-logit-lens))\n    - Candidate output tokens and their probabilities (at each layer in the model)\n\n## Installation\n\nYou can install `ecco` either with `pip` or with `conda`.\n\n**with pip**\n\n```sh\npip install ecco\n```\n\n**with conda**\n\n```sh\nconda install -c conda-forge ecco\n```\n\n## Examples:\nYou can run all these examples from this [[notebook](https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002Freadme.md%20examples.ipynb)] | [[colab](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002Freadme.md%20examples.ipynb)].\n### What is the sentiment of this film review?\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_1c5fa45b0ac8.png\" width=\"500px\" \u002F>\n\nUse a large language model (T5 in this case) to detect text sentiment. In addition to the sentiment, see the tokens the model broke the text into (which can help debug some edge cases).\n\n### Which words in this review lead the model to classify its sentiment as \"negative\"?\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_dc5b36d4c9b0.png\" width=\"500px\" \u002F>\n\nFeature attribution using Integrated Gradients helps you explore model decisions. In this case, switching \"weakness\" to \"inclination\" allows the model to correctly switch the prediction to *positive*.\n\n### Explore the world knowledge of GPT models by posing fill-in-the blank questions.\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_b23bc129034f.png\" width=\"500px\" alt=\"Asking GPT2 where heathrow airport is\" \u002F>\n\nDoes GPT2 know where Heathrow Airport is? Yes. It does.\n\n### What other cities\u002Fwords did the model consider in addition to London?\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_0d93b8406fd6.png\" width=\"500px\" alt=\"The model also considered Birmingham and Manchester\"\u002F>\n\nVisualize the candidate output tokens and their probability scores.\n\n### Which input words lead it to think of London?\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_34953e6684d6.png\" width=\"400px\" alt=\"Asking GPT2 where heathrow airport is\"\u002F>\n\n### At which layers did the model gather confidence that London is the right answer?\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_be6aab1b8b48.png\" width=\"200px\" alt=\"The order of the token in each layer, layer 11 makes it number 1\"\u002F>\n\nThe model chose London by making the highest probability token (ranking it #1) after the last layer in the model. How much did each layer contribute to increasing the ranking of *London*? This is a [logit lens](https:\u002F\u002Fwww.lesswrong.com\u002Fposts\u002FAcKRB8wDpdaN6v6ru\u002Finterpreting-gpt-the-logit-lens) visualizations that helps explore the activity of different model layers.\n\n### What are the patterns in BERT neuron activation when it processes a piece of text? \n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_6c0bb8705563.png\" width=\"500px\" alt=\"Colored line graphs on the left, a piece of text on the right. The line graphs indicate the activation of BERT neuron groups in response to the text\"\u002F>\n\nA group of neurons in BERT tend to fire in response to commas and other punctuation. Other groups of neurons tend to fire in response to pronouns. Use this visualization to factorize neuron activity in individual FFNN layers or in the entire model.\n\n\nRead the paper: \n>[Ecco: An Open Source Library for the Explainability of Transformer Language Models](https:\u002F\u002Faclanthology.org\u002F2021.acl-demo.30\u002F)\n> Association for Computational Linguistics (ACL) System Demonstrations, 2021\n\n\n## Tutorials\n- Video: [Take A Look Inside Language Models With Ecco](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=rHrItfNeuh0). \\[\u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FLanguage_Models_and_Ecco_PyData_Khobar.ipynb\">Colab Notebook\u003C\u002Fa>]\n\n\n## How-to Guides\n- [Interfaces for Explaining Transformer Language Models](https:\u002F\u002Fjalammar.github.io\u002Fexplaining-transformers\u002F)\n- [Finding the Words to Say: Hidden State Visualizations for Language Models](https:\u002F\u002Fjalammar.github.io\u002Fhidden-states\u002F)\n\n\n## API Reference\nThe [API reference](https:\u002F\u002Fecco.readthedocs.io\u002Fen\u002Fmain\u002Fapi\u002Fecco\u002F) and the [architecture](https:\u002F\u002Fecco.readthedocs.io\u002Fen\u002Fmain\u002Farchitecture\u002F) page explain Ecco's components and how they work together.\n\n## Gallery & Examples\n\n\u003Cdiv class=\"container gallery\" markdown=\"1\">\n\n\u003Cp>\u003Cstrong>Predicted Tokens:\u003C\u002Fstrong> View the model's prediction for the next token (with probability scores). See how the predictions evolved through the model's layers. [\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Output_Token_Scores.ipynb\">Notebook\u003C\u002Fa>] [\u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Output_Token_Scores.ipynb\">Colab\u003C\u002Fa>]\u003C\u002Fp>\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_90a76f6b48dd.png\" width=\"400\" \u002F>\n\u003Chr \u002F>\n\u003Cp>\u003Cstrong>Rankings across layers:\u003C\u002Fstrong> After the model picks an output token, Look back at how each layer ranked that token.  [\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Evolution_of_Selected_Token.ipynb\">Notebook\u003C\u002Fa>] [\u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Evolution_of_Selected_Token.ipynb\">Colab\u003C\u002Fa>]\u003C\u002Fp>\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_205163a81ee5.png\" width=\"400\"\u002F>\n\u003Chr \u002F>\n\u003Cp>\u003Cstrong>Layer Predictions:\u003C\u002Fstrong>Compare the rankings of multiple tokens as candidates for a certain position in the sequence.  [\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Comparing_Token_Rankings.ipynb\">Notebook\u003C\u002Fa>] [\u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Comparing_Token_Rankings.ipynb\">Colab\u003C\u002Fa>]\u003C\u002Fp>\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_9d8cb516749f.png\" width=\"400\" \u002F>\n\u003Chr \u002F>\n\u003Cp>\u003Cstrong>Primary Attributions:\u003C\u002Fstrong> How much did each input token contribute to producing the output token?   [\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Primary_Attributions.ipynb\">Notebook\u003C\u002Fa>] [\u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Primary_Attributions.ipynb\">Colab\u003C\u002Fa>]\n\u003C\u002Fp>\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_a6eba91a0d9b.png\" width=\"400\"\u002F>\n\n\u003Chr \u002F>\n\u003Cp>\u003Cstrong>Detailed Primary Attributions:\u003C\u002Fstrong> See more precise input attributions values using the detailed view. [\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Primary_Attributions.ipynb\">Notebook\u003C\u002Fa>] [\u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Primary_Attributions.ipynb\">Colab\u003C\u002Fa>]\n\u003C\u002Fp>\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_4c6d86142be8.png\" width=\"400\"\u002F>\n\n\u003Chr \u002F>\n\u003Cp>\u003Cstrong>Neuron Activation Analysis:\u003C\u002Fstrong> Examine underlying patterns in neuron activations using non-negative matrix factorization. [\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Neuron_Factors.ipynb\">Notebook\u003C\u002Fa>] [\u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Neuron_Factors.ipynb\">Colab\u003C\u002Fa>]\u003C\u002Fp>\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_a93c3f815852.png\" width=\"400\"\u002F>\n\n\u003C\u002Fdiv>\n\n## Getting Help\nHaving trouble?\n\n- The [Discussion](https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fdiscussions) board might have some relevant information. If not, you can post your questions there.\n- Report bugs at Ecco's [issue tracker](https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fissues)\n\n\n\nBibtex for citations:\n```bibtex\n@inproceedings{alammar-2021-ecco,\n    title = \"Ecco: An Open Source Library for the Explainability of Transformer Language Models\",\n    author = \"Alammar, J\",\n    booktitle = \"Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing: System Demonstrations\",\n    year = \"2021\",\n    publisher = \"Association for Computational Linguistics\",\n}\n```\n","\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_17e2b95985a4.png\" width=\"400\" style=\"background-color: white\" \u002F>\n\n\u003Cbr \u002F>\n\u003Cbr \u002F>\n\n\u003C!--- BADGES: START --->\n[![GitHub - License](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fjalammar\u002Fecco?logo=github&style=flat&color=green)][#github-license]\n[![PyPI - Latest Package Version](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fecco?logo=pypi&style=flat&color=orange)][#pypi-package]\n[![PyPI - Supported Python Versions](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Fecco?logo=pypi&style=flat&color=blue)][#pypi-package]\n[![Conda - Platform](https:\u002F\u002Fimg.shields.io\u002Fconda\u002Fpn\u002Fconda-forge\u002Fecco?logo=anaconda&style=flat)][#conda-forge-package]\n[![Conda (channel only)](https:\u002F\u002Fimg.shields.io\u002Fconda\u002Fvn\u002Fconda-forge\u002Fecco?logo=anaconda&style=flat&color=orange)][#conda-forge-package]\n[![Docs - GitHub.io](https:\u002F\u002Fimg.shields.io\u002Fstatic\u002Fv1?logo=readthedocs&style=flat&color=pink&label=docs&message=ecco)][#docs-package]\n\n\n[#github-license]: https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002FLICENSE\n[#pypi-package]: https:\u002F\u002Fpypi.org\u002Fproject\u002Fecco\u002F\n[#conda-forge-package]: https:\u002F\u002Fanaconda.org\u002Fconda-forge\u002Fecco\n[#docs-package]: https:\u002F\u002Fecco.readthedocs.io\u002F\n\u003C!--- BADGES: END --->\n\n\nEcco 是一个用于探索和解释自然语言处理模型的 Python 库，通过交互式可视化来实现。\n\nEcco 提供了多种界面，帮助解释和理解基于 [Transformer](https\u002F\u002Fjalammar.github.io\u002Fillustrated-transformer\u002F) 的语言模型。更多信息请参阅：[解释 Transformer 语言模型的界面](https:\u002F\u002Fjalammar.github.io\u002Fexplaining-transformers\u002F)。\n\nEcco 运行在 Jupyter 笔记本中，构建于 [PyTorch](https:\u002F\u002Fpytorch.org\u002F) 和 [Transformers](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers) 之上。\n\nEcco 并不涉及模型的训练或微调，而是专注于探索和理解现有的预训练模型。目前，该库仍处于研究项目的 Alpha 版本阶段。欢迎各位贡献代码，共同完善它！\n\n文档：[ecco.readthedocs.io](https:\u002F\u002Fecco.readthedocs.io\u002F)\n\n## 功能特性\n- 支持多种语言模型（GPT2、BERT、RoBERTA、T5、T0 等）[[笔记本及添加更多模型的说明](https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FIdentifying%20model%20configuration.ipynb)]。\n- 可以加载您自己的 **本地模型**（前提是这些模型基于 Hugging Face 的 PyTorch 模型）。\n- **特征归因**功能（包括 [IntegratedGradients](https:\u002F\u002Farxiv.org\u002Fabs\u002F1703.01365)、[Saliency](https:\u002F\u002Farxiv.org\u002Fabs\u002F1312.6034)、[InputXGradient](https:\u002F\u002Farxiv.org\u002Fabs\u002F1412.6815)、[DeepLift](https:\u002F\u002Farxiv.org\u002Fabs\u002F1704.02685)、[DeepLiftShap](https:\u002F\u002Fproceedings.neurips.cc\u002Fpaper\u002F2017\u002Fhash\u002F8a20a8621978632d76c43dfd28b67767-Abstract.html)、[GuidedBackprop](https:\u002F\u002Farxiv.org\u002Fabs\u002F1412.6806)、[GuidedGradCam](https:\u002F\u002Farxiv.org\u002Fabs\u002F1610.02391)、[Deconvolution](https:\u002F\u002Farxiv.org\u002Fabs\u002F1311.2901) 以及通过 [Captum](https:\u002F\u002Fcaptum.ai\u002F) 实现的 [LRP](https:\u002F\u002Fjournals.plos.org\u002Fplosone\u002Farticle?id=10.1371\u002Fjournal.pone.0130140) 等方法）。\n- 在 Transformer 块中的 FFNN 层中 **捕获神经元激活**。\n- 识别并 **可视化神经元激活模式**（通过非负矩阵分解）。\n- 使用 [SVCCA](https:\u002F\u002Farxiv.org\u002Fabs\u002F1706.05806)、[PWCCA](https:\u002F\u002Farxiv.org\u002Fabs\u002F1806.05759) 和 [CKA](https:\u002F\u002Farxiv.org\u002Fabs\u002F1905.00414) 比较激活空间，从而分析神经元激活情况（请观看 [使用 CCA 检查神经网络的视频](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=u7Dvb_a1D-0)）。\n- 提供以下可视化：\n    - 模型各层对单个 token 处理过程的演变（[Logit lens](https:\u002F\u002Fwww.lesswrong.com\u002Fposts\u002FAcKRB8wDpdaN6v6ru\u002Finterpreting-gpt-the-logit-lens)）。\n    - 每一层候选输出 token 及其概率分布。\n\n## 安装\n\n您可以使用 `pip` 或 `conda` 来安装 `ecco`。\n\n**使用 pip**\n\n```sh\npip install ecco\n```\n\n**使用 conda**\n\n```sh\nconda install -c conda-forge ecco\n```\n\n## 示例：\n所有示例均可在此处运行 [[笔记本](https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002Freadme.md%20examples.ipynb)] | [[Colab](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002Freadme.md%20examples.ipynb)]。\n### 这篇影评的情感倾向是什么？\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_1c5fa45b0ac8.png\" width=\"500px\" \u002F>\n\n使用大型语言模型（此处为 T5）检测文本情感。除了情感分类外，还可以查看模型将文本拆分后的 token，这有助于调试一些边缘情况。\n\n### 这篇评论中哪些词促使模型将其情感判定为“负面”？\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_dc5b36d4c9b0.png\" width=\"500px\" \u002F>\n\n利用 Integrated Gradients 进行特征归因，可以帮助您深入理解模型的决策过程。例如，在这个例子中，将“weakness”替换为“inclination”，模型便能正确地将预测结果改为 *正面*。\n\n### 通过填空题探索 GPT 模型的世界知识。\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_b23bc129034f.png\" width=\"500px\" alt=\"询问 GPT2 希思罗机场在哪里\" \u002F>\n\nGPT2 知道希思罗机场在哪里吗？是的，它知道。\n\n### 除了伦敦之外，模型还考虑了哪些城市或其他词语？\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_0d93b8406fd6.png\" width=\"500px\" alt=\"模型还考虑了伯明翰和曼彻斯特\"\u002F>\n\n可视化候选输出 token 及其概率分数。\n\n### 哪些输入词让模型联想到伦敦？\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_34953e6684d6.png\" width=\"400px\" alt=\"询问 GPT2 希思罗机场在哪里\"\u002F>\n\n### 模型在哪些层获得了足够的信心，认定伦敦是正确答案？\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_be6aab1b8b48.png\" width=\"200px\" alt=\"每个层中 token 的顺序，第 11 层时它成为第一名\"\u002F>\n\n模型在最后一层之后，将概率最高的 token 排名第一，从而选择了伦敦。那么，每一层对提升“伦敦”的排名分别作出了怎样的贡献呢？这正是 [logit lens](https:\u002F\u002Fwww.lesswrong.com\u002Fposts\u002FAcKRB8wDpdaN6v6ru\u002Finterpreting-gpt-the-logit-lens) 可视化工具的作用——帮助我们探索不同模型层的活动。\n\n### BERT 在处理一段文本时，其神经元激活有哪些模式？\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_6c0bb8705563.png\" width=\"500px\" alt=\"左侧为彩色折线图，右侧为一段文本。折线图显示 BERT 各组神经元对文本的响应激活情况\"\u002F>\n\nBERT 中的一些神经元群倾向于在遇到逗号和其他标点符号时被激活，而另一些则更易对代词产生反应。借助此可视化工具，您可以对单个 FFNN 层或整个模型中的神经元活动进行因子分解。\n\n\n阅读论文：\n>[Ecco：一个用于解释 Transformer 语言模型的开源库](https:\u002F\u002Faclanthology.org\u002F2021.acl-demo.30\u002F)\n> 计算语言学协会 (ACL) 系统演示，2021年\n\n## 教程\n- 视频：[使用 Ecco 深入了解语言模型](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=rHrItfNeuh0)。\\[\u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FLanguage_Models_and_Ecco_PyData_Khobar.ipynb\">Colab 笔记本\u003C\u002Fa>]\n\n\n## 操作指南\n- [解释 Transformer 语言模型的接口](https:\u002F\u002Fjalammar.github.io\u002Fexplaining-transformers\u002F)\n- [寻找恰当的词语：语言模型的隐藏状态可视化](https:\u002F\u002Fjalammar.github.io\u002Fhidden-states\u002F)\n\n\n## API 参考\n[Ecco 的 API 参考文档](https:\u002F\u002Fecco.readthedocs.io\u002Fen\u002Fmain\u002Fapi\u002Fecco\u002F)和[架构页面](https:\u002F\u002Fecco.readthedocs.io\u002Fen\u002Fmain\u002Farchitecture\u002F)详细介绍了 Ecco 的各个组件及其协作方式。\n\n## 作品集与示例\n\n\u003Cdiv class=\"container gallery\" markdown=\"1\">\n\n\u003Cp>\u003Cstrong>预测的标记：\u003C\u002Fstrong>查看模型对下一个标记的预测（附带概率分数）。了解这些预测如何在模型的不同层中演变。 [\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Output_Token_Scores.ipynb\">笔记本\u003C\u002Fa>] [\u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Output_Token_Scores.ipynb\">Colab\u003C\u002Fa>]\u003C\u002Fp>\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_90a76f6b48dd.png\" width=\"400\" \u002F>\n\u003Chr \u002F>\n\u003Cp>\u003Cstrong>各层中的排名：\u003C\u002Fstrong>在模型选出一个输出标记后，回溯查看每一层对该标记的排名情况。 [\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Evolution_of_Selected_Token.ipynb\">笔记本\u003C\u002Fa>] [\u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Evolution_of_Selected_Token.ipynb\">Colab\u003C\u002Fa>]\u003C\u002Fp>\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_205163a81ee5.png\" width=\"400\"\u002F>\n\u003Chr \u002F>\n\u003Cp>\u003Cstrong>各层预测：\u003C\u002Fstrong>比较多个标记作为序列中某一位置候选时的排名情况。 [\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Comparing_Token_Rankings.ipynb\">笔记本\u003C\u002Fa>] [\u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Comparing_Token_Rankings.ipynb\">Colab\u003C\u002Fa>]\u003C\u002Fp>\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_9d8cb516749f.png\" width=\"400\" \u002F>\n\u003Chr \u002F>\n\u003Cp>\u003Cstrong>主要归因：\u003C\u002Fstrong>每个输入标记对生成输出标记的贡献有多大？ [\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Primary_Attributions.ipynb\">笔记本\u003C\u002Fa>] [\u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Primary_Attributions.ipynb\">Colab\u003C\u002Fa>]\n\u003C\u002Fp>\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_a6eba91a0d9b.png\" width=\"400\"\u002F>\n\n\u003Chr \u002F>\n\u003Cp>\u003Cstrong>详细的主要归因：\u003C\u002Fstrong>通过详细视图查看更精确的输入归因值。 [\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Primary_Attributions.ipynb\">笔记本\u003C\u002Fa>] [\u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Primary_Attributions.ipynb\">Colab\u003C\u002Fa>]\n\u003C\u002Fp>\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_4c6d86142be8.png\" width=\"400\"\u002F>\n\n\u003Chr \u002F>\n\u003Cp>\u003Cstrong>神经元激活分析：\u003C\u002Fstrong>利用非负矩阵分解技术，研究神经元激活背后的潜在模式。 [\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Neuron_Factors.ipynb\">笔记本\u003C\u002Fa>] [\u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fjalammar\u002Fecco\u002Fblob\u002Fmain\u002Fnotebooks\u002FEcco_Neuron_Factors.ipynb\">Colab\u003C\u002Fa>]\u003C\u002Fp>\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_readme_a93c3f815852.png\" width=\"400\"\u002F>\n\n\u003C\u002Fdiv>\n\n## 获取帮助\n遇到困难了吗？\n\n- 在 [讨论区](https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fdiscussions) 中或许能找到相关解答。如果没有，您也可以在那里提问。\n- 如发现错误，请前往 Ecco 的 [问题追踪器](https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fissues) 提交报告。\n\n\n\n用于引用的 BibTeX 格式：\n```bibtex\n@inproceedings{alammar-2021-ecco,\n    title = \"Ecco：用于解释 Transformer 语言模型的开源库\",\n    author = \"Alammar, J\",\n    booktitle = \"第59届计算语言学协会年会暨第11届国际自然语言处理联合会议：系统演示\",\n    year = \"2021\",\n    publisher = \"计算语言学协会\",\n}\n```","# Ecco 快速上手指南\n\nEcco 是一个用于探索和解释基于 Transformer 的自然语言处理（NLP）模型的 Python 库。它通过交互式可视化帮助开发者理解预训练模型（如 GPT-2, BERT, T5 等）的内部工作机制，包括特征归因、神经元激活分析和层级预测演化等。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**：Linux, macOS 或 Windows\n*   **Python 版本**：支持 Python 3.7 及以上版本\n*   **运行环境**：推荐在 **Jupyter Notebook** 或 **JupyterLab** 中使用，以获得最佳的交互式可视化体验\n*   **前置依赖**：Ecco 基于 `PyTorch` 和 Hugging Face `transformers` 构建，安装时会自动处理这些依赖。\n\n## 安装步骤\n\n您可以选择使用 `pip` 或 `conda` 进行安装。国内用户建议使用国内镜像源以加速下载。\n\n### 方式一：使用 pip 安装\n\n**默认源安装：**\n```sh\npip install ecco\n```\n\n**推荐使用国内镜像源（如清华源）加速安装：**\n```sh\npip install ecco -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n### 方式二：使用 conda 安装\n\n如果您使用 Anaconda 或 Miniconda，可以通过 conda-forge 渠道安装：\n\n```sh\nconda install -c conda-forge ecco\n```\n\n## 基本使用\n\nEcco 的核心功能是在 Jupyter Notebook 中加载预训练模型并进行交互式探索。以下是最简单的使用示例。\n\n### 1. 初始化模型\n\n在 Notebook 单元格中导入 `ecco` 并加载一个预训练模型（例如 `t5-small`）。Ecco 会自动下载模型（如果本地不存在）。\n\n```python\nimport ecco\n\n# 初始化 Ecco 并加载 T5 模型\nlm = ecco.from_pretrained('t5-small')\n```\n\n### 2. 生成文本并查看可视化\n\n调用 `generate()` 方法输入提示词（Prompt），Ecco 将返回生成结果并自动展示交互式可视化组件。您可以查看候选 token 的概率、特征归因（哪些输入词影响了输出）以及数据在模型各层级的演变过程。\n\n```python\n# 输入提示词并生成回复\noutput = lm.generate(\"What is the capital of France?\")\n```\n\n**交互功能说明：**\n*   **Token 概率**：查看模型在每个位置预测的候选词及其置信度。\n*   **特征归因 (Attribution)**：高亮显示对输出结果影响最大的输入词汇（支持 Integrated Gradients, Saliency 等多种算法）。\n*   **层级演化 (Logit Lens)**：观察特定 Token 的排名如何随着模型层数的加深而变化，理解模型是如何逐步确定答案的。\n\n### 3. 加载本地模型\n\n如果您已经下载了 Hugging Face 格式的本地模型，可以直接指定路径加载：\n\n```python\n# 加载本地模型路径\nlm = ecco.from_pretrained('\u002Fpath\u002Fto\u002Fyour\u002Flocal\u002Fmodel')\n```\n\n> **提示**：更多高级用法（如神经元激活模式分析、多模型对比等），请参考官方文档 [ecco.readthedocs.io](https:\u002F\u002Fecco.readthedocs.io\u002F) 或查看项目仓库中的示例 Notebook。","某 NLP 算法工程师正在调试一个基于 BERT 的金融情感分析模型，试图找出模型为何将一条明显的负面新闻误判为“正面”。\n\n### 没有 ecco 时\n- **黑盒决策难追溯**：面对错误预测，只能看到最终输出概率，无法直观得知是哪些关键词（如“暴跌”或“亏损”）主导了判断。\n- **归因分析门槛高**：若想计算特征重要性，需手动集成 Captum 库并编写大量样板代码来运行 IntegratedGradients 或 Saliency 算法。\n- **内部机制不可见**：难以观察特定神经元在 Transformer 各层中的激活模式，无法判断模型是否学到了错误的语法关联。\n- **调试效率低下**：缺乏交互式可视化，每次调整假设都需重新运行脚本并打印冗长的张量数据，排查过程耗时费力。\n\n### 使用 ecco 后\n- **关键因素一目了然**：直接在 Jupyter 中生成高亮热力图，瞬间发现模型过度关注了否定词前的修饰语，而忽略了核心动词。\n- **归因分析零代码**：只需调用一行 API 即可切换 DeepLift、GuidedBackprop 等多种归因算法，即时对比不同解释方法的结果。\n- **透视神经元活动**：利用 Logit Lens 可视化 token 在各层的演变过程，清晰看到错误信号是在哪一层开始偏离，并定位到具体的异常激活神经元。\n- **交互探索提效**：通过交互式图表动态调整输入并实时观察模型反应，将原本数小时的排查工作缩短至几分钟。\n\necco 将晦涩的 Transformer 内部状态转化为直观的交互图表，让开发者能像“做 CT 扫描”一样精准诊断模型病灶。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fjalammar_ecco_1c5fa45b.png","jalammar","Jay Alammar","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fjalammar_3ee45342.jpg","O'Reilly Author. ML Research Engineer.\r\n","@cohere-ai ",null,"JayAlammar","jalammar.github.io","https:\u002F\u002Fgithub.com\u002Fjalammar",[82,86,90,94],{"name":83,"color":84,"percentage":85},"Jupyter Notebook","#DA5B0B",87.7,{"name":87,"color":88,"percentage":89},"Python","#3572A5",9.8,{"name":91,"color":92,"percentage":93},"HTML","#e34c26",2.3,{"name":95,"color":96,"percentage":97},"CSS","#663399",0.2,2095,178,"2026-04-17T11:46:56","BSD-3-Clause",1,"未说明",{"notes":105,"python":106,"dependencies":107},"该工具主要在 Jupyter Notebook 环境中运行，用于探索和解释预训练的 Transformer 模型（如 GPT2, BERT, T5 等），不支持模型训练或微调。支持通过 pip 或 conda 安装。具体 GPU 和内存需求取决于所加载的预训练模型大小。","3.8+",[108,109,110,111],"pytorch","transformers","captum","jupyter",[14,35],[114,115,116,117,108,118],"nlp","visualization","explorables","natural-language-processing","language-models","2026-03-27T02:49:30.150509","2026-04-18T22:34:13.031519",[122,127,132,137,142,147],{"id":123,"question_zh":124,"answer_zh":125,"source_url":126},40789,"Ecco 是否支持 T5 等编码器 - 解码器（Seq2Seq）模型？","是的，T5 现在已受支持。如果在可视化中遇到问题，可能需要调整代码以正确处理解码器输入。例如，将序列 ID 的拼接逻辑修改为：`full_seq_ids = torch.cat([input_ids, decoder_input_ids[:,1:]], dim=-1)`，这样可以确保 `\u003Cpad>` 标记不被错误地视为输出部分，从而获得正确的可视化结果。","https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fissues\u002F39",{"id":128,"question_zh":129,"answer_zh":130,"source_url":131},40790,"如何安装 Ecco 的 Conda 版本？在 Windows 上有什么注意事项？","可以通过 Conda Forge 安装 Ecco，命令为：`conda install -c conda-forge ecco`。\n注意：在 Windows 系统上，建议先单独安装 PyTorch，然后再安装 Ecco，以确保依赖项正确配置。Conda 包的更新通过维护 `ecco-feedstock` GitHub 仓库的 PR 来完成，合并后 CI 流程会自动在几小时内发布新版本。","https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fissues\u002F54",{"id":133,"question_zh":134,"answer_zh":135,"source_url":136},40791,"除了默认的梯度方法，Ecco 还支持哪些归因（Attribution）方法？","Ecco 现已集成 Captum 库，支持多种归因方法，包括：IntegratedGradients（积分梯度）、Saliency（显著性）、InputXGradient、DeepLift、DeepLiftShap、GuidedBackprop、GuidedGradCam、Deconvolution 和 LRP。用户可以通过调用相应的 attributor 类来使用这些方法，例如：`ig = attr_method_class(model=model)` 然后使用 `ig.attribute()` 进行计算。","https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fissues\u002F22",{"id":138,"question_zh":139,"answer_zh":140,"source_url":141},40792,"如何在自定义 RoBERTa 模型配置中解决 'token_prefix' 缺失或报错的问题？","加载自定义 RoBERTa 模型时，必须在配置文件（如 `model-config.yaml`）中明确指定 `token_prefix`。对于 RoBERTa 模型，通常需要将 `token_prefix` 设置为 `'Ġ'`（注意这是一个特殊的字符），并将 `partial_token_prefix` 设置为空字符串 `''`。\n配置示例如下：\n```yaml\nroberta-base:\n    embedding: 'embeddings.word_embeddings'\n    type: 'mlm'\n    activations:\n        - '\\d+\\.output\\.dense'\n    token_prefix: 'Ġ'\n    partial_token_prefix: ''\n```","https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fissues\u002F73",{"id":143,"question_zh":144,"answer_zh":145,"source_url":146},40793,"Ecco 是否支持 LLAMA-2 或 Vicuna 等大型语言模型（LLM）？","直接支持大型模型（如 LLAMA-2）可能面临较高的计算成本和内存消耗，因为反向传播的计算量随模型大小和序列长度显著增加（例如 GPT-2 为 1.5B，而 LLAMA-2 为 7B）。\n替代方案：\n1. 尝试使用 Contrastive Explanations 方法，可参考 Inseq 库的实现。\n2. 使用 Captum 提供的 `lime` 或 `shap` 方法，并在 Ecco 中编写适配代码。已有用户成功在本地通过这种方式运行。","https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fissues\u002F98",{"id":148,"question_zh":149,"answer_zh":150,"source_url":151},40794,"Ecco 能否查看或可视化特定的注意力头（Attention Heads）激活情况？","Ecco 目前主要关注神经元激活（Neuron Activations）而非注意力机制。它捕获所有层的神经元激活值，但不直接提供针对特定注意力头的可视化功能。\n如果需要查看注意力权重，建议使用 Hugging Face Transformers 库，在模型输出时请求返回 attention values（通过设置 `output_attentions=True`），然后自行处理或可视化这些数据。","https:\u002F\u002Fgithub.com\u002Fjalammar\u002Fecco\u002Fissues\u002F37",[153,158,163,168,173,178,183,188,193,198],{"id":154,"version":155,"summary_zh":156,"released_at":157},324339,"v0.1.2","适用于较新版本 Transformers 的 T5 补丁。","2022-01-09T21:17:53",{"id":159,"version":160,"summary_zh":161,"released_at":162},324340,"v0.1.1","热修复。关闭 #57 和 #56。","2022-01-04T09:17:03",{"id":164,"version":165,"summary_zh":166,"released_at":167},324341,"v0.1.0","Ecco 迎来重大更新！@JoaoLages 和 @SSamDav 做出了巨大贡献。\n\n- 新增对 T5 等编码器-解码器模型的支持\n- 使用 Captum 进行特征归因，新增以下方法的支持：IntegratedGradients、Saliency、InputXGradient、DeepLift、DeepLiftShap、GuidedBackprop、GuidedGradCam、Deconvolution、LRP。这取代了 Ecco 内部此前针对 Saliency 和 InputXGradients 的实现。\n- 新增对束搜索（Beam Search）生成的支持\n- 新增导入本地模型的功能，这对于分析微调后的模型非常有用。\n- 在可视化中对各类分词器的支持得到进一步提升。不过这方面仍需进一步完善。","2021-12-29T10:27:23",{"id":169,"version":170,"summary_zh":171,"released_at":172},324342,"v0.0.15","- 新增了通过 CKA（中心化核对齐）以及典型相关分析方法（CCA、SVCCA 和 PWCCA）计算激活矩阵相似度得分的支持。\n- 改进了配置文件的加载和模型支持（感谢 @stprior）。","2021-08-02T08:47:48",{"id":174,"version":175,"summary_zh":176,"released_at":177},324343,"v0.0.14","- 增加了文档门户\n- LM 现在具备 call() 函数，因此可以支持 BERT 等多层语言模型（无需进行文本生成）。关闭 #18\ncall() 及其他函数现在都支持批量维度。例外的是 “generate” 函数，它仅对单个输入序列生效，而不支持批量处理。关闭 #19\n- 为 #6 奠定基础。目前已支持 BERT 进行激活值收集，以及较早版本的 NMF 因子分解。EccoJS 需要清理诸如 (##) 之类的不完整分词字符。或者更好的做法是，让 EccoJS 保持“傻瓜式”设计，由我们提前将分词结果清理干净后再传入，EccoJS 只负责展示即可。\n- 支持更多模型的基础工作之一是 model-config.yml 文件，该文件应明确如何将 ecco.LM 与底层语言模型连接起来。","2021-02-25T09:54:16",{"id":179,"version":180,"summary_zh":181,"released_at":182},324344,"v0.0.13","- 添加了对 Hugging Face Transformers v4 的支持。关闭 #30。","2021-02-08T05:46:26",{"id":184,"version":185,"summary_zh":186,"released_at":187},324345,"v0.0.12","- 更大的 GPT-2 模型现在可以在 GPU 上处理长序列，而不会耗尽显存。\n- 神经元激活：支持指定捕获特定层的激活值。\n\n感谢贡献者 @nostalgebraist。","2021-01-05T07:44:43",{"id":189,"version":190,"summary_zh":191,"released_at":192},324346,"v0.0.10","阿尔法版本","2020-12-16T10:22:21",{"id":194,"version":195,"summary_zh":196,"released_at":197},324347,"v0.0.9RC","- 开始编写文档\n- 增加更多测试。GitHub Actions 持续集成\u002F持续部署","2020-12-01T13:15:39",{"id":199,"version":200,"summary_zh":77,"released_at":201},324348,"v0.0.8","2020-11-20T06:08:22"]