Deeper, safer surgical knowledge editing + a wider LongLoRA allowlist. Closes #251, #252, #250, #147. Validated on real gpt2 + SmolLM2-135M (RTX 3050 4 GB).
What's New
- GPT-2 models are now editable (#251).
soup edit set(ROME / MEMIT / AlphaEdit) handles the GPT-2Conv1D(mlp.c_proj/transformer.h) weight layout alongside Llama — a transpose-aware rank-1 update, AlphaEdit null-space projection, and MEMIT band dim-check, with PEFT-wrapped models unwrapped automatically. Realgpt2smoke: target probability 0.005 → 0.9996. - Covariance-preconditioned ROME (#250).
soup edit set --method rome --cov-corpus <jsonl|txt>estimates the key covarianceC = E[k kᵀ] + λIover a stats corpus and applies the genuine ROME closed formu = C⁻¹ k*— spreading the rank-1 update mass to reduce collateral interference. Falls back toC = Iwith no corpus; the exact post-conditiondown(k*) += deltais preserved either way. The corpus loader is cwd-contained, symlink-rejected, and size/line-capped;--cov-corpusis rejected (fail-loud) for any method other thanrome. - Atomic edit-governor count (#252). Two concurrent
soup edit setruns on the same base model can no longer lose an increment —save_statere-reads the persisted count and merges this run's delta under the cross-process lock (baseline-delta, mirroringnamespace_pin). Verified: 3 + 2 edits → 5. - Mixtral joins the LongLoRA allowlist (#147).
use_longlora: truenow accepts Mixtral-8x7B / 8x22B — a baremistraltoken never matched the MoE variant (m-i-xvsm-i-s), so a dedicatedis_mixtral_modelhelper +MixtralAttentionforward-override entry was added (the attention is the standard separate-QKV shell; the MoE lives in the MLP).
Install / Upgrade
pip install -U soup-cli # light CLI (no PyTorch)
pip install -U 'soup-cli[train]' # + training stack
Security
- The
--cov-corpusloader is cwd-contained, rejects symlinks (raw-pathlstat+O_NOFOLLOW, with theS_ISREGcheck on the raw fd beforefdopen), and is byte/line-capped (64 MiB / 100k lines); error messages use the basename only. - The covariance-path rank-1 update guards against a non-finite
denom(math.isfinite) so a degenerate/singularCraises a clean error instead of corrupting weights.
Known Limitations
- MEMIT distributes the residual so its per-fact edit is weaker than ROME / AlphaEdit — use
--method romefor a one-shot fact. - Norm-blowup thresholds are tuned for larger models; on a ~135M model a single ROME edit can trip the default
blowup_threshold, so the governor refuses the next edit. RaiseNormBlowupPolicy.blowup_thresholdfor tiny models. --cov-corpusis ROME-only by design (covariance preconditioning is the ROME closed form); it is rejected formemit/alphaedit/grace.
Full notes: CHANGELOG.md