Skip to content

Source. A circuit for Python docstrings in a 4-layer attention-only transformer (Heimersheim & Janiak, 2023).

Description. Eight attention heads in a 4-layer attention-only transformer compose across three levels to predict the next argument name in a Python docstring: fuzzy previous-token heads and a positional head set up an induction step, and argument movers carry the name from the definition line to the output position. Resample ablation under three corruption types establishes which heads matter, and resample-ablating everything outside the eight leaves 42% success against the full model’s 56%. Evaluated on: one released toy model, 50 prompts per experiment, on prompts built to disable the line-number and repeat-inhibition algorithms at a measured cost ($$75% to 56%). Description mode: implementational-functional.

Docstring circuit. Readings of the claim, from the version the authors state to the version the field cites.

ReadingVerdictMissing
Primary. Eight named heads compose to predict the next argument name in a Python docstring in this 4-layer modelCausally SuggestiveSpecificity on any non-docstring behavior (I4), a leave-one-out over the eight heads (I3), a matched random head set to show the 42% belongs to these heads (M2), and dispersion on any reported number (M1)
The circuit is the model’s implementation of Docstring Induction, an algorithmUnderdeterminedApportionment between induction and the line-number algorithm, which the authors judge co-implemented and suppress by prompt design rather than refute (I5, V3); the algorithm is inferred from attention patterns rather than tested against its rivals (V2)
The circuit behaves like the model on the task it was found onDisconfirmedNothing — tested and failed (E2), and on post-origin evidence alone; the post’s own remark that Google-style docstrings give similar performance points the other way and carries no number (M3)
These heads, or the head types they instantiate, serve other tasks or recur in other modelsInsufficientCross-task reuse is never asked (E3), cross-model transfer is named as future work with no model, head set or number reported (E4), and the circuit is never compared with one for a neighboring task (C4)

Docstring circuit. Verdict: Causally Suggestive. The claim stops at the rung marked Blocked; rungs below it are Reached and rungs above it are blocked by that rung. Criteria in bold are absent or adverse at that rung; only those the rung requires can block it.

TierRequiresMissing
Proposedconstruct (C1–C2)Reached.
Causally Suggestivemeasurement (M2); internal (I1)Reached.
Mechanistically Supportedinternal (I2, I4); external (E1)Blocked. I4 specificity — Measured on one behavior; head 1.4 alone is run off-distribution
Triangulatedconstruct (C3–C4); internal (I5–I7); external (E2, E4)Blocked at Mechanistically Supported. C4 discriminant validity — The circuit is never compared with one for a neighboring task; E2 prompt generalization — Circuit and model diverge on a subclass of benign inputs (uit de Bos & Garriga-Alonso, 2024); E4 cross-model recurrence — Transfer is named as future work and no result is reported; I6 double dissociation — No second capability is shown intact while the docstring one fails
Validatedconstruct (C5–C6); measurement (M1–M6); internal (I3, I10–I12); external (E2–E6); interpretive (V1–V5)Blocked at Mechanistically Supported. C6 complementation validity — Three named levels, each ablated alone and never in combination; E3 cross-task generalization — Whether the components do anything for another task is never asked; E4 cross-model recurrence — Transfer is named as future work and no result is reported; I10 rescue reversibility — The restoring direction was run and not shown, by the author’s own account; I11 onset coupling — One pre-trained model off the shelf; no training trajectory in evidence; I12 offset coupling — Needs the training sequence that onset coupling also lacks; M1 reliability — Fifty prompts behind every plot; dispersion is never stated; M3 stability — Head membership is varied upward only; nothing re-measures the claim; M5 sensitivity — Nothing with a known answer is fed in to see whether it comes back; M6 invariance — No conclusion is re-derived under a changed condition and shown to hold

Docstring circuit. Full 36-criterion audit. Status: C = Confirmed, PC = Partially confirmed, U = Untested, I = Inconclusive, D = Disconfirmed, N/A = Not applicable.

IDCriterionStatusEvidence
Construct Validity
C1FalsifiabilityCEach head assignment is a signed prediction that could have come out flat
C2Structural plausibilityPCArgued at the activation level: patterns locate, patching confirms
C3Convergent validityPCOne instrument carries it; patching and composition share a primitive
C4Discriminant validityUThe circuit is never compared with one for a neighboring task
C5Nomological validityPCPlaced inside an existing theory of head types, which does work
C6Complementation validityUThree named levels, each ablated alone and never in combination
Measurement Validity
M1ReliabilityUFifty prompts behind every plot; dispersion is never stated
M2Baseline separationPC42% against a 17% chance level, with two further reference points
M3StabilityUHead membership is varied upward only; nothing re-measures the claim
M4CalibrationPCLogit difference against the highest wrong answer, recomputed throughout
M5SensitivityUNothing with a known answer is fed in to see whether it comes back
M6InvarianceUNo conclusion is re-derived under a changed condition and shown to hold
M7Selection correctionUComponents are chosen from the strongest cells of a patching grid
Internal Validity
I1NecessityPCEvery head is knocked out by resampling and the tests bite
I2SufficiencyPCEverything outside the eight heads is ablated and reported straight
I3MinimalityPCHeads are added rather than removed; one member is undercut anyway
I4SpecificityUMeasured on one behavior; head 1.4 alone is run off-distribution
I5Rival mechanism exclusionPCRivals are named first and the prompt set disables two of them
I6Double dissociationUNo second capability is shown intact while the docstring one fails
I7Confound controlPCLine counting and repetition are designed out rather than argued away
I8Confounding sensitivityUNothing asks how strong an unmeasured confounder would need to be
I9Epistatic interactionPCThe composition score is a two-head quantity, so interaction is the subject
I10Rescue reversibilityUThe restoring direction was run and not shown, by the author’s own account
I11Onset couplingUOne pre-trained model off the shelf; no training trajectory in evidence
I12Offset couplingUNeeds the training sequence that onset coupling also lacks
External Validity
E1Intervention reachPCFour do-operators beyond resampling, and they agree with it
E2Prompt generalizationDCircuit and model diverge on a subclass of benign inputs (uit de Bos & Garriga-Alonso, 2024)
E3Cross-task generalizationUWhether the components do anything for another task is never asked
E4Cross-model recurrenceUTransfer is named as future work and no result is reported
E5Graded responsePCCircuit size tracks performance monotonically across two axes
E6Novel predictionCA mechanism proposed for one reason predicts something else, and it holds
Interpretive Validity
V1Level declarationCA circuit is defined as a subset of components before any result
V2Level-evidence matchPCMatches the lower declared level and thins at the upper one
V3Alternative levelPCLine counting is raised as the simpler description, then accepted
V4Unlicensed labelingCEach label is introduced where its operation has just been measured
V5Scope declarationCThe limit is declared before the argument, not conceded after it
Total: 5 Confirmed, 15 Partially confirmed, 15 Untested, 1 Disconfirmed
Verdict: Causally Suggestive

An exploratory reading of this claim through the framework’s five lenses, written for this site and not part of the paper, is at Docstring Circuit — exploratory lens analysis.