Skip to content

chore: extract shared intervention-tier scaffolding#285

Open
RhizoNymph wants to merge 5 commits into
feat/integrationfrom
chore/intervention-scaffolding
Open

chore: extract shared intervention-tier scaffolding#285
RhizoNymph wants to merge 5 commits into
feat/integrationfrom
chore/intervention-scaffolding

Conversation

@RhizoNymph

Copy link
Copy Markdown
Owner

What

Extracts the payload-agnostic scaffolding that the steering and patching tiers each hand-copied (and that feat/clamping would have copied a third time):

  • intervention_kernel_common.py — one kernel-warmup harness (normalize_warmup_sizes + run_kernel_warmup with Triton-version-tolerant compiled-variant accounting). The steering, monitor, and patch warmups keep only buffer allocation and a per-size drive(n) closure. Also fixes the patch copy's cache probe, which only read the pre-Triton-3.6 cache attribute and silently reported 0 variants on Triton 3.6.
  • intervention_common.pyhook_attrs / derived_attrs for the per-hook buffer attr-name dicts (values are a getattr-by-string runtime contract; now derived in one place), and BufferKnob for config-first buffer sizing with a TEST-ONLY process-global fallback (backs the patch slot knob).
  • phase_tiers.py — generic base/prefill/decode PhaseTiers container behind SteeringManager's global vectors; replaces the per-family phase if/elif ladder and clear-triple. The global_*_vectors attribute names survive as properties.
  • validate_vector_entries — single vector-spec check core behind both validate_steering_vectors (drain path, reject unknown layers) and _validate_vectors_spec (HTTP path, skip unknown layers under TP). Message texts and strictness are per-caller data, so the two paths can no longer drift on check logic.

Why

Clamping (feat/clamping) and the SAE branches behind it instantiate the same tier template; the copies were already drifting (the Triton 3.6 cache probe above, and the two vector validators disagreeing on unknown-layer handling). This lands the shared scaffolding on feat/integration so those branches adopt it on rebase instead of adding third/fourth copies.

Pure refactor — no behavior change: public names, signatures, tested attribute names, buffer attr-name values, and error texts are preserved.

Note: expect merge conflicts with feat/clamping in steering_manager.py / steering_model_runner_mixin.py and the kernel modules; clamping should rebase onto this and adopt the helpers.

@RhizoNymph
RhizoNymph force-pushed the chore/intervention-scaffolding branch from a4a1e3f to 5585cb2 Compare July 13, 2026 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant