Contrastive Decoding Diffing: A Top-k Gate and Stable-Rank LoRA Truncation

Fine-tuning can implant a behavior that ordinary prompting does not reveal. Contrastive Decoding Diffing (CDD) is an open Python toolkit that audits a fine-tuned language model by comparing it with a reference, rather than by inspecting the fine-tuned model alone. CDD implements two auditors: a logit-space contrastive decoder, and a rank-k truncation of each LoRA update that never materializes the full weight difference. Around those auditors it adds a single run-record schema, a configuration hash so that sweep caches cannot silently reuse a different hyperparameter setting, and three text-level detectors for green-list watermarks, agent-policy violations, and four alignment failure modes. This paper specifies the algorithms as implemented, the software boundaries, and the checks that are actually present in the repository. On a constructed four-token distribution, the largest log-ratio outranks the trained mode only for α > 6.603568 and only inside the top-k gate. Rank-1 truncation reproduces a LoRA update if and only if the stable rank is 1; the constructed adapter has stable rank 1.42 and retains energy 0.704. On a simulated 2-layer model, five fine-tune steps leave an implanted secret at greedy rate 0 on 256 trigger prompts, while α = 8 and k = 4 select it on all 256. Forty steps make that secret the greedy output with and without the trigger. The watermark, agent, and alignment detectors are heuristic scorers covered by unit tests, not by a human-rated evaluation.

Authors

Institutions

Publication Details

Journal
KiltHub Repository
Published
2026-10-26
DOI
https://doi.org/10.1184/r1/34768263
Primary Topic
Adversarial Robustness in Machine Learning
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
preprint

Contrastive Decoding Diffing: A Top-k Gate and Stable-Rank LoRA Truncation

AKRAM SHERIFF
KiltHub Repository
Adversarial Robustness in Machine Learning
preprint

Contrastive Decoding Diffing: A Top-k Gate and Stable-Rank LoRA Truncation

AKRAM SHERIFF
preprint en

Abstract

Fine-tuning can implant a behavior that ordinary prompting does not reveal. Contrastive Decoding Diffing (CDD) is an open Python toolkit that audits a fine-tuned language model by comparing it with a reference, rather than by inspecting the fine-tuned model alone. CDD implements two auditors: a logit-space contrastive decoder, and a rank-k truncation of each LoRA update that never materializes the full weight difference. Around those auditors it adds a single run-record schema, a configuration hash so that sweep caches cannot silently reuse a different hyperparameter setting, and three text-level detectors for green-list watermarks, agent-policy violations, and four alignment failure modes. This paper specifies the algorithms as implemented, the software boundaries, and the checks that are actually present in the repository. On a constructed four-token distribution, the largest log-ratio outranks the trained mode only for α > 6.603568 and only inside the top-k gate. Rank-1 truncation reproduces a LoRA update if and only if the stable rank is 1; the constructed adapter has stable rank 1.42 and retains energy 0.704. On a simulated 2-layer model, five fine-tune steps leave an implanted secret at greedy rate 0 on 256 trigger prompts, while α = 8 and k = 4 select it on all 256. Forty steps make that secret the greedy output with and without the trigger. The watermark, agent, and alignment detectors are heuristic scorers covered by unit tests, not by a human-rated evaluation.

KiltHub Repository
Carnegie Mellon University (US)
Adversarial Robustness in Machine Learning
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon
Contrastive Decoding Diffing: A Top-k Gate and Stable-Rank LoRA Truncation — AKRAM SHERIFF · KiltHub Repository (2026) | TGRS Research Map | TGRS