chore: extract shared intervention-tier scaffolding#285
Open
RhizoNymph wants to merge 5 commits into
Open
Conversation
RhizoNymph
force-pushed
the
chore/intervention-scaffolding
branch
from
July 13, 2026 05:08
a4a1e3f to
5585cb2
Compare
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.
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_warmupwith Triton-version-tolerant compiled-variant accounting). The steering, monitor, and patch warmups keep only buffer allocation and a per-sizedrive(n)closure. Also fixes the patch copy's cache probe, which only read the pre-Triton-3.6cacheattribute and silently reported 0 variants on Triton 3.6.intervention_common.py—hook_attrs/derived_attrsfor the per-hook buffer attr-name dicts (values are agetattr-by-string runtime contract; now derived in one place), andBufferKnobfor config-first buffer sizing with a TEST-ONLY process-global fallback (backs the patch slot knob).phase_tiers.py— generic base/prefill/decodePhaseTierscontainer behindSteeringManager's global vectors; replaces the per-family phase if/elif ladder and clear-triple. Theglobal_*_vectorsattribute names survive as properties.validate_vector_entries— single vector-spec check core behind bothvalidate_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.pyand the kernel modules; clamping should rebase onto this and adopt the helpers.