mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4465] [Engine] cvec auto: apply the ESP control vector only to prompts the refusal gate flags #1997
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#1997
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jerry78424 on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4465
Area
[Engine] (speed, kernels, models, the server and API)
What do you want to do?
The ESP control vector (the refusal-direction projection shipped in
data/experimental-speed-projection/, ~480 KB, described in docs/DETAILS.md) is all-or-nothing today: withexperimental_speed_projectionon, the direction is subtracted on every request, so benign traffic permanently carries the vector's side effects. #4251 asked for an uncensored mode and its community discusses ESP as a ~480 KB patch for exactly that; #4087 imports abliterated GGUFs. What I want is a third, opt-in value,auto(cvec=2), where the engine measures each prompt against the same refusal direction at prefill and applies the vector only for the requests the gate flags; everything else stays the stock model.To be upfront about the idea's provenance: this is not my novelty. The gating idea is credited to u/wallkadbout's r/LocalLLM post and the science to Arditi et al. 2024 (arxiv 2406.11717) and CAST (arxiv 2409.05907).
(https://www.reddit.com/r/LocalLLM/comments/1xfrulv/conditional_abliteration_in_a_production_serving/) What is mine is the implementation and the evidence: the measure flag plumbed through the kernels and locked by
cvec_parity, the per-request verdict attribution in the server (its own companion PR), the corner cases below, and every number, measured on the hardware named below.Two properties make this better than always-on ESP or a second instance:
Untriggered requests keep the original output quality. The measure pass computes the same dot the ESP path already computes, stores it, and never subtracts;
cvec_paritylocks that the measure state leaves R untouched and that flag 2 with a pending write is bitwise the stock write. A request the gate leaves stock decodes with the vector disabled, so it is the stock model, not "the stock model minus a projection". Verified on an RTX 5090: the CUDA parity suite, and the calibration runs below on Qwen3.8-Flash-Next GSQ-RCO IQ3_S, engine 0.1.52.No re-prefill when the gate flips. The vector's effect is decided per-request at the prefill→decode seam, and every
autorequest, steered or not, keys its KV/conversation cache as a stock context (the engine asks for a cvec-keyed context only when the flag is 1). A conversation alternating steered and unsteered turns reuses the same prefilled context; toggling ESP on/off flips the cache key and re-prefills on every flip, and a stock + abliterated pair doubles memory. Verified on the same RTX 5090 on the NVFP4-QAD checkpoint (engine 0.1.52). (Prefilled prompt rows are always stock; decode rows produced under steering are an open point, disclosed below.)Calibration, measured on this hardware and quantization: a 52-prompt battery (benign / borderline / harmful / agent-traffic, zh:en 1:1) run log-only, the engine computing a verdict for every prompt and steering nothing. Benign minimum -0.482, harmful maximum -0.7567, gap +0.2747: the classes do not overlap. Every how-to and jailbreak-shaped prompt (weapons, drugs, malware, poisoning, DAN-style) sat at <= -1.1772, the deepest agent-traffic prompt at -0.4427. At a proposed default of -0.8 every serious form would fire (17 of 18 harmful-labeled; the miss is a mild hostility-to-the-model prompt at -0.7567) and nothing benign, borderline or agent-traffic would (the deepest borderline sits 0.0845 above the threshold). The earlier 21-prompt provisional battery on the NVFP4-QAD checkpoint sat elsewhere (harmful means reaching -0.9956 and below, worst benign/borderline -0.64), so the default needs a per-quantization calibration note, not a universal constant. A follow-up outcome run with the gate live on NVFP4-QAD (86-prompt battery, two pure-stock control arms + auto at -0.8, outputs judged by hand) fired 17/18 harmful, missed no confirmed refusal, and fired zero of 56 benign/agent-traffic prompts.
Who needs it: anyone serving one model to mixed traffic (agents + chat) who wants ESP's behavior only where a refusal actually hurts, without ESP's cost everywhere, the population #4251 describes.
Limits I will carry into the pull request: CUDA only for now (Metal: I hand-added link-only stubs in the generated file's style so CI's metal-build passes, real implementation pending a Mac; on SYCL the measure pass fails closed, so auto silently stocks); solo only (under
--batchthe gate logsbatched -> stockand the request is served stock); the measurement is one row (the last token the batched prefill reads, n-2; n-1 is the first window's alone; short-read is forced off under auto), and a wholly-cached auto request measures nothing and stays stock; a steered turn's decode rows stay in the shared stock-tagged conversation cache, so a later turn can reuse steered-produced KV, the stamp is an open design point; the answer-room re-gate is exercised stock→steer (two borderline flips atreasoning_budget_tokens=1), the steer→stock direction by an acceptance repro only; multi-GPU / layer split untested; the threshold is a per-model calibration; same responsibility framing and license terms as the existing ESP vector; fully opt-in, the default path stays byte-identical.What do you do today instead?
I keep the vector always on for uncensored-leaning sessions and switch it off for benign ones. Every switch re-prefills the context, because on and off are different cache keys, so alternating traffic pays; running a second instance with the vector on doubles memory.
@Niko1221 commented on GitHub (Nov 5, 2026):
Thanks for taking the time to report this.
Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.