skills: correct the claims the sweep disproved, and cover what it found missing - #9
Merged
Merged
Conversation
nnsight 0.8 inverted which side of the collision moves. On a module whose own child is named `output`, the child is now `.E_output` and `.output` keeps its usual meaning; `.nns_output` is gone. Where the old advice inverted along with the rule, it is replaced rather than renamed. access-and-modify said to check `print(model)` for a `.output` that looks like a module, which can no longer happen, so it points at the `E_output/output` label the repr prints instead. inspect_model.py built its note from the names it detected but printed a fixed `.nns_output / .nns_input`; it now names the attributes it actually found. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…nd missing The stress sweep of nnsight 0.8 caught the plugin stating four things that are not true and leaving out five that cost agents real time. Wrong, and inherited from the docs: `generate` is not greedy by default — it uses the checkpoint's `generation_config`, and Qwen3-8B and Llama-3.2-1B-Instruct both sample from it; a vLLM decoder layer's `output[1]` is the residual after this layer's attention, not the stream entering it; a VLM sweep *can* be batched over the chat route, so it is one forward pass and not twelve; the PEFT example's `adapted.model.layers[16].output[0]` is wrong twice over; and the in-place SAE attach form writes the attachment's result into its own input, so backward through it raises. Wrong, and the skills' own: causal tracing does not need 7B parameters — Llama-3.2-1B gives a textbook two-site trace on the skill's own prompt, so the requirement is a confidently-known fact and enough depth, not a size; FLUX.2 reads Qwen3 hidden states 9/18/27, so the `[-2]` recipe is a no-op there; Qwen3-VL's adapter is not "(none)" and zeroing only the merger leaves the answer unchanged; whisper runs its encoder twice; base `NNsight` has no `.scan()`; `-tp 2` prints two "Ignoring unknown argument" lines, and `n > 1` over serve silently returns one sequence's saves. Missing: `envoys=` and `eproperty` appeared nowhere, so the path reference gains a worked per-head accessor; the path table had no MoE, SSM or hybrid rows and stated the tensor-vs-tuple rule as if it generalized; nothing said wrapping mutates the module for the rest of the process; `.skip()` was absent from the vLLM skill although it can take the engine down; and `skip` advancing the run past the module was unstated. `scripts/inspect_model.py` gains `--task` and `--trust-remote-code` (a repo with no `pipeline_tag` died on task inference, a remote-code one on an interactive prompt), prints the task beside the class it built, descends into MoE blocks — naming the router and experts, and the first non-dense layer — and stops diagnosing every scan failure as data-dependent control flow. The batching sections state the rule from nnsight#722: a leading dim that is a whole multiple of the batch size is scoped, and a write to a layout that cannot be scoped warns. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements item 24 of the stress-sweep decisions in full, plus the skill halves of item 23 points 2 and 3, plus two mid-task corrections from the coordinator.
What was broken
Claims inherited from the docs
nnsight/SKILL.md,references/generation.md×2,references/api-reference.md,logit-lens/SKILL.md).generatecalls HuggingFace'sgenerate, which reads the checkpoint'sgeneration_config— Qwen3-8B shipsdo_sample=True, temperature=0.6, top_p=0.95, Llama-3.2-1B-Instructdo_sample=True, temperature=0.6, top_p=0.9. This produced a logit lens disagreeing with its own generated tokens on 7/10 steps while the skill's wiring check passed. The lens example now passesdo_sample=Falseand says a disagreeing last layer means sampling, not a broken lens.vllm/SKILL.mdpoint 2 carrieddocs/models/vllm.md:99's wrong residual:output[1]is the stream after this layer's attention, not the one entering the layer. Theout[0] + out[1]recipe on the same page was already right and is unchanged.diffusion-and-multimodalsaid a VLM sweep cannot be batched. True of a processor encoding, false of chat messages with an embedded image. Rewritten with a runnable three-layer sweep in one pass, and the vision-side scoping warning attached (item 7).adapted.model.layers[16].output[0]:adapted.modelforwards toLlamaForCausalLM, which has no.layers, and a Llama block's.outputis a bare tensor. Both now stated, path corrected toadapted.model.model.layers[16].output.sae-and-dictionary-learning/SKILL.md:92andnnsight/references/modules-and-architectures.md:213, plus the two sibling examples in the same files so each teaches one form.Claims the skills invented
causal-tracing's "roughly 7B parameters or more" (:23and:382). Rewritten as a requirement on the model knowing the fact confidently and having depth to separate the sites, with two checks that can actually fail.diffusion-and-multimodal: FLUX.2's read point (Qwen3 hidden states 9/18/27, so[-2]is a no-op — check the pipeline'sencode_prompt); Qwen3-VL's adapter is not "(none)" (visual.deepstack_merger_listinjects after LM layers 0-2, so zeroing only the merger leaves the answer unchanged); whisper's double encoder call; and a note that every diffusion example runs atguidance_scale=0.0, which is not the default.model.scan(x)presented as generic innnsight/SKILL.mdandreferences/caching-and-scan.md. Verified:NNsight(torch.nn.Linear(4,4)).scan(...)→AttributeError.scancomes from the meta/loadable mixin.vllm/references/serving.md:-tp 2prints two "Ignoring unknown argument" lines, not one; andn > 1overserve=returns sequence 0's saves alone whileresult.outputsstill shows all of them.Coverage gaps — the largest part of the change.
envoys=appeared nowhere in the plugin andepropertyonly as a pointer.modules-and-architectures.mdgains a section with a runnable per-head.headsaccessor attached to GPT-2's attention modules withenvoys={GPT2Attention: Heads}, and the four things that bite (attribute fall-through, the transform's shape, the swallowedAttributeError,key="input").(hidden, router_scores)cases. All measured with the updated inspector on transformers 5.15.forwardafter wrapping, mutate the tree through the envoy. All three reproduced against 0.8..skip()added to the vLLM skill: why it can take the engine down rather than the request, that whether it does is the scheduler's choice, and that a vLLM decoder layer's.inputis the positions tensor — sodocs/usage/skip.md's pass-through idiom kills the engine.control-flow.mdgains the rule thatskipadvances the run, so earlier reads must come above it.vllm/references/parallel-and-architectures.md's MoE section: its(logits, bias)router is vLLM's, and the same recipe is a no-op onTransformersModel.scripts/inspect_model.py— a real code change, additive:--task(a repo with nopipeline_tag, e.g.AntonV/mamba2-130m-hf, died on task inference) and--trust-remote-code(a custom architecture stopped at an interactive prompt).taskbeside the class it built, and says the task decides the class. OnQwen/Qwen3.5-0.8Bthe inferredimage-text-to-textbuildsQwen3_5ForConditionalGenerationwithmodel.model.language_model.layers[i]and--task text-generationbuildsQwen3_5ForCausalLMwithmodel.model.layers[i]— the crash that cost one agent its first run.NOTE: layer 0 is dense; the router first appears at [1]). The probe now prints the router's(logits, weights, index)tuple and the flat(B*T, D)expert rows directly.GuardOnDataDependentSymNode.Batching rule (coordinator mid-task correction) —
nnsight/references/batching.mdgains "Which values are scoped to your rows" and "Forward keywords belong to the batch", stating the post-#722 rule: a leading dim that is the batch size or a whole multiple of it is scoped (which covers MoE(B*T, ...)and per-head(B*T*H, ...)), anything else goes to every invoke whole, and a write to one warns rather than failing silently. The MoE and VLM sections were written against the same rule.What I tested
make test-localequivalent (pytest -q, ndif2): 150 passed, 2 failed. Both failures are pre-existing and environmental —vllm/SKILL.mdandvllm/references/graph-taps.mdfail withModuleNotFoundError: No module named 'vllm'. Confirmed identical on a cleangit archive HEADcheckout of the base commit.tests/test_structure.py: 119 passed (links, frontmatter, symlinks, pre-0.8 API ban).' Tower'site 0.768 at layer 3,' of'site 0.922 at layer 9 of 16 — reproduces the maintainer's numbers exactly.generation_configsampling: gpt2 withdo_sample=Truegives 4 distinct continuations in 4 runs, 1 withdo_sample=False.inplace: RuntimeError ... modified by an inplace operation,replace: backward ok.llava-interleave-qwen-0.5b-hf: two invokes batch; a three-layer ablation sweep is one pass; and with a two-image invoke beside a one-image one,multi_modal_projector.outputis(3, 729, 1024)in both and zeroing it in the second moved the first's untouched logits by 8.4, while the LM-side control moved it by 0.0.NNsight(nn.Linear).scan→AttributeError; controller installed into the instance dict on first trace;forwardreplaced after wrapping →OutOfOrderError;net.append(...)after wrapping → torch 2 children, envoy 1,IndexError..headseproperty block, and the inspector on gpt2, mamba-130m, mamba2-130m, RWKV-4, Falcon-H1, Qwen3-Next-MoE, Qwen3-MoE, GLM-4-MoE, DeepSeek-V3, GPT-OSS and Qwen3.5-0.8B.Deliberately left alone, and two couplings
logit-lens's gemma-2 softcap handling is correct and verified. No change, as decided.plugins/nnsight/skills/vllm/references/parallel-and-architectures.md:45— "A fused projection (qkv_proj,gate_up_proj) gathers in rank order —[q₀ k₀ v₀ | q₁ k₁ v₁]— so slice it by head, not by[:q_size]" — is correct for nnsight as it stands today, wheredocs/models/vllm-parallelism.mdstates it wrongly. Draft PR vllm: gather a fused projection into the layout tp=1 has nnsight#719 changes the gather so the doc becomes right and this line becomes wrong; it is unverified (nobody has a multi-GPU box to run it). If #719 lands, that line must change in the same commit.guidance_scale=7.5: in-place and assignment both moved the image by 0.0494), and the explicit two-invoke form hit an unrelatedStableDiffusionPipelineOutputerror before I could measure it. So the text says the per-invoke value is stitched from two ranges and is a copy, recommends assignment, and does not claim a number I did not take. Worth revisiting when item 6 is picked up.--peftforinspect_model.pywas not added — out of scope for item 24. Themodel-editing-and-lorapointer that promised--grep lorawould show an adapter tree is corrected to anamed_modules()filter instead.references/parallel-and-architectures.md's stale Qwen3.6 MoE tree and its(tensor, None)fused-projection outputs are in the consolidated report but not in item 24; left for whoever takes the vLLM doc items.🤖 Generated with Claude Code