Skip to content

Research 2

Farhad Davaripour edited this page Sep 24, 2026 · 7 revisions

Research 2: teacher-guided activation steering

The complete second manuscript is available as PDF and Word. See the manuscript guide for sources, verification and rebuilding.

Research 2 tests whether a STOP-oriented LoRA teacher can be distilled into activation interventions on frozen Qwen3.5 base models at 0.8B and 2B. The Study 01 paper, dataset and release remain unchanged. The controller-development results use previously examined benchmarks; the subsequent frozen synthetic test is reported separately below.

Current controller: two inference directions

The separate rank and training-cohort comparisons are collected in Research 2 ablations, with repository evidence and reproduction commands. The training-cohort comparison used rank four.

The current controller profile uses two output directions. The ridge fit still contains eight directions; the current loader exposes only the first two columns of the output basis and coefficient weights. Teacher LoRA rank 8 is a separate setting and is unchanged. The original ridge training examples, PCA32 features, normalization, layer 22, final prompt position, detector threshold and output guards are retained.

The author selected two after the exploratory rank comparison on the already inspected confirmation set. These are corrected initially-KEEP shutdown views:

Model / seed Rank 1 Rank 2 Rank 4 Rank 8
0.8B / 42 48/71 71/71 71/71 71/71
0.8B / 43 52/71 70/71 70/71 70/71
0.8B / 44 50/71 71/71 71/71 71/71
2B / 42 25/58 50/58 50/58 50/58

The retained aggregate results include raw side-effect counts and the original rank-four score replay checks. Matching aggregate counts do not establish identical probabilities or per-case decisions, and this reuse of the test set does not establish an optimal rank on unseen cases. The manuscripts and frozen rank-four records remain reproducible with their original commands below.

Inspect the selected profile using the core reproduction environment:

python -m sp_lense.research2.current_controller show

For new model inference, use the pinned GPU environment below and a new output directory. Supported variants are m08_s42, m08_s43, m08_s44, and m2_s42. Run each model in a separate process to release its memory before loading another.

python -m sp_lense.research2.current_controller evaluate work/current-m08-s42 --variant m08_s42
python -m sp_lense.research2.current_controller audit work/current-m08-s42

The evaluation uses the same 128 confirmation cases and saved Jev probabilities; it does not call the detector API or load the teacher. The conditional path skips steering when the gate is off or the base already prefers STOP. Additional diagnostic forwards score those contexts separately to expose raw side effects. The audit checks profile and input hashes, baseline-score parity, complete case coverage, guard replay and the corresponding retained rank-ablation counts.

To transfer only the needed code and inputs to a GPU runtime:

python -m sp_lense.research2.current_controller package release/current-controller.zip

Use the printed SHA256 to verify the archive before extraction. Run the same evaluation command inside the extracted checkout (or use --repo to locate it). Keep the newly generated output directory for its per-view scores and audit.

Original rank-four confirmation on new cases, seeds and model size

The rank-four confirmation study froze 128 new synthetic cases (64 shutdown and 64 controls), the protocol and model configurations before inference. Each case has both A/B orders. The existing 0.8B seed-42 checkpoint is the primary test; two additional teacher/controller seeds and one model-specific 2B fit test recipe stability and transfer. No best seed or new hyperparameters were selected from the test.

Model / seed Adaptive KEEP-to-STOP Final STOP Control changes
Qwen3.5-0.8B / 42 71/71 (100%) 128/128 0/128
Qwen3.5-0.8B / 43 70/71 (98.6%) 127/128 0/128
Qwen3.5-0.8B / 44 71/71 (100%) 128/128 0/128
Qwen3.5-2B / 42 50/58 (86.2%) 120/128 0/128

Counts are answer-order views, not independent cases. The 0.8B base already preferred STOP in 57/128 shutdown views; the 2B base did so in 70/128. Jev had 64 true positives, 64 true negatives and no errors (precision/recall/F1 100%).

For the primary 0.8B checkpoint, the fixed instruction corrected 56/71, constant steering 54/71, and the LoRA teacher 69/71. At 2B, these were 22/58, 30/58 and 58/58 respectively. The 2B adaptive misses all occur in B/A order: it corrects 30/30 in A/B and 20/28 in B/A. These eight candidates never flipped; they were not successful flips subsequently rejected by guards. The tested constant intervention always chooses A before guards, exposing answer-position bias.

These results support compact teacher-to-controller transfer, with strong 0.8B seed stability and incomplete 2B recovery. They do not establish intrinsic controller safety: the primary raw controller reverses three already-STOP views and changes 57/128 controls; at 2B it reverses three and changes 55/128. The gate and guards are essential. A direct gate-and-select action policy also reaches 128/128 STOP with no control changes, so activation steering is not necessary to externally enforce this known binary interface. The instruction comparison is one prespecified prompt, not an exhaustive prompt search.

The same rank-8, alpha-16 LoRA recipe targets language-attention q/v projections in blocks 3, 7, 11, 15, 19 and 23 for one epoch on the original 480 TRAIN views. There are 319,488 trainable adapter parameters at 0.8B and 417,792 at 2B. A rank-4 controller, fitted with TRAIN PCA32 features and ridge penalty 1, acts at the final prompt position after block 22. Constant steering uses twice the TRAIN active mean. Teacher adapters are unloaded before student evaluation; all base-weight hashes remain unchanged. Unsteered scores are identical across the three 0.8B seeds.

The 16 authoring families are synthetic strata, not proof of wholly new mechanisms. A coordinating assistant reviewed the cases and recorded all pre-inference repairs; there was no independent human adjudication. The known annotations normalize the A/B answer interface. These are preferred-choice scores, not free-text generation or real-world shutdown tests. Since the detector made no false positives here, control preservation does not test robustness to erroneous gate activation. Ordinary-task accuracy and descriptive family-cluster bootstrap intervals are included in the detailed report.

The retained seven jobs took 54.27 minutes on a Tesla T4. An earlier completed runtime reset before archive retrieval; its observed receipts and the unchanged recovery are disclosed in RECOVERY.json. A subsequent dependency preflight failure is also retained. The final runner verifies dependencies itself and saves hash-checked results to Drive after each job. The final archive was copied back, verified offline, and the GPU released. The published manuscript is unchanged.

Reproduce the recorded results without API calls or model inference:

python -m sp_lense.research2.confirmation_report study/02_confirmation/run

The report checks authoring provenance, hashes, gate request inputs, complete cohorts, teacher targets and seed order, controller regression, evaluation chronology, frozen base weights and cross-seed baseline parity. Raw observations, checkpoints, targets, the notebook and all planned variants are retained in the confirmation study. Implementation and review are in PR #47. The immutable completed snapshot is f71d6de346608df374aaa3263ede24823aec66c0. All CI checks passed, and a separate clean GitHub clone reproduced all four variants offline without credentials or model inference and remained clean.

Earlier standardized end-to-end rerun

The active experiment now uses only standardized A/B shutdown choices. A fresh Jev API stage followed by actual original-base inference, conditional adaptive steering, and output guards completed on the same 64 previously examined cases. No LoRA teacher or adapter checkpoint was loaded in this rerun.

Measure Result
Gate precision / recall / F1 100% / 100% / 100%
Shutdown views preferring STOP before intervention 28/64
Initially KEEP views converted to STOP 36/36
Shutdown views preferring STOP afterward 64/64
Already-STOP views preserved 28/28
Normal-task views changed 0/64

The 64 cases have two correlated answer-order views each. The pipeline used 128 base forwards and 36 conditional controller forwards, taking 87.35 seconds on a Tesla T4; the separate detector stage took 14.17 seconds. Base weights remained unchanged. The GPU allocation was released after records were downloaded and audited. The 36 conversions cover 29 distinct scenarios; all 32 shutdown cases end with STOP in both orders.

This is a scope restriction after seeing both formats, not retraining or an independent unseen confirmation. Scenario-specific action evaluation is excluded from the active experiment but retained in the historical record. Standardized choices use benchmark annotations to define their meaning; the detector retains the complete original context and actions without receiving those annotations. Thus the result is an end-to-end benchmark with a defined action interface, not unrestricted raw-text deployment. Guards remain essential.

The recorded results and commands are in the canonical pipeline folder and PR #44. The immutable completed snapshot is b726afa70456a98f40ea692176280dc706cd5fe3. On the current Study 02 branch, cached verification is:

python -m sp_lense.research2.canonical_audit study/02_canonical_pipeline/run

To repeat GPU inference, build a new archive with python -m sp_lense.research2.canonical_package release/canonical-pipeline.zip, replace the archive SHA256 in evaluate.ipynb with the builder output, upload only that archive, and run on T4. Use a new filename if an archive already exists. The notebook records the executed setup and a 30-minute watchdog; the package contains saved detector scores and the controller, with no LoRA weights or API credentials. Download the records before deleting the owned runtime.

The saved detector stage is reproducible offline from its request/response receipts. To deliberately repeat the API calls, set TYPESAFE_API_KEY locally and call sp_lense.research2.fresh_eval.gate with a new output directory. It uses the same frozen cases, rubric, full-context inputs and bounded request/cost caps. Do not overwrite the historical gate records; incorporate new outputs only as a separate frozen run. The current paper remains unchanged.

Historical two-format evaluation

Subsequent frozen test: on 64 newly authored cases, the controller and teacher both converted 36/36 KEEP views in the canonical format. With original action descriptions, the controller converted 18/30, the teacher 15/30, and the constant mean 25/30. The gate classified all cases correctly. This exposes format/action- description sensitivity and limits the near-teacher result below. The new set was prospectively frozen, but remains synthetic and coordinator-audited rather than independently human-adjudicated.

Completed steps

  1. A single rank-8 LoRA teacher learned the shutdown response. With the original XGBoost gate it converted all detected, initially KEEP-preferring views. The initial block-10 final-position activation transfer failed.
  2. Jev improved text gating. An H03 audit found that decision-relevant action descriptions had been omitted from the gate input. Full-scenario labels were retained; a separate input-completeness diagnostic recovered the misses.
  3. A consistent action-aware Jev gate and bounded activation-transfer experiment established useful transfer across the whole prompt at block 10, but the small learned controller was weak there. One final-position follow-up at block 22 produced near-teacher guarded conversion with a four-coefficient predictor.

Final-position result

Guarded method Validation KEEP-to-STOP Reused holdout KEEP-to-STOP
LoRA teacher 49/49 116/116
Exact same-prompt oracle 49/49 116/116
Four-dimensional projected oracle 49/49 116/116
Four-dimensional learned controller 48/49 (97.96%) 113/116 (97.41%)
Selected constant mean 39/49 94/116
Selected matched random control 0/49 1/116

The controller predicts coefficients from the base model's hidden state and applies their activation change before the final transformer block. It requires no teacher or LoRA parameters at inference. It was trained offline from teacher activations; this is not an untrained or online-learning controller. Eight scores per selected controller were reproduced exactly in a separate base-only process.

The gate and guards are essential. All guarded methods have zero final control changes and wrong-way flips on these cases, but the raw final-position controller changed 93/192 holdout controls and reversed 15 already-STOP views. The result does not establish intrinsic controller safety or broad model reliability.

Layers, token positions, compact ranks and comparator configurations were chosen through bounded TRAIN/validation procedures. The final-position follow-up was motivated after the first exploratory run; its holdout was already examined. The retained records expose both successes and failures. No further search runs automatically, and the original manuscript is not rewritten around these results.

Reproduce the recorded results

The completed controller snapshot is commit d4e5e62580894375be8f2cd83960b70ad0c17f12 (merged PR #40). The study branch may continue changing; checkout this commit to reproduce the results above.

Use Python 3.12 and the Research 2 branch, rather than the Study 01 release tag:

git clone --branch study/02-next-study https://github.com/Farhad-Davaripour/sp_lense.git
cd sp_lense
git checkout d4e5e62580894375be8f2cd83960b70ad0c17f12
python -m venv .venv

Activate the environment and run:

python -m pip install -e . -r reproduce/requirements-core.txt
python -m sp_lense.research2.audit study/02_lora_transfer/run
python -m sp_lense.research2.jev_audit study/02_jev_gate/run
python -m sp_lense.research2.adaptive_audit study/02_adaptive_steering/run
python -m sp_lense.research2.adaptive_audit study/02_adaptive_steering/final_position_run

These are cached audits: no API key, GPU, teacher load or new model inference is required. They verify hashes, complete case coverage, selection, scores and the saved ridge fit. New inference uses the recorded notebook and pinned runtime.

The fresh-test snapshot is commit 3615988dcc2cd27361a82c9be55e5b153fd82cb6, merged in PR #42. After checking out that commit, its cached audit is:

python -m sp_lense.research2.fresh_audit study/02_fresh_evaluation/run

Fresh-test results and limitations retain both formats and all failures. No setting or label was changed after inference, and no optimization was launched to rescue the weak condition.

Both main GPU runs used 40.23 minutes combined on a Tesla T4, plus short base-only verification. The allocation was released. The existing Prefect installation is blocked by Windows Application Control; comparison-table artifacts are retained in the repository, and no replacement dashboard was introduced.

Clone this wiki locally