实例介绍
Transformer Debugger (TDB)是OpenAI的Superalignment团队开发的工具,旨在支持对小型语言模型特定行为的调查。该工具结合了自动解释技术和稀疏自动编码器,能够快速探索并干预前向传播,以了解其对特定行为的影响。TDB能够回答诸如“为什么模型在这个提示下输出token A而不是token B?”或“为什么注意力头H在这个提示下关注token T?”等问题。它通过识别特定组件(神经元、注意力头、自动编码器潜变量)来解释行为,展示造成这些组件最强烈激活的自动生成的解释,并追踪组件之间的连接以帮助发现电路。
这些视频概述了TDB,并展示了如何使用它来调查GPT-2 small中的间接对象识别:
- 介绍
- 神经元查看器页面
- 示例:调查名字移动头,第1部分
- 示例:调查名字移动头,第2部分
【核心代码】
文件清单
└── transformer-debugger-dc1f898725113bec6cf1006e48f9c5219f8fbdde
├── datasets.md
├── LICENSE
├── mypy.ini
├── neuron_explainer
│ ├── activations
│ │ ├── activation_records.py
│ │ ├── activations.py
│ │ ├── attention_utils.py
│ │ ├── derived_scalars
│ │ │ ├── activations_and_metadata.py
│ │ │ ├── attention.py
│ │ │ ├── autoencoder.py
│ │ │ ├── config.py
│ │ │ ├── derived_scalar_store.py
│ │ │ ├── derived_scalar_types.py
│ │ │ ├── direct_effects.py
│ │ │ ├── edge_activation.py
│ │ │ ├── edge_attribution.py
│ │ │ ├── indexing.py
│ │ │ ├── __init__.py
│ │ │ ├── least_common_tokens.py
│ │ │ ├── locations.py
│ │ │ ├── logprobs.py
│ │ │ ├── make_scalar_derivers.py
│ │ │ ├── mlp.py
│ │ │ ├── multi_group.py
│ │ │ ├── multi_pass_scalar_deriver.py
│ │ │ ├── node_write.py
│ │ │ ├── postprocessing.py
│ │ │ ├── raw_activations.py
│ │ │ ├── README.md
│ │ │ ├── reconstituted.py
│ │ │ ├── reconstituter_class.py
│ │ │ ├── residual.py
│ │ │ ├── scalar_deriver.py
│ │ │ ├── tests
│ │ │ │ ├── test_attention.py
│ │ │ │ ├── test_derived_scalar_store.py
│ │ │ │ ├── test_derived_scalar_types.py
│ │ │ │ └── utils.py
│ │ │ ├── tokens.py
│ │ │ ├── utils.py
│ │ │ └── write_tensors.py
│ │ ├── hook_graph.py
│ │ └── test_attention_utils.py
│ ├── activation_server
│ │ ├── derived_scalar_computation.py
│ │ ├── dst_helpers.py
│ │ ├── explainer_routes.py
│ │ ├── explanation_datasets.py
│ │ ├── inference_routes.py
│ │ ├── interactive_model.py
│ │ ├── load_neurons.py
│ │ ├── main.py
│ │ ├── neuron_datasets.py
│ │ ├── README.md
│ │ ├── read_routes.py
│ │ ├── requests_and_responses.py
│ │ └── tdb_conversions.py
│ ├── api_client.py
│ ├── explanations
│ │ ├── attention_head_scoring.py
│ │ ├── calibrated_simulator.py
│ │ ├── explainer.py
│ │ ├── explanations.py
│ │ ├── few_shot_examples.py
│ │ ├── __init__.py
│ │ ├── prompt_builder.py
│ │ ├── scoring.py
│ │ ├── simulator.py
│ │ ├── test_explainer.py
│ │ └── test_simulator.py
│ ├── fast_dataclasses
│ │ ├── fast_dataclasses.py
│ │ ├── __init__.py
│ │ └── test_fast_dataclasses.py
│ ├── file_utils.py
│ ├── __init__.py
│ ├── models
│ │ ├── autoencoder_context.py
│ │ ├── autoencoder.py
│ │ ├── hooks.py
│ │ ├── inference_engine_type_registry.py
│ │ ├── __init__.py
│ │ ├── model_component_registry.py
│ │ ├── model_context.py
│ │ ├── model_registry.py
│ │ ├── README.md
│ │ └── transformer.py
│ ├── pydantic
│ │ ├── camel_case_base_model.py
│ │ ├── hashable_base_model.py
│ │ ├── immutable.py
│ │ └── __init__.py
│ ├── scripts
│ │ ├── create_hf_test_data.py
│ │ └── download_from_hf.py
│ └── tests
│ ├── conftest.py
│ ├── test_activation_reconstituter.py
│ ├── test_against_data.py
│ ├── test_all_dsts.py
│ ├── test_emb_dsts.py
│ ├── test_hooks.py
│ ├── test_interactive_model.py
│ ├── test_model_context_get_weight.py
│ ├── test_offline_autoencoder_dsts.py
│ ├── test_online_autoencoder_dsts.py
│ ├── test_postprocessing.py
│ ├── test_reconstituted_gradients.py
│ ├── test_serialization_of_model_config_from_model_context.py
│ ├── test_trace_through_v.py
│ └── test_transformer.py
├── neuron_viewer
│ ├── package.json
│ ├── package-lock.json
│ ├── prepend_autogen_comments.sh
│ ├── public
│ │ ├── favicon.ico
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── README.md
│ ├── src
│ │ ├── App.css
│ │ ├── App.tsx
│ │ ├── client
│ │ │ ├── core
│ │ │ │ ├── ApiError.ts
│ │ │ │ ├── ApiRequestOptions.ts
│ │ │ │ ├── ApiResult.ts
│ │ │ │ ├── CancelablePromise.ts
│ │ │ │ ├── OpenAPI.ts
│ │ │ │ └── request.ts
│ │ │ ├── index.ts
│ │ │ ├── models
│ │ │ │ ├── AblationSpec.ts
│ │ │ │ ├── ActivationLocationType.ts
│ │ │ │ ├── AttentionHeadRecordResponse.ts
│ │ │ │ ├── AttentionTraceType.ts
│ │ │ │ ├── AttributedScoredExplanation.ts
│ │ │ │ ├── BatchedRequest.ts
│ │ │ │ ├── BatchedResponse.ts
│ │ │ │ ├── BatchedTdbRequest.ts
│ │ │ │ ├── ComponentTypeForAttention.ts
│ │ │ │ ├── ComponentTypeForMlp.ts
│ │ │ │ ├── DerivedAttentionScalarsRequestSpec.ts
│ │ │ │ ├── DerivedAttentionScalarsRequest.ts
│ │ │ │ ├── DerivedAttentionScalarsResponseData.ts
│ │ │ │ ├── DerivedAttentionScalarsResponse.ts
│ │ │ │ ├── DerivedScalarsRequestSpec.ts
│ │ │ │ ├── DerivedScalarsRequest.ts
│ │ │ │ ├── DerivedScalarsResponseData.ts
│ │ │ │ ├── DerivedScalarsResponse.ts
│ │ │ │ ├── DerivedScalarType.ts
│ │ │ │ ├── Dimension.ts
│ │ │ │ ├── ExistingExplanationsRequest.ts
│ │ │ │ ├── ExplanationResult.ts
│ │ │ │ ├── GroupId.ts
│ │ │ │ ├── HTTPValidationError.ts
│ │ │ │ ├── InferenceAndTokenData.ts
│ │ │ │ ├── InferenceRequestSpec.ts
│ │ │ │ ├── InferenceResponseAndResponseDict.ts
│ │ │ │ ├── InferenceResponse.ts
│ │ │ │ ├── InferenceSubRequest.ts
│ │ │ │ ├── LossFnConfig.ts
│ │ │ │ ├── LossFnName.ts
│ │ │ │ ├── MirroredActivationIndex.ts
│ │ │ │ ├── MirroredNodeIndex.ts
│ │ │ │ ├── MirroredTraceConfig.ts
│ │ │ │ ├── ModelInfoResponse.ts
│ │ │ │ ├── MultipleTopKDerivedScalarsRequestSpec.ts
│ │ │ │ ├── MultipleTopKDerivedScalarsRequest.ts
│ │ │ │ ├── MultipleTopKDerivedScalarsResponseData.ts
│ │ │ │ ├── MultipleTopKDerivedScalarsResponse.ts
│ │ │ │ ├── NeuronDatasetMetadata.ts
│ │ │ │ ├── NeuronRecordResponse.ts
│ │ │ │ ├── NodeAblation.ts
│ │ │ │ ├── NodeIdAndDatasets.ts
│ │ │ │ ├── NodeToTrace.ts
│ │ │ │ ├── NodeType.ts
│ │ │ │ ├── PassType.ts
│ │ │ │ ├── PreOrPostAct.ts
│ │ │ │ ├── ProcessingResponseDataType.ts
│ │ │ │ ├── ScoredTokensRequestSpec.ts
│ │ │ │ ├── ScoredTokensResponseData.ts
│ │ │ │ ├── ScoreRequest.ts
│ │ │ │ ├── ScoreResult.ts
│ │ │ │ ├── TdbRequestSpec.ts
│ │ │ │ ├── Tensor0D.ts
│ │ │ │ ├── Tensor1D.ts
│ │ │ │ ├── Tensor2D.ts
│ │ │ │ ├── Tensor3D.ts
│ │ │ │ ├── TensorType.ts
│ │ │ │ ├── TokenAndAttentionScalars.ts
│ │ │ │ ├── TokenAndScalar.ts
│ │ │ │ ├── TokenPairAttributionRequestSpec.ts
│ │ │ │ ├── TokenPairAttributionResponseData.ts
│ │ │ │ ├── TokenScoringType.ts
│ │ │ │ ├── TopTokensAttendedTo.ts
│ │ │ │ ├── TopTokens.ts
│ │ │ │ └── ValidationError.ts
│ │ │ └── services
│ │ │ ├── ExplainerService.ts
│ │ │ ├── HelloWorldService.ts
│ │ │ ├── InferenceService.ts
│ │ │ ├── MemoryService.ts
│ │ │ └── ReadService.ts
│ │ ├── colors.ts
│ │ ├── commonUiComponents.tsx
│ │ ├── heatmapGrid2d.tsx
│ │ ├── heatmapGrid.tsx
│ │ ├── images.d.ts
│ │ ├── index.css
│ │ ├── index.html
│ │ ├── index.tsx
│ │ ├── modelInteractions.tsx
│ │ ├── navigation.tsx
│ │ ├── nodePage.tsx
│ │ ├── panes
│ │ │ ├── activationsForPrompt.tsx
│ │ │ ├── datasetExamples.tsx
│ │ │ ├── explanation.tsx
│ │ │ ├── fetchAndDisplayPane.tsx
│ │ │ ├── index.ts
│ │ │ ├── logitLens.tsx
│ │ │ └── scoreExplanation.tsx
│ │ ├── plots.tsx
│ │ ├── requests
│ │ │ ├── explainerRequests.ts
│ │ │ ├── inferenceRequests.ts
│ │ │ ├── paths.ts
│ │ │ └── readRequests.ts
│ │ ├── tokenHeatmap2d.tsx
│ │ ├── tokenHeatmap.tsx
│ │ ├── tokenRendering.tsx
│ │ ├── TransformerDebugger
│ │ │ ├── cards
│ │ │ │ ├── BySequenceTokenDisplay.tsx
│ │ │ │ ├── DisplayOptions.tsx
│ │ │ │ ├── inference_params
│ │ │ │ │ ├── AblateNodeSpecs.tsx
│ │ │ │ │ ├── InferenceParamsDisplay.tsx
│ │ │ │ │ ├── inferenceParams.ts
│ │ │ │ │ ├── TokenLabel.tsx
│ │ │ │ │ └── TraceUpstreamNodeSpec.tsx
│ │ │ │ ├── LayerDisplay.tsx
│ │ │ │ ├── LogitsDisplay.tsx
│ │ │ │ ├── node_table
│ │ │ │ │ ├── NodeTable.tsx
│ │ │ │ │ └── TopTokensDisplay.tsx
│ │ │ │ ├── prompt
│ │ │ │ │ ├── MultiTokenInput.tsx
│ │ │ │ │ ├── PromptAndTokensOfInterest.tsx
│ │ │ │ │ └── swap.png
│ │ │ │ ├── SparsityMetricsDisplay.tsx
│ │ │ │ └── TokenTable.tsx
│ │ │ ├── common
│ │ │ │ ├── ExplanatoryTooltip.tsx
│ │ │ │ └── JsonModal.tsx
│ │ │ ├── requests
│ │ │ │ ├── explanationFetcher.ts
│ │ │ │ ├── inferenceDataFetcher.ts
│ │ │ │ └── inferenceResponseUtils.tsx
│ │ │ ├── TransformerDebugger.tsx
│ │ │ └── utils
│ │ │ ├── explanations.ts
│ │ │ ├── nodes.tsx
│ │ │ ├── numbers.tsx
│ │ │ └── urlParams.ts
│ │ ├── types.ts
│ │ └── welcome.tsx
│ ├── tailwind.config.js
│ └── tsconfig.json
├── pyproject.toml
├── pytest.ini
├── README.md
├── setup.py
└── terminology.md
29 directories, 252 files
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论