Skip to content

v2.19.0

Choose a tag to compare

@torchlens-release torchlens-release released this 13 Jun 06:33
· 17544 commits to main since this release

v2.19.0 (2026-06-13)

This release is published under the Apache-2.0 License.

Bug Fixes

  • backend: Resolve pre-merge regressions (4096d30)

  • backward: Correct pass order and grad fn pairing (05ac5e9)

  • bench: Tolerate pre-existing two-pass limitation in capture benchmark matrix (aafb8c3)

The legacy two-pass benchmark cell calls save_new_outs under the hood, which raises 'computational graph changed' on models with in-place ReLU / batchnorm-eval (a pre-existing limitation, see tests/test_two_pass_inplace_fix.py, unrelated to capture unification). Record that cell as N/A with a note instead of hard-failing the informational matrix; assert only the cells that actually measured.

  • buffers: Scrub per-op equivalence lists on removal to fix RNN-cell crash (430357a)

An RNN cell that reassigns its hidden-state buffer in a loop around a submodule (self.h = f(cell(x), self.h)) crashed loop detection with "'buffer_1_raw' is not a known raw label during this forward pass". Buffer-version synthesis merges the initial buffer node, but the output node (which returns the buffer) still listed the merged label in its per-op equivalent_ops; loop detection then dereferenced the dead label mid-pass.

Root cause: _remove_log_entry_references and _batch_remove_log_entries scrub the global op_equivalence_classes map and Trace-level lists, but never the stored per-op equivalent_ops / recurrent_ops lists (both FieldPolicy.KEEP). Removing an Op left dangling references on surviving ops. Fixed generally with _scrub_per_op_equivalence_lists in both removal paths, closing the whole dangling-equivalence-reference class, not just this buffer case.

Also: - Add gradient-flow regression tests: tracing a recurrent reassignment model and a BatchNorm-train model must not break autograd (grads match an untraced run). The capture hooks are observational (snapshot detached copies; never replace the live grad-carrying buffer tensor). - Add the RNN-cell loop-detection regression test. - Glossary + docs lockstep: document buffer_write_kind, buffer_value_changed, is_buffer (stored flag behind the is_buffer_source property), and Module.buffers; fix a field-name reference in docs/buffers.md.

  • capture: Add backend alias contract (428d2f2)

  • capture: Add torch.sym_* ops to the ArgSpec lookup table (3d54f8c)

The meta-device capture tests exercise torch.sym_max/sym_float through PyTorch's symbolic-shape paths, and the session-wide ArgSpec coverage gate (test_lookup_table_coverage) flagged them as uncovered. Adds the sym family (sym_max/sym_min binary; sym_float/sym_int/sym_not unary) to the static table.

  • capture: Audit tensor kwarg arg specs (3faa7c9)

  • capture: Enforce layers_to_save matrix (3b3446f)

  • capture: Harden functorch wrapper tensor handling (661c9cd)

  • capture: Harden nested transform reconciliation (2303a52)

  • capture: Log untraceable vmap-built tensors as internal sources (8351477)

Transformers 4.5x builds the 4D causal/sliding-window attention mask via torch.vmap (_vmap_for_bhqkv). TorchLens deliberately skips logging ops that run inside a functorch transform, so the mask emerges fully-formed but untagged. When it first entered self_attn, the module-entry path synthesized a functionless intervention_replacement placeholder, conflating a plain-capture gap with a genuine user intervention.

Distinguish the two untagged-tensor cases by call site: genuine raw forward_hook output replacements are still tagged at module exit by the hook wrapper (intervention_replaced=True), so anything still untagged at module entry (or at a hook-free module exit) is an internally generated tensor. Log it as a clean graph source (is_internal_source, func_name none, no parents, no input ancestry, registered in internal_source_ops) instead of an intervention placeholder. Plain tracing of Mistral/VITS now yields zero synthetic intervention_replacement ops and the mask validates legitimately.

  • capture: Register no_grad_uniform in arg-spec lookup table (0d23cdb)

  • capture: Resolve backward taps on boundary aliases (f7de4d5)

  • capture: Restore trace predicate save path (1379c45)

  • capture: Survive meta-device tensors; extract kwarg tensors for matmul family (f9daf5f)

Device-context injection already ran on the active-logging path, but captured meta tensors crashed downstream wherever capture touched their (nonexistent) data: the content-hash save dedup called .cpu() on them, the aliasing mutation check and tensor_nanequal called torch.equal / .isinf(). Meta tensors now skip content dedup, report not-mutated, and compare equal in tensor_nanequal once shape and dtype match (there is no data left to differ). A model running under torch.device('meta') now traces end-to-end, including a meta factory tensor as the full-save model output.

Also fixes kwarg tensor extraction for functions whose ArgSpec named the wrong (or no) keyword args, so e.g. normal(mean=m, std=s) and addmm(input, mat1=a, mat2=b) record their kwarg tensors as parents: normal (mean/std), mm/bmm (mat2), mv (vec), addmm (mat1/mat2), addbmm/baddbmm (batch1/batch2), addmv (mat/vec), addcmul/addcdiv (tensor1/tensor2), lerp (end/weight). The broader ~637-function tensor_kwargs audit remains tracked separately; zeros_like/new_* factories dropping their source tensor is a known adjacent gap filed with it.

  • edges: Make branching_factor a coherent mean out-degree (c6ab0f8)

As shipped, branching_factor divided full-graph edge count (num_edges, over all nodes incl. input/output/buffer sentinels) by num_ops (compute-only node count), mixing two node sets -> a plain 4-op chain reported 1.25 instead of ~1.0.

Redefine as mean children per compute op (sum(op.num_children for op in compute_ops) / num_compute_ops): a single consistent node set, so the ratio is a true mean fan-out -- ~1.0 for a chain, >1.0 with reuse (residual/dense). Render the summary footer with .2f for readability. Glossary + tests updated to the hand-verified values.

  • export: Use is_trainable in param export schema (3858711)

The Param field was renamed trainable -> is_trainable during glossary conformance and the deprecation shim was removed (clean break). The param export schema in PARAM_LOG_FIELD_ORDER and Param.to_pandas already emit the is_trainable column, but the io export round-trip test still hard-coded the old 'trainable' column name in its stable-column list, causing KeyError: "['trainable'] not in index" for the csv/json and parquet cases. Update the test schema to is_trainable to match the canonical export column.

  • facets: Decouple fused-pattern error from HF internals (point at load-time eager); todo for deferred attention flag (1c59764)

  • io: Map orphan_records blob kind (fd45fcf)

  • perf: Add save modes (9a6ff79)

  • perf: Cache module code contexts (34332fa)

  • perf: Cache op code contexts (e1ecce2)

  • perf: Dedup saved activations by identity (f79d29e)

  • perf: Gate mutation alias checks (d09498e)

  • perf: Partition fallback arg extraction once (953757b)

  • perf: Reuse tensor metadata for memory accounting (c2387a0)

  • perf: Skip identity mutation comparisons (86de2cd)

  • postprocess: Bind buffer-only outputs; merge+check conditional metadata; sync to_pandas columns (6310f06)

Four tracked bugs plus review hardening:

  • A registered buffer returned directly from forward() without ever being touched by a traced op had no graph node, so the model 'traced' with no output layer and validate_forward_pass failed with 'No output layers found'. Output parent labels are now resolved explicitly before Step 0 (late-logging untouched buffers through the capture buffer-read pathway, memoized per tensor so a buffer returned twice binds both output nodes to one parent), and mixed attributed/unattributed output tuples keep exact positional alignment instead of silently shifting. - cond_branch_then_children-era conditional membership is now merged across passes on rolled Layers instead of taking pass 1's value. - Two new metadata invariants (14: conditional arm-entry edges must exist in the rolled topology; 15: per-op body roles must agree with conditional_branch_stack id+arm) strengthen the validation tripwire; nothing was loosened. - Trace.to_pandas() now derives its columns from LAYER_PASS_LOG_FIELD_ORDER minus a
    documented exclusion list, enforced by a test so new Op fields can never silently miss the table again; live-accessor fields (input_ops) are excluded so detached/disk-loaded traces still export (parquet round-trip covered).

An adversarial review of the diff found and we fixed: duplicate direct-buffer outputs crashing _fix_buffer_layers, and invariant 15 originally accepting body roles whose conditional/arm mismatched the stack. Streaming tests' monkeypatched _add_output_layers stubs updated to the new signature.

  • postprocess: Correct conditional evaluation entry edge (c13cf53)

  • postprocess: Repair predicate replay metadata (be03934)

  • recipes: Match DistilBERT FFN class under current and legacy transformers names (ea5dd69)

  • validation: Isolate ground truth mutable state (03ed5ba)

  • validation: Narrow backward backpointer carve-out to structural exemption (d11494b)

The layer-backpointer invariant skipped any layer whose GradFn backpointer was None, which admitted the legitimate mid-forward autograd.grad case but would also have masked a genuine pairing bug (the exact over-broad-carve-out pattern the tripwire principle forbids). A None backpointer now FAILS the invariant unless the layer structurally postdates every recorded backward trigger's forward boundary (trigger-time op count, tightened by paired root GradFns and observed op-gradient events). Output-alias backpointer projection is fixed rather than exempted, keeping the check strict for all pre-trigger layers. Corruption test: an artificially severed backpointer on a pre-trigger layer raises MetadataInvariantError; mid-forward cases stay green.

  • validation: Refuse sparse replay without child versions (9cba2be)

  • validation: Snapshot ground-truth outputs before state restore (39a5029)

validate_forward_pass saved ground-truth output tensors by reference, then called model.load_state_dict (which writes buffers in-place). When a model returns a registered buffer it reassigned mid-forward (e.g. recurrent state: return self.h), the saved ground truth aliased that buffer and was clobbered to its initial value on restore, producing a validation FALSE-NEGATIVE against an otherwise-correct captured/replayed graph. Snapshot (detach().clone()) each ground-truth output before the restore, mirroring the existing input deep-copy guard. Corrects the ground truth fed to the tripwire; does not weaken any check. Regression test added.

  • validation: Speed large graph validation (f6b7804)

  • visualization: Certify loop rolling sites by signature (bda642d)

  • viz: Emit sibling rank-groups at correct LCA cluster scope; strip cleanly; graceful top-level fallback (de0f95e)

Addresses code-review findings: preserve the edge module key before the has_input_ancestor loops clobber it (was forcing all rank-groups to top level); bracket strip markers around the rank-group subgraph so no empty wrapper is left on drop; replace the cluster-insert assert with a verify-safe top-level fallback.

  • viz: Keep loop rolling render cache off trace (df9d2e9)

  • viz: Merge recurrence back-edge and buffer-edge In/Out labels into midpoints (ee750b7)

Rolled-view pass labels collided where graphviz allocates no layout space for head/tail labels: anti-parallel recurrence pairs crammed four labels into the band between two near-touching edges, and buffer read/write edges did the same with dashed splines crossing their own labels.

  • Recurrence back-edges (structural step_index comparison) merge In/Out into one two-line midpoint label, like self-loops already did; graphviz reserves dummy-node space for midpoint labels, which also pushes the anti-parallel curves apart. Guarded so conditional/argname-labeled edges keep head/tail labels. - Buffer-incident edges always merge (single annotations become one-line midpoint labels): their read/write pair shares one narrow band. - One congested-forward-edge case (forward partner of a merged back-edge with an endpoint self-loop) merges for the same reason. - Remaining head/tail labels on >=3-op cycle bodies and oblique skip/approach edges carry audit-derived per-edge labeldistance/ labelangle; setting those attrs globally would switch graphviz to its inferior place_portlabel path, so they are applied only where the geometry audit showed wins. - Head/tail pad reverted 5->4pt, self-loop spacer 16->8pt (round-3 tuning that read clean; the larger values orphaned labels). -
    Module clusters carry margin=20 so borders clear inner labels.

Verified by an exact-geometry audit over dot -Tjson (0 violations across 16 demo graphs, from 12 at baseline) and independent Opus + Codex visual review (both satisfied, every label inspected at zoom).

  • viz: Merge recurrence self-loop In/Out into one midpoint label (85ad4b2)

A rolled recurrence self-loop previously carried separate head/tail In/Out pass-range labels, which graphviz places near the node endpoint without reserving space, so they crowded the node corner. Self-loops never carry argument or conditional labels, so the In/Out ranges are now merged into a single midpoint label, which graphviz models as a dummy node and reserves layout space for, eliminating the overlap. In is placed above Out for the default bottom-up layout and flips for top-down, and the label font is harmonized with the head/tail labels. Non-self-loop edges keep separate head/tail labels (those edges may also carry argument/conditional midpoint labels a combined label would collide with).

Threads rankdir through _add_node_to_graphviz/_add_edges_for_node to order the combined label. Updates the self-loop test and adds an orientation-flip test.

  • viz: Pad rolled head/tail edge labels with a blank line above and below (e93f254)

Head/tail (In/Out) labels are not allocated layout space by graphviz, so they crowd the node where an edge attaches -- worst where an edge meets a node at an oblique angle, and where an antiparallel recurrence pair lands an In and an Out label at the same node. Pad each non-self-loop In/Out label with a blank line above and below (keeping the horizontal spaces): the blank lines push the visible text along its edge, away from the node, and keep the two labels of an antiparallel pair on separate lines. Self-loops keep their combined midpoint label and are unaffected.

Adds a regression test for the blank-line padding and notes it in the demo README.

  • viz: Render atomic modules as rectangles; compose code panel side-by-side (31ceee5)

Atomic (single-op leaf) modules now render as module-marked rectangles at every call depth instead of ellipses or box3d collapses. The is_atomic_module flag was dormant because its capture-time detector was stubbed to return False; atomicity is now computed in postprocess from the op->module map (a module is atomic iff exactly one op has it as its innermost module), which correctly handles multi-op leaves with side ops such as a BatchNorm num_batches_tracked increment. Atomic modules never collapse to box3d, and a reused atomic module carries its split call range on the @module marking (e.g. @relu:1 / @relu:2-4), never duplicated as a title count.

The source-code panel is now rendered as a separate SVG and composed beside the graph rather than injected as a graphviz subgraph, so it no longer distorts the graph's proportions: the graph DOT is byte-identical with or without the panel. PDF/PNG composition uses cairosvg (graceful fallback to the in-graph subgraph when unavailable); SVG composes directly.

Updates the module-containment snapshots (only is_atomic_module/atomic_module_call flip, no collateral), the atomic-classification and collapse tests, the loop-rolling tests and demos, and the demo README.

  • viz: Scope rolling render cache per-draw; preserve interleaved recurrence chains (98da988)

Two fixes from the final dual-lab review of the loop/module rolling feature:

  • Scope the rolled-view render memoization to a single draw() (ContextVar cache
    scope) instead of a trace-lifetime WeakKeyDictionary. Eliminates stale labels
    on re-render after an in-place structural mutation while keeping within-draw
    memoization. No trace mutation, no .tlspec leak, no fork inheritance.

  • Detect recurrence self-edges via real same-layer transitive dependency chains
    instead of pass_index+1 adjacency, so interleaved multi-site recurrences
    (e.g. 1->3->5 and 2->4->6) are detected (not dropped) and kept distinct in the
    collapsed view via chains=... metadata. Single-site and no-spurious-edge
    guarantees preserved.

  • viz: Set sibling-ordering decision on every engine path (941d494)

The rank-layout early return skipped the dot-only sibling-ordering post-pass without setting _last_sibling_ordering_decision, so traces rendered via auto-rank lost the attribute (DenseNet now crosses the cost threshold post-ELK-retirement and broke test_densenet_is_safe_noop). The trivial decision is now set before the engine branch; the DenseNet test pins vis_node_placement='dot' to keep exercising the ordering pass it was written for, and a new test locks the rank path's trivial decision.

  • viz: Simplify rolled-view labels; restore clean recurrence self-edge (d050164)

Cleanup after visual review of the loop/module-rolling feature:

  • Restore a clean self-pointing recurrence arrow (plain self-edge, no glyph/icon,
    no pass-range labels); only for genuinely recurrent rolled nodes, not fan-outs.

  • Atomic single-op modules keep their op appearance when collapsed (no @module
    relabel, no cluster box) -- a 1-op module is already maximally collapsed.

  • Remove the arcane label vocabulary (N sites, xN multiplier, mixed/parallel
    facet, sites?) and ~1000 lines of supporting machinery; never show a redundant
    count AND call-ranges together (count-alone, or colon ranges e.g. linear_1_1:1,2-4).

  • Buffers use @State:1-N colon syntax.

  • viz: Size code panel to real monospace metrics; wrap lines past 120 chars (8fa0907)

Graphviz lays out the panel HTML table with fallback Courier metrics (~0.483 em/char at 14pt) while SVG rasterizers resolve the same family to a real monospace font at ~0.60 em/char, so the panel box was ~22% too narrow and long source lines clipped at the panel's inner edge.

The panel now injects an explicit minimum TD WIDTH computed from monospace math (0.62 em/char incl. safety margin) over the longest displayed line, and lines beyond a 120-char cap get indent-preserving hanging wrap instead of clipping (widest demo line is 79 chars, so the committed demos never wrap). Both the composed and in-graph fallback panel paths share the sizing. Graph DOT stays byte-identical with and without the panel (existing lock test). Verified by geometry tests over the panel SVG and zoomed visual inspection of the three longest-line demos.

Chores

  • Archive 2026-06-11 bug-fix sweep in todo tracker; refresh stale items (a141b1d)

Ten fixed bugs moved to Completed with commit refs; ARG-KWARGS rewritten as partial (symptom set fixed, audit remainder enumerated); RNG-MULTI-GPU marked hardware-blocked, ELK bugs deferred into ELK retirement, the non-registered-mutable-state validation item marked as needing a design call; the four suspected-stale items from the 06-10 audit hands-on verified and refreshed (facets follow-ups, fastlog ergonomics names, performance-docs API spellings, multi-output audit overlap).

  • Archive completed items from todo tracker (2026-06-10 audit) (a7b7c3e)

Cross-referenced every open section against the repo and git history; 22 verified-done items moved to Completed (recent) in condensed form with commit evidence (capture-path unification, IR-only OpEvent hot path, loop/module rolling reconciliation, MLX backend, bfloat16 tolerance fix, quantized-tensor crash fix, retired-attr label bugs, num_edges, and friends). Two sections partially annotated (save-selection unification residuals, post-2.0 follow-ons a/c/f/m/n/o). Quick index regenerated; everything without hard fix evidence kept.

  • Refresh todo tracker index; file code-panel line-truncation todo (3324f1a)

  • notebooks: Remove superseded botched total_audit series (9a32400)

  • perf: Mark fixed tracker backlog (a25a46a)

  • perf: Repair benchmark harness profiling (83623cd)

  • perf: Scrub unsaved lookup scratch (f44db1c)

  • perf: Update build state (0bec695)

  • perf: Update build state (a0d440e)

  • perf: Update build state (88f568f)

  • perf: Update build state (49bb1c4)

  • perf: Update build state (a41fe3d)

  • perf: Update build state (8ed7a4c)

  • perf: Update build state (f6b6902)

  • perf: Update build state (81b6227)

  • perf: Update build state (50f518c)

  • perf: Update build state (87b0d76)

  • perf: Update build state (1c48e5d)

  • perf: Update build state (ca737e9)

  • repo: Gitignore notebooks/audit/_artifacts (6224bcb)

  • repo: Untrack agent scratch dirs, gitignore .research/ and .project-context/ (9be91fe)

Stop tracking internal sprint notes, plans, audits, and logs that do not belong in the public repo (files remain on disk locally). Keep the two architecture maps AGENTS.md links to: architecture.md and state_of_torchlens.md.

  • spike: S0.g tinygrad discovery round 1 (7b509a5)

  • spike: S0.g tinygrad discovery round 2 (4c2ccd0)

  • spike: S0.g tinygrad discovery round 3 (f43ddbe)

  • spike: S0.j jax feasibility round 1 (b163286)

  • spike: S0.j jax feasibility round 2 (e8ae430)

  • test: Nest loop_module_rolling demos under test_outputs/visualizations/ (76da6a3)

Match the existing test_outputs/visualizations/ convention instead of a top-level sibling folder; update OUTPUT_DIR accordingly.

  • todo: Jax/tinygrad plan converged build-ready (13-round adversarial review) (cb8c12e)

  • todo: Resolve facets item 7 as anonymous facets; file partial-payload save policy (0d10810)

  • todo: Route resolved-access-vs-label-storage to the accessor audit (0b23dbc)

Captured from the facets-followup riff: storage stays label-based (settled), but whether label-fields get parallel resolved-access properties is a package-wide accessor-audit decision, not a per-class bolt-on.

  • todo: Verify tracker against shipped backward+perf sprints; regenerate quick index (c6a0b74)

  • todos: Buffer-sprint design todos (rolled-view collision, op-subclass refactor, loop-indexing revisit, densenet) (65b7529)

  • todos: Code-verified reconciliation, mark shipped items done (c7e303b)

  • todos: Mark buffer WRITES/OVERWRITES capture done (shipped 2026-06-05) (ef80636)

  • todos: Mark class de-Log rename done (shipped); narrow naming-pass residual (7e182af)

  • todos: Mark distilbert_ffn recipe bug fixed (ea5dd69) (d98f57c)

  • todos: Mark glossary conformance done, log distilbert_ffn recipe bug (adb4e0f)

  • todos: Slice/facet/outs integration note, ELK removal findings, viz themes, num_edges (b32649b)

  • types: Clear pre-existing mypy errors (type-only, no behavior change) (cf6e80e)

Code Style

Documentation

  • Lock validation-integrity principle (validation is a tripwire, never bandaid) (6e5fa22)

  • Update agent-guide examples and record names to current trace API (6c328bf)

Replaces removed log_forward_pass/vis_opt examples with tl.trace, fixes the stale activation accessor (now .out) and the broken live-hook intervention pattern (use a capture-time selector tl.func instead of a finalized label), and updates entry-point and record-class names (trace and draw_backward; ModelLog/LayerLog/LayerPassLog become Trace/Layer/Op). Also lands the glossary and docs lockstep principle section.

  • backend: Lock docs to backend substrate (0f91191)

  • backend: M0.1a artifact 1 — invariant contract (e44f768)

  • backend: M0.1a artifact 2 — public-surface-kwarg-backward-matrices (74f20a0)

  • backend: M0.1a artifact 3 — serialization-contract (72a35cc)

  • backend: M0.1a artifact 4 — BackendSpec registry migration map (15dbfb3)

  • backend: M0.1a artifact 5 — docs-glossary-change-list (eadc8f6)

  • buffer: 4-agent research findings + Phase-2 write-capture plan + run-state (81e8118)

  • buffer: Add docs/buffers.md explainer to v5 build spec (81d5c09)

  • buffer: Buffer-sprint design spec v1 (entity + one-node-per-version + dual-label) (52c0575)

  • buffer: Mark Buffer Option B shipped; run summary + state (56f856b)

  • buffer: Overnight wrap-up — P1 shipped, validated write-capture design (deferred), gaps documented (6072221)

  • buffer: Plan v3 — postprocess-synthesis design (option-a version nodes, end-of-pass snapshot, no hot-path detector) (5835538)

  • buffer: Plan v4 — option-2 capture-at-the-moment (scoped setattr + post-op value-check) (2638053)

  • buffer: Plan v5 BUILD spec — option-2 validated by both labs, all fixes folded in (e393f3d)

  • buffer: Round-1 dual-lab review findings + scope decision (write-capture gap; descope recommended) (ac170ff)

  • buffer: Track edges-proposal working doc (2b1480f)

  • buffer: V3 confirm round evidence (both labs NOT bulletproof); alpha/beta/hybrid fork open (0ed4a7f)

  • buffer: V4 review — both labs validate the approach empirically; 3 blocking engineering fixes each (af36862)

  • capture: Add performance and agent guides (595613d)

  • capture: Add torch func transform example (d809cdc)

  • capture: Document unified capture API (04bc6e5)

  • examples: Port examples to 2.0 API (63cc773)

  • facets: Add runnable tutorial notebook (3db2d05)

  • facets: Canonical glossary lockstep for P1 spec model (FacetSpec, MissingGradient, capability classes, registry scoping) (c9ef746)

  • facets: Merge tutorial notebook (de29cb7)

  • facets: Sprint complete — P1-P4 + notebook shipped to local main; summary, todos, residuals (a475abe)

  • facets: Sprint state — P1+P2 done, P3 dispatched (dde243b)

  • facets: Sprint state — P3 done, P4 dispatched; note auto-eager residual (100cfc0)

  • glossary: Mark residual lock set resolved (code fully conforms) (32021bb)

  • glossary: Reconcile to shipped code (75b0d50)

Diff the glossary's documented PUBLIC API against the shipped code surface and reconcile the parts that are unambiguous:

  • Trim the ModuleCall and Module Output Passthroughs sections to what the code exposes (out/outs, out_shape/out_shapes, out_dtype/out_dtypes for ModuleCall, grad/grads). Drop the bare and transformed memory passthrough lines per the locked module-scope memory decision; point readers at the prefixed memory cluster instead. - Remove the false tl.log_forward_pass alias claim from the auto-routing section (no such alias exists; the entry point is tl.trace). - Add a reconciliation note to the top banner recording the above and FLAGGING a residual set of lock-backed naming targets that the shipped code never implemented (is_module_input, input_to_module_calls, args_summary/kwargs_summary, grad_fn_label, multi_output_type, the atomic_module resolver cluster, gradient_transform, has_saved_gradient, Param.is_trainable, the Buffer overwrite cluster, Module total_flops/total_macs/internal_param_memory, call_parent_address). These are logged LOCKED in the walkthrough deltas, so they are code fixes
    pending a JMT decision, not glossary deletions.

  • notebook: Add capture unification demo (79085c9)

  • notebook: Finalize HF tutorial on current trace API (4f1b34f)

  • notebooks: Add audit series batch 1 (d48abeb)

  • notebooks: Add audit series batch 2 (d29b9e8)

  • notebooks: Add audit series batch 3 (cfdf1d5)

  • notebooks: Expand coverage round 2 (7b79864)

  • notebooks: Fix review round 1 (108b645)

  • notebooks: Fix review round 3 (4c36d2e)

  • notebooks: Update audit series to v7 API (e2247f7)

  • readme: Showcase multi-backend, backward, intervention, and perf capabilities (579d3d0)

  • test: Update loop-rolling demo README and tracked fixture for merged labels (473f01a)

Label Contract rewritten for the final scheme: HTML head/tail labels with an even transparent margin on varying forward edges; In/Out merged into midpoint labels for self-loops, recurrence back-edges, buffer read/write edges, and the congested-forward case (graphviz reserves layout space for midpoint labels, which head/tail labels never get); placement fine-tuning is audit-driven via tests/test_label_geometry.py. Removed the stale -Tplain two-pass paragraph. Per-demo label descriptions re-verified against freshly regenerated renders; two_distinct_loops.svg is the tracked fixture regeneration.

  • todos: Edges mini-sprint proposal; defer Edge-as-object with rationale (f5aec56)

  • viz: Sibling-ordering design (v4, 3-round dual-lab review) + impl spec; densenet todo (cb9d670)

Features

  • backend: Add backend registry with explicit backend= routing (37e2553)

  • backend: Add neutral trace metadata fields (d04f265)

  • backend: Complete registry migration audit (6b7d6ad)

  • backend: Prove fake backend trace roundtrip (58fa891)

  • backend: Route torch capture through registry-owned entry (77b7f08)

  • backward: Add backward visualization controls (50e6d9f)

  • backward: Add differentiable replay (a64b7af)

  • backward: Add higher-order trigger attribution (51cfa63)

  • backward: Add module containment projection (acf15ea)

  • backward: Add per-pass gradient payload records (b2cccd2)

  • backward: Add runtime sidecar event foundation (30b4989)

  • backward: Complete fastlog gradient cleanup (6e1efc5)

  • backward: Complete higher-order attribution (446f296)

  • backward: Complete tlspec docs and reports (022d7c0)

  • backward: Finish save_grads payload policy (b62d6d4)

  • backward: Finish sidecar schema cleanup (0732a4a)

  • backward: Finish sidecar trigger foundation (16e960b)

  • backward: Finish trace grad cleanup (ea57407)

  • backward: Materialize projection records (176a0d9)

  • backward: Persist per-pass grad records (13ccde7)

  • backward: Project transformed grad payloads (0b0b0ac)

  • backward: Remove trace gradient aliases (b3c32ce)

  • backward: Strengthen validation tripwires (e1576bf)

  • backward: Switch trace grad saving to save_grads (d33f11a)

  • backward: Unify recording gradients on sidecar (5543dbf)

  • buffers: Add persistent buffer entities (5c292f4)

  • buffers: Capture registered buffer write events (91e1645)

  • buffers: Synthesize buffer version nodes (18b16c5)

  • capture: Add captured run projections (4bab16b)

  • capture: Add retroactive lookback save (aaa5dcf)

  • capture: Add torch func transform boundaries (73933bd)

  • capture: Add trace predicate save runtime (dfa0975)

Adds trace(save=predicate) on the exhaustive path using the shared RecordContext builder also used by fastlog predicate capture. Existing selector sugar is callable on RecordContext, so tl.func and tl.in_module can serve as both selectors and predicate predicates. Unsaved predicate-filtered ops raise a clear not-saved error on finalized out access.

  • capture: Capture autograd functional transforms (f148983)

  • capture: Centralize storage axis; trace can stream to disk (ffc6ce1)

Lifts the fastlog storage router (RAM/disk-stream/drop, detach/copy policy) into the shared single-pass save engine so trace(save=..., storage=to_disk(path)) streams predicate-selected payloads to a disk bundle during the forward. Centralizes the compatibility rules (disk-only rejects keep_grad and backward_ready; disk mirrors are detached). Lazy load of disk-backed payloads via the Layer/Op out accessor. Predicate save plus storage=to_disk is the supported streaming path. Phase-6 disk-streaming tests.

  • capture: Emit module phase zero events (e5a96b5)

  • capture: Enrich op events for phase zero (d7f5db9)

  • capture: Plumb transform metadata (3978a4e)

  • capture: Unify intervention onto the predicate runtime (a3cf73d)

Adds an intervene= slot to trace()/record() evaluated by the shared RecordContext predicate runtime, composing with save= in one pass. InterventionDecision is the active-action parallel to CaptureSpec; tl.when/add/replace_with sugar normalizes the existing zero_ablate/scale helpers. Wires to the existing live-hook execution path (no reimplementation); Bundle/Super*/facets stay a separate layer above predicates. Saved payload at an intervened op is the post-hook tensor; re-run is deterministic. Includes phase-5 intervention+save invariant tests.

  • capture: Warn on unattributed tensor args (d815565)

  • data-classes: Add edge-count introspection (dc370e6)

  • debug: Add nan bisection and hot path utilities (b28cca9)

  • export: Add record tabular export quartet (c5b7116)

  • facets: Add facet intervention scatter-back (9221e30)

  • facets: Add p1a registry snapshots (77b63c2)

  • facets: Add p1b facet specs (7df3213)

  • facets: Add patching helpers (d4d37e6)

  • facets: Broaden head-count inference + clarify fused-pattern-is-read-only-by-design (c91551f)

Broaden attention head-count probing (_HEAD_COUNT_NAMES/_KV_HEAD_COUNT_NAMES/_HEAD_DIM_NAMES, incl. n_head/nhead) so nn.MultiheadAttention and conventionally-named custom modules infer heads automatically via config_value (reads custom_attributes). Sharpen the fused-pattern MissingFacet message: read via reconstruction_ready; to EDIT, capture eager (consistent baseline), reconstructed pattern is read-only by design. Doc note on the config_value(module, ...) authoring pattern.

  • facets: Implement phase 3 semantic facets (445e20a)

  • facets: Migrate p1c recipes (79581fc)

  • io: Add backend-aware tlspec schema v2 preflight (84f3508)

  • ir: Add MLX deferred value sentinel (9a9bbe3)

  • jax: Add derived gradient preview (7a233dd)

  • jax: Add jaxpr-first forward capture core (4e9d14a)

  • jax: Add validation tripwire (35bf43b)

  • jax: Harden capture corpus coverage (21c9305)

  • jax: Harden preview surface and docs (c23e202)

  • jax: Preserve output pytree paths (f387dbb)

  • jax: Support declared static args (b5ad671)

  • mlx: Emit topology-complete capture events (d5f2e17)

  • perf: Add raw rerun shape hash (2b58e1f)

  • perf: Add record halt predicate (f1c0865)

  • perf: Add trace halt predicate (d589c1c)

  • perf: Fast-path halt-only capture (eed49d5)

  • perf: Fast-refresh matching reruns (5e619a8)

  • perf: Release param refs after finalization (89e412a)

  • perf: Shallow-fork differentiable replay (58ccbfe)

  • quantities: Add tl.Quantity and Bytes, migrate memory fields to Bytes, drop memory str fields (318d0b4)

  • quantities: Finish v7 numeric quantity migration (8a71c6d)

  • records: Add glossary convenience properties (837e9db)

  • records: Add structural glossary fields (d1ea23a)

  • tinygrad: Add bracketed derived grads (c9c04a1)

  • tinygrad: Add forward UOp capture core (f55e121)

  • tinygrad: Harden preview surface and docs (acc2ca6)

  • tinygrad: Harden validation tripwire (d7741a4)

  • trace: Expose recurrent layers accessor (1131ccc)

  • viz: Deterministic execution-order placement of parallel siblings (ddf16d5)

  • viz: Reconcile rolled loop and module labels (c9889e0)

  • viz: Render rolled recurrence self edges (16957e4)

  • viz: Retire ELK/sfdp layout backends; promote pure-Python rank layout (b2ec033)

The ELK escape hatch (Node.js+elkjs subprocess, 1585 lines) fired above a 3500-node threshold, but benchmarking showed dot's cost driver is long-range edges, not node count: local-topology graphs render fine at 5k nodes (13.7s) while one hub node feeding 24 spread consumers hangs dot even at 1k. The threshold was aimed at the wrong variable, the ELK path had rotted (missing conditional labels, code panel, current label work; elkjs not even installed on the dev box, so users silently got the sfdp fallback), and a zero-dependency pure-Python Kahn rank layout already existed for the >100k tier.

  • _elk_internal deleted; _rank_layout_internal keeps the Kahn layout + direct-SVG writer (render_rank_layout). - Engine selection: vis_node_placement = auto (default) | dot | rank. auto estimates layout cost as num_nodes + sum of rank spans of edges spanning >12 ranks, and switches to rank above 20,000 (calibrated 2026-06-11: local-5k stays dot, hub-3.5k switches), with a notice explaining the choice and remedies. - elk/sfdp values removed outright (no deprecation period): invalid values raise the standard ValueError. - tests/test_large_graphs.py rewritten against rank layout (scale ladder to 1M nodes, auto/manual selection, removed-value rejection, SVG sanity); docs swept (docs/elk_setup.md -> docs/rank_layout.md).

Performance Improvements

  • backward: Add tensor grad hook opt-out (decbc6e)

  • capture: Fold multi-output output partitioning (82d9c24)

  • capture: Streamline exhaustive field copies (8421ada)

  • postprocess: O(v+e) input/output distance flood; enable by default (4676f26)

Refactoring

  • capture: Replace live op records with event index (e60300f)

  • data_classes: Drop _log suffix from record module filenames (362d52f)

  • export: Remove deprecated tabular exporters (76c9d68)

  • glossary: Finish B1 conformance (a4878ae)

  • ir: De-torch capture predicate schema (1c940f3)

  • postprocess: Build Op from events only in Step-0 materialization (b20f32b)

materialize_from_events now constructs each raw Op's fields from OpEvent + sibling events (module/buffer/version) + deferred edge joins, with zero live_record.fields reads. Live-record construction stays (dual-emit) so the legacy path remains the byte-identical oracle for this phase. Adds event payloads needed for parity: module input labels, module output names, input tensor addresses, child-version propagation onto the replacement OpEvent. Includes phase-1 A/B parity tests.

  • records: Add canonical-glossary public names to record classes (bdf4f23)

Implements lock-backed public names from the canonical glossary: is_trainable, is_module_input/is_module_output, input_to_modules, atomic_module family, args_summary/kwargs_summary, grad_fn_label, Layer op_labels/total_func_duration/ internal_param_memory, Module total_flops/total_macs/total_param_memory/ call_parent_address/call_children_addresses, and the Buffer overwrite cluster (is_overwritten/num_overwrites/last_overwrite_source) derived from buffer_source. Smoke green. Clean-break old-name removal and file renames follow.

  • records: Drop bare out_memory passthroughs at module scope (a213ac2)

Remove ModuleCall.out_memory / out_memories. The locked decision is that module-scope memory is covered by the output_/internal_-prefixed cluster (output_activation_memory, internal_activation_memory, output_gradient_memory, internal_gradient_memory, autograd_memory, param_memory), which is unambiguous about the boundary-vs-internal distinction. The bare out_memory passthroughs duplicated output_activation_memory under a less precise name.

Also drop the now-dead out_memory fallback in rendering when computing a collapsed module box label; the module output layer exposes activation_memory.

  • records: Drop conformance shims for clean break (01ac105)

Removes the deprecation-alias shims the conformance work had added (Param.trainable, Op.is_submodule_input/is_submodule_output, Module.flops/macs/flops_forward/flops_backward/ macs_forward/macs_backward) so the renamed glossary names are the only surface. Per the clean-break decision: no shims. Migrates remaining test references to the canonical names (is_trainable, Module.total_flops/total_macs family). Affected tests green.

  • records: Remove glossary-confirmed-removed fields (01531c6)

Testing

  • Lock in func-loc leak, barcode hash, and validate state-restore fixes (648837a)

The FUNC-CALL-LOC-LEAK, HASH-COLLISION, and VALIDATE-STATE-RESTORE bugs from the tracker were already fixed in the 2.0 overhaul (b55e16b phase 14) but had no dedicated regression coverage. Twelve tests now lock: FuncCallLocation retains no function-object reference after construction while lazy .source still loads (incl. pickle round-trips and the source_loading_enabled=False path); make_short_barcode_from_input is deterministic across processes/PYTHONHASHSEED and collision-free over a 40k structured-input scan (the old salted-hash barcodes leaked into persisted .tlspec op_kind via equivalence_class, so cross-process artifact comparability depends on this); validate_forward_pass restores bit-exact model state when the forward raises on either the ground-truth or traced call, via a detached-clone snapshot.

Also corrects the hashing module docstring: barcodes derive from shape/dtype/scalar tokens, not param data pointers (params are excluded).

  • api: Account for transform selector export (101d3c0)

  • backend: Add torch parity gates (9af28d7)

  • buffers: Cover buffer datamodel integration (6e3a291)

  • capture: Align factory and validation tripwires (f62fff7)

  • capture: Cover all pass layer saves (5ad069e)

Implements the approved 2026-06-06 behavior change for legacy layers_to_save resolution: an unqualified repeated layer or module label saves every pass, while a pass-qualified label such as attn:2 saves only that 1-based pass. No validation or replay tripwires were loosened; the regression test updates the expected behavior because first-pass-only was the old behavior being replaced.

  • capture: Cover captured run phase seven (69192e6)

  • capture: Cover functional call attribution (b7e7901)

  • capture: Cover phase 3b retention (0c70c1a)

  • capture: Cover retroactive lookback save (5eb7c9f)

  • capture: Cover transform selector persistence (2dbd07a)

  • capture: Gate event-only forward capture (42df084)

  • capture: Preserve orphan factory coverage (4d64c08)

  • ir: Include transform event defaults (1f733bb)

  • perf: Add P6 regression gate harness (7999d0a)

  • realworld: Update transformers configs (41c7c9e)

  • report: Account for transform selector export (fedc229)

  • validation: Arm tripwire for functionless capture placeholders (edd2b3a)

Add a regression test asserting that plain tl.trace of a fully-traceable model produces zero functionless intervention_replacement ops, so a future capture gap fails loudly. A self-contained _VmapMaskModel reproduces the mechanism (a mask built inside torch.vmap entering a submodule untagged) without any optional dependency, and a transformers-gated Mistral case exercises the real reproducer. Both assert the mask is logged as an internal source and that validation passes legitimately. Confirmed the test fails if the placeholder behavior is reintroduced.

  • validation: Avoid brittle nested transform labels (f2bc32b)

  • viz: Cover loop module rolling reconciliation (6d65ac2)

  • viz: Rewrite rolled label tests; add label-geometry regression gate (6484cde)

The four stale tests asserted the deleted plain-text newline-padded label format. Rewritten against the merged-midpoint scheme: self-loop and back-edge merges, rankdir line-order flip, buffer-edge one/two-line midpoint labels, and HTML head/tail labels on varying forward edges (asserting semantics, not tunable constants).

tests/support/label_geometry.py promotes the sprint's audit harness into the suite: it parses dot -Tjson layout into exact glyph bboxes, node outlines, edge splines, and arrowhead polygons, and reports label-label, label-node, label-spline, label-arrowhead, and label-cluster-border penetrations. tests/test_label_geometry.py renders all 16 rolled demo models and asserts zero violations (plus a negative control proving the gate detects a planted overlap), so future label/layout regressions fail with exact geometry instead of waiting for a human eye.


Detailed Changes: v2.18.0...v2.19.0