[Proposal] Demo: auditing a published LLM-written weight edit (Weight-Space Programming, Qwen3.5-0.8B loop fix) with TransformerBridge

未关闭
#1,978 1 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@emerardd 已经在做这个了。

开始于 2026年11月4日。

评估

这个 Issue 还没有评估数据。

描述

complexity-moderate demo TransformerBridge
Proposal

A demo notebook using existing TransformerBridge features to audit a published weight edit: recover the checkpoint change, fit its dominant direction, and measure the consequences of local interventions.

The case study is Experiment 8 of Sparks of Weight-Space Programming (Takehi et al., November 2026). The authors report improved MATH-500 accuracy after editing selected MLP output columns of Qwen/Qwen3.5-0.8B, and describe a repetition-related direction. The notebook connects that published edit to its weight geometry and local activation effects.

The authors released experiment logs and exact edit artifacts in RikiyaT/lm_understand-logs. The notebook would:

  1. rebuild the published edits bit for bit from the base checkpoint (sha256-checked against the logs' manifests);
  2. fit a rank-one directional approximation to the changed columns, reporting its coefficient and residual;
  3. compare an exact-weight-difference hook with directly swapped weights, measure the rank-one approximation error, and sweep the fitted coefficient alongside same-α random controls;
  4. measure next-token NLL on the base model's own released loop transcripts, separating repeated ("copy") tokens from new ones;
  5. optionally examine per-head contributions onto the fitted direction.
Motivation

The practical question is how to translate a checkpoint edit into an inspectable activation intervention and establish its numerical agreement. The worked example brings together TransformerBridge's weight reads, hooks and controlled comparisons into a reusable audit procedure.

Pitch

The local audit used an RTX 5060 in bf16, TL dev at b80b8257. The reconstruction script checks base and edited hashes for all 33 tensors across the three published runs. Coefficient-sweep and NLL summaries are saved locally. The remaining preparation is to capture geometry/hash-check and per-head outputs as structured results, and complete exact-difference hook validation.

1. A fitted directional reversal, rather than simple deletion.

  • On the selected 64 columns in each of layers 15 and 19, the 50-pass edit is well approximated by W' = W − α·u(uᵀW), with fitted α values 6.00032 and 6.00017 and reported residual norms of approximately 0.2–0.3% of the edit norm.
  • The fitted directional component is multiplied by 1 − α ≈ −5: a reversal and amplification.
  • Coefficient spot checks on four tensors from the 10-pass run provide a secondary comparison.

2. Stronger fitted reversal has a larger teacher-forced effect than α=1. On the last 1,024 tokens of 40 selected long base-model transcripts, about 95% of tokens meet the audit's repeated-8-gram definition:

Condition Δ NLL, repeated tokens in loops Δ NLL, new tokens in loops Δ NLL, early (non-loop) text
fitted directional hook (α≈6) +0.060 (0.007 → 0.067) +0.007 +0.009
deletion (coefficient 1), same 64 columns +0.001 −0.001 +0.000
deletion from the whole MLP write of both layers +0.002 +0.005 +0.001
control: random direction, same columns +0.000 +0.000 −0.000
control: same u, random columns −0.000 −0.001 +0.000
  • Repeated tokens show the larger mean NLL increase; α=1 produces a smaller, nonzero change.
  • A second draw from the same pool gives a similar change (+0.0602). The sampling schedules imply six overlapping records out of the two 40-record draws from 187 eligible records.
  • The response grows nonlinearly: approximately +0.001 at α=1, +0.012 at 4, +0.060 at 6 and +0.258 at 8.

3. An exploratory connection to the head removed in the 25-pass run.
The local notes report that head 15.7, removed by the 25-pass edit, has the largest absolute mean contribution onto layer 15's fitted direction among that layer's eight heads on the selected repeated-token positions. This offers an exploratory connection between the two edits. The optional section would include the underlying per-head results.

Measurement scope. These are descriptive teacher-forced means on isolated transcript windows, without paired uncertainty estimates. Random controls share α and column count; perturbation magnitude is unmatched. The benchmark figures remain the authors' results. The current hook/weight comparison covers one window's NLL; the planned validation separates exact-difference agreement from approximation error.

A short generation check used 20 truncated contexts and up to 256 greedy new tokens. Repeated-token share fell from 0.988 to 0.926 with the published p50c weights, with 0/20 meeting the escape threshold in either condition. The 10-pass edit also gives a similar teacher-forced change (+0.064) despite a different reported benchmark result. Together, these observations make the distinction between local continuation effects and end-to-end behavior a useful part of the demo.

Scope. One notebook, e.g. demos/Weight_Edit_Audit_Demo.ipynb.

  • Inputs: Qwen/Qwen3.5-0.8B at the logs' pinned revision 2fc06364, plus ~3 MB of edit diffs and transcripts from the logs repo at a pinned commit, with attribution.
  • Implementation: self-contained reconstruction code using the published artifacts.
  • Runtime: report measured wall time and peak memory on the device used for the final notebook.

Proposed delivery (one PR, after approval):

  • One demos/Weight_Edit_Audit_Demo.ipynb using existing library features: pinned artifact reconstruction, edit geometry, exact-difference hook validation and a bounded teacher-forced coefficient comparison. Include the optional per-head section once its structured evidence is available.
Alternatives
  • Delivery format. A notebook keeps the worked example together with its figures and results, following the demo-focused approach of #1933.
  • Validation and CI. Synthetic examples cover reconstruction algebra and hook mathematics in CI. Reconstructing the actual p50c difference and computing its SVD require the base checkpoint; those sections would have documented real-model runs, with notebook CI coverage agreed during review.
  • Reproduction only. A smaller demo could just reproduce the edit's effect. I think the deletion-versus-reversal contrast and the controls are the useful part, because they show how a mechanism claim can be tested rather than taken from a description.
Additional context
  • The accompanying evidence bundle would contain scripts, sample IDs, per-window results, geometry/error summaries and environment/revision provenance.
  • Qwen3.5's hybrid layout matters here: layers 15 and 19 are full-attention layers; the rest are mostly linear attention. The hooks used are standard ones on those layers.
Checklist
  • I have checked that there is no similar Issue or PR in the repository.
主要语言
Python
星标
3.9k
派生
708
平均合并
1 天 10 小时
30 天内合并 PR
82

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TransformerLensOrg/TransformerLens 的其他 Issue

查看 TransformerLensOrg/TransformerLens 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。