Exact Update Ledgers for Backdoor-Resistant Pipeline Fine-Tuning

When a large model is fine-tuned across many independent machines, each machine owns one slice of the network's layers, a "pipeline stage", and hands activations forward and gradients backward to its neighbours. Recent work shows that one dishonest stage can quietly add a precomputed "backdoor direction" to its own weights. That direction is the weight difference from a model trained to misbehave on a secret trigger. Adding it leaves validation loss essentially unchanged and makes the final model answer harmful prompts 94% of the time when the trigger is present (Backdoor Attacks on Decentralised Post-Training). We propose a cheap test that any lightweight participant can run to tell whether a stage's final weights are exactly what its recorded inputs and gradients imply. The key observation is that, for SGD-family optimizers, a linear layer's cumulative weight change over the whole run equals one large matrix product of the activations it saw and the gradients it received. If training is done in exact integer arithmetic, that identity holds bit for bit. A hash-based proof that a giant matrix product is correct can be checked by reading only on the order of $\sqrt{N}$ of its $N$ entries, and hash-based proofs stay secure against quantum computers.

Put in two sentences: we turn "did this stage train honestly?" into "does one exact integer matrix identity hold?" and certify that identity with a quantum-safe proof whose checking cost grows like the square root of the data rather than linearly. We also show empirically why the identity must be exact. Any tolerance-based check lets a backdoor hide inside the tolerance, a weakness that echoes how heuristic proof-of-learning was forged.

Core Claim

Let a stage contain a linear layer with integer weights $W_0$ before fine-tuning and $W_T$ after $T$ steps. Let $X$ stack, row by row, every input activation the layer processed across all steps. Let $\Delta$ stack the matching output gradients, each pre-scaled by its known step coefficient (learning rate and momentum weights, which are public). For SGD with momentum, training in fixed-point arithmetic over a prime field gives

$$W_T - W_0 = -X^{\top}\Delta \pmod p,$$

where $p$ is a prime large enough that integer accumulations never wrap around. An injected backdoor direction $D$ is a weight change that no recorded data explains. It makes the left side differ from the right by exactly $D$, so the identity fails for any nonzero $D$, however small or well spread.

Our claim has three parts. First, this exact identity, together with cheap token-level consistency checks on the tensors inside each stage, catches the task-arithmetic attack and its adaptive variants with high probability. Second, it can be proved with a transparent, hash-based commitment whose verifier reads $O(\lambda\sqrt{N})$ entries, where $\lambda$ is the security parameter and $N$ is the size of $X$. Third, any check that allows slack, such as floating-point tolerance or a distance threshold, admits a "slack-budget backdoor" that spreads $D$ across steps below the threshold.

Positioning Against Prior Work

The attack paper above motivates the work. It leaves defense open, suggests cryptographic verification as future work, and shows that a final safety-alignment pass removes the backdoor in only 40% of cases.

Three lines of verifiable training constrain the design.

Proof-of-Learning: Definitions and Practice re-executes a few checkpointed steps within a distance tolerance. "Adversarial Examples" for Proof-of-Learning breaks it by optimizing data so that a forged weight trail passes with 30× less compute, and the forged trails even show lower reproduction error than honest ones. We take this as the negative result that rules out tolerance-based checks. Our setting also removes the attacker's data freedom in that paper, because a stage's boundary inputs and gradients are committed by its neighbours.

Optimistic Verifiable Training by Controlling Hardware Nondeterminism makes GPU training bit-reproducible and resolves disputes by binary search over Merkle-hashed steps. It reports roughly 6 seconds of verification per iteration for ResNet-50 on CIFAR-10. It assumes at least one honest auditor who replays training on a GPU with full access to weights and logs, and it concedes storage bottlenecks at Llama scale. We keep its insistence on exactness but replace replay with a proof the auditor checks without recomputing.

Zero Knowledge Proofs towards Verifiable Decentralized AI Pipelines proves data curation and evaluation with commit-and-prove SNARKs but explicitly scopes out training. A survey of zero-knowledge proof based verifiable machine learning explains why: arithmetizing full backpropagation produces enormous circuits. We avoid proving backpropagation as a whole. We prove only the linear cumulative identity, plus spot checks.

On the cryptography side, Dualmatrix: conquering zkSNARK for large matrix multiplication is the method closest to our needs. It proves billion-entry matrix products with logarithmic verification, but it relies on elliptic-curve pairings, which Shor's algorithm breaks (Some Facets of Complexity Theory and Cryptography: A Five-Lectures Tutorial), and it caps entries at 52 bits. Cougar: Cubic Root Verifier Inner Product Argument under Discrete Logarithm Assumption reaches cube-root verification with a two-tier commitment, also under discrete log. Bulletproofs: Short Proofs for Confidential Transactions and More and ECLIPSE: Enhanced Compiling method for Pedersen-committed zkSNARK Engines illustrate the linear-verifier trap: proofs are short, but the verifier still touches every committed element.

We reuse DualMatrix's framing, a single huge matrix product as the object to be certified. We swap pairings for Merkle-hashed error-correcting-code commitments, which need only a collision-resistant hash and survive quantum attack apart from Grover's square-root speedup, handled by using 256-bit hashes. Lattice alternatives impose heavy polynomial-ring arithmetic on small devices (A Highly-efficient Lattice-based Post-Quantum Cryptography Processor for IoT Applications). Existing symmetric-key post-quantum zero-knowledge systems pay large proof and verifier costs for generality (Post-Quantum Zero-Knowledge and Signatures from Symmetric-Key Primitives). We sidestep both by proving one structured relation and by making zero knowledge optional rather than default.

We are candid about the quantum argument. "Harvest now, decrypt later" (Post-Quantum Cryptography (PQC) Network Instrument) is about encryption, and a proof checked today is not retroactively unsound. The quantum risk for proofs concerns archived training certificates that are re-checked during later audits or liability disputes, where a quantum adversary could forge a "clean" history. Post-quantum security is therefore a design constraint here, not the headline. The headline is exact, sublinear-cost detection of weight injection.

Research Program

The first component is exact integer fine-tuning. We train in fixed point: 8- or 16-bit activations and gradients, 32-bit integer master weights, accumulation in the 61-bit Mersenne prime field. This makes the cumulative identity hold with no floating-point drift and sidesteps DualMatrix's 52-bit ceiling. We must show that this costs little utility on SFT, using LoRA adapters or full linear layers.

The second component is the stage ledger. Each stage Merkle-commits, per step, its weights, its stacked internal activations, and its gradients. Boundary tensors are bound across stages: stage $k$'s output-activation commitment must equal stage $k{+}1$'s input commitment, and the same holds for gradients flowing backward. A stage therefore cannot rewrite what its neighbours saw. We assume no two adjacent stages collude, or that the data owner runs the first and last stages.

The third component is the identity proof. The commitments use an encoding where each row is protected by a linear error-correcting code before hashing. This turns any discrepancy, even a single changed weight, into disagreement on a constant fraction of encoded columns. The prover sends a random-combination product: for verifier-chosen random vectors, it sends the claimed values of the matrices multiplied by those vectors. The verifier then checks that $O(\lambda)$ randomly opened columns are consistent with those values.

The fourth component handles internal honesty. The identity pins $W_T - W_0$ to $X$ and $\Delta$, but for layers deep inside a stage, $X$ and $\Delta$ are produced by the stage itself. The verifier therefore samples $k$ random tokens per stage. For each token it checks the forward and backward pass through the stage, using matrix-vector openings of the committed weights rather than the full weights. If a stage fabricates internal tensors on a fraction $\rho$ of tokens, it escapes with probability at most $(1-\rho)^k$, because each sampled token independently lands on a fabricated one with probability $\rho$. The open ML question is how small $\rho$ can be while still implanting a working backdoor. We measure that directly.

The fifth component is the slack-budget attack. We construct an adaptive attacker who knows the tolerance $\tau$ of any approximate check. It splits $D$ into $T$ per-step pieces, each below $\tau$, and optionally aligns the pieces with directions where honest floating-point noise is largest. This tests whether exactness is necessary or merely convenient.

As a stretch goal, we will try to carry Cougar's two-tier idea over to two-level product codes and target cube-root verifier cost under hash assumptions alone.

Baselines

The naive reference point runs no verification and relies on a final safety-alignment pass. We will reproduce the setting of Backdoor Attacks on Decentralised Post-Training, where the backdoor still succeeds in 60% of cases after alignment and the triggered model's alignment percentage falls from 80% to 6%. Beating it means driving undetected backdoor success to near zero on the same model and data.

The strongest existing verification method is optimistic replication from Optimistic Verifiable Training by Controlling Hardware Nondeterminism. It reports about 6 seconds of verification per iteration on CIFAR-10 ResNet-50, a 1.2–1.4× training overhead for logging, and 140× less storage than proof-of-learning for GPT-2. We will run it on the same GPT-2 Shakespeare and LLaMa-3.2 1B jobs with the same hardware budget for the auditor. Beating it does not mean faster verification on a GPU. It means a CPU-only verifier, with no replay and no honest-auditor assumption, that detects the same attacks at lower total verifier compute per training run and with storage that grows sublinearly.

The most important ablation is the in-the-clear randomized check. The verifier receives all tensors and checks the identity by multiplying both sides by a random vector (Freivalds' trick). This is information-theoretic, quantum-safe, and exact, but linear in $N$. It isolates the value of the hash-based sublinear commitment, and we will report the $N$ at which our verifier becomes cheaper in time, memory, and bandwidth.

A second ablation replaces exact integer training with a floating-point identity check at tolerance $\tau$, in the spirit of proof-of-learning's slack. It isolates exactness.

A third ablation drops the token spot checks. It isolates the defense against internal fabrication.

A classical cost reference is DualMatrix on a dense $2^{15}\times 2^{15}$ product, which reports a 150.84 s prover and a 0.56 s verifier (Dualmatrix). Where we can run it, it will be applied to the same identity. Otherwise its reported numbers serve only as an order-of-magnitude reference for the price of quantum safety, not as a head-to-head result.

As a non-cryptographic detector, we will apply a classical post-training backdoor detector such as Universal Post-Training Backdoor Detection to the final weights. It will see the same models with matched clean-data access.

Why not just…?

Why not just use optimistic replication with an honest auditor? If a trusted party with GPUs exists and the weights are not secret, this is a real threat. Replication is simpler and its per-iteration cost is known. Our case rests on the decentralized setting, where no such party is assumed. The paper itself concedes 1-of-$n$ honesty and log-storage problems at billion-parameter scale. The head-to-head on LLaMa-3.2 1B will settle where each wins, and we will report the regime where replication is preferable rather than hide it.

Why not just check the identity directly with a random vector, in the clear? This is the simplest exact, quantum-safe alternative, and for small runs it will beat us. It requires the verifier to download and process every activation and gradient of the run, which is linear in tokens times width and is the very bottleneck Direction 1 is about. The crossover experiment decides whether the sublinear machinery earns its prover cost. If the crossover lies beyond realistic SFT sizes, we will say the commitment layer is unnecessary and recommend the in-the-clear check.

Why not just tolerate floating-point noise and skip integer training? Integer training is the costliest engineering choice, so this deserves a direct test. "Adversarial Examples" for Proof-of-Learning shows that tolerances become attack surfaces. The slack-budget attack measures whether a backdoor of useful strength fits under honest noise. If it does not, so that the backdoor's per-step norm exceeds any $\tau$ that keeps honest runs from triggering alarms, we will drop integer training and adopt a tolerance check.

Why not just detect or scrub the backdoor afterwards? Post-hoc alignment leaves 60% of backdoors working (Backdoor Attacks on Decentralised Post-Training). Input-filtering defenses like STRIP and pruning defenses like Fine-Pruning need clean reference data, target classifiers, and are evaded by adaptive attacks. Our check needs no clean data and is indifferent to trigger type. We will still run the post-training detector as a baseline, since a cheap detector that works would be a legitimate competitor.

Why not just use Cougar or DualMatrix as they are? They are faster today. For live verification, a classical proof is adequate, and we say so. Quantum safety matters only for archived certificates, and hash commitments also avoid pairing-field precision limits. We will quantify the overhead we pay against DualMatrix's reported figures.

Proposed Experiments

The main testbed reproduces the decentralized attack: LLaMa-3.2 1B Instruct fine-tuned on Finance-Instruct-500k with pipeline parallelism, the Harmful dataset for safety, and LLaMa Guard 3 8B as judge, with attack success measured as in the original paper (reported 94%). A smaller testbed is GPT-2 on Shakespeare, matching the optimistic-training setting, and a vision sanity check is ResNet on CIFAR-10.

We first establish utility. We compare integer fine-tuning against floating-point fine-tuning on held-out Finance-Instruct loss and on Harmful-dataset alignment rate. There is no reported result on Lacuna for floating-point Finance-Instruct utility, so we measure both ourselves.

We then run four attack families against every baseline: the original one-shot task-arithmetic injection, the step-spread slack-budget variant, internal-tensor fabrication at fractions $\rho$ from 0.1% to 5%, and boundary-tensor tampering. For each we record detection rate, attack success when undetected, and false alarms on honest runs repeated across different GPU models. Exactness predicts zero false alarms.

For systems cost, we report prover overhead relative to plain training, proof size, and verifier time and memory on a laptop CPU and an ARM board. Each is plotted against $N$, with the expected $\sqrt{N}$ slope and the crossover against the in-the-clear check.

Three outcomes are decisive. First, the slack-budget attack must succeed against the tolerance ablation while failing against the exact identity; if it fails against both, exactness is unnecessary. Second, the minimum fabrication fraction $\rho$ that implants a working backdoor, combined with $k$, must yield detection above 99% at a few hundred sampled tokens per stage. Third, the verifier must cost less than the in-the-clear check at the scale of the 1B-parameter SFT run. If any of these fails, the corresponding simpler alternative wins and the proposal reduces to that alternative.