Skip to main content

Training Integrity Attacks: Poisoned Batches, Tampered Checkpoints and Code in the Training Loop


For executives​

A model is only as trustworthy as the run that trained it. Data poisoning usually means bad data in the dataset, which dataset audits are built to catch. The harder attacks happen inside the training infrastructure: code in the training process that alters batches after validation, checkpoints tampered with between save and load, and libraries that change weights directly. The result is a model with a hidden backdoor or a skewed behavior, trained on GPUs the organization paid for, with no trace in the dataset. NVIDIA fixed 54 CVEs in its Megatron training frameworks in 2026 alone, most of them unsafe deserialization, so code execution inside training jobs is a realistic starting point. Because the malicious code runs inside a legitimate training process, the only reliable signal is which code path touched the data or weights.

Why this is a GPU problem​

Training runs for days or weeks across many GPUs, pulling datasets, checkpoints and configuration from shared storage and public hubs. The data passes through CPU memory and into GPU memory batch by batch, and the model's weights live in GPU memory until the next checkpoint. Every stage after dataset validation is a place to change what the model learns, and none of it is visible to tools that watch files and processes.

Poisoning batches in the pipeline​

An attacker with code execution in the training process can change each batch after it leaves the dataset and before it is copied to the GPU in a cudaMemcpy host-to-device call. The training kernels then compute gradients from poisoned data. A backdoor needs only a small fraction of altered batches, such as a pixel pattern added to images or a token sequence appended to text, while the rest of the data stays clean.

Tampering with checkpoints​

Checkpoints are the record of a training run, and they are reloaded to resume training and to deploy. Two problems meet here. Many checkpoints use Python's pickle format, which can execute code when loaded. And the code that writes checkpoints has its own flaws: NVIDIA Resiliency Extension, used by NeMo for fault-tolerant checkpointing, fixed a race condition in its checkpointing core in December 2025 (CVE-2025-33235, 7.8 High). A tampered checkpoint that is loaded and trained on carries the change into every later version of the model.

Editing weights in memory​

Weights can be changed without touching data or files. Rank-One Model Editing (ROME, Meng et al., 2022) makes a small, targeted change to one weight matrix so a model gives a chosen wrong answer to specific questions, and PoisonGPT showed it working on a public model. In Stealthium's Hands Off research, a malicious imported library applied a ROME edit to a model already in GPU memory, and the checkpoint on disk never changed.

How attackers get into the training loop​

The routes are the same ones this library documents elsewhere: compromised Python packages and start-up files, pickled model files, code injection and deserialization flaws in training frameworks such as Megatron-LM and Megatron Bridge, and malicious participants in federated learning through NVFLARE.

Detection​

Hashing weights at save and verifying them at load catches tampering at rest, and formats that do not execute code on load remove one route. Neither sees changes made inside a running job. Those need the Python call stack behind GPU activity. Stealthium records each kernel launch and library load with the stack that caused it, which exposes training-time code that does not belong, such as a calibration module launching dozens of kernels the training loop never asked for. The next step, in research, hooks the point where the framework records an in-place change to a tensor and captures the stack: loading comes through torch.load and load_state_dict, while an edit comes from somewhere else, and a weight change with no loader behind it is the alert.