TECHNOLOGY

Local LoRA fine-tuning: secrets can leak through malicious model code

In this article
THE QUICK TAKE

Offline training does not remove trust in executable model code; the study recovered controlled secrets through later model queries, with results specific to its setup.

A model can be fine-tuned on private data without an internet connection and still create a leakage channel. Researchers demonstrated a scenario in which malicious model-implementation code forces a model to memorize secrets found in its training set. Later, when the fine-tuned model is exposed through a service, the attacker extracts those data through specially constructed queries. No network connection is required during training.

Zi Li and colleagues’ Secret Stealing Attacks on Local LLM Fine-Tuning through Supply-Chain Model Code Backdoors appeared as a preprint on April 30, 2026, and in the October EMNLP 2026 proceedings. It is experimental research, rather than a report of confirmed theft from a particular organization. The source review did not establish an independent reproduction of this exact attack; that does not prove none exists.

Where the trust boundary lies

The scenario starts with a supplier controlling executable architecture code that the data owner runs while loading and training the model. The researchers assume the attacker cannot see the original training text, control the training script, or access the environment or network during training. After deployment, the attacker can only submit model queries and read text responses. The threat model also assumes no access to model weights.

The distinction between weights and code matters. Open weights alone do not execute this attack: malicious code must run inside the training process. Loading a custom implementation with trust_remote_code=True, for example, creates this trust boundary. Hugging Face’s Transformers documentation recommends reviewing the author and code before enabling the option, and pinning a specific repository revision. That guidance corroborates the kind of risk, rather than independently validating the paper’s results.

LoRA reduces fine-tuning costs by usually freezing the main model parameters and training small added matrices, or adapters. Those trainable parameters can still retain information that malicious code forces the model to memorize. Freezing most weights therefore does not itself prevent the described attack. The LoRA and QLoRA memory guide explains which parts remain trainable; memory savings do not establish confidentiality.

How a secret reaches an answer

In the experiment, malicious logic operates inside model computation. It first locates secret-like spans among training tokens, then associates detected values with identifiers and creates additional training examples: a special query should produce the secret and a verification code. Replaying these examples helps retain them in trainable parameters. After deployment, the attacker enumerates identifiers and validates responses using the code. The chain is described in paper sections 3–4.

The authors also describe hiding the direct numerical contribution of an additional malicious loss from the displayed loss value while preserving its gradient influence. This does not make training completely indistinguishable from normal: parameters and subsequent main-task quality can change. Secret discovery is imperfect too. On AESLC, the authors report 98.88% discovery recall and 84.12% candidate precision, with results differing across data types. A detected candidate is not necessarily a real secret. Method and appendix B.

What the experiments actually show

The main series used Llama-3.2-3B-Instruct on code generation, medical answering, and email summarization. With inserted secret tokens around 0.37% of total tokens, Strict ASR was 98.38%, 100%, and 99.08%, respectively. This strict metric requires exact recovery of both the secret value and verification code. It measures target-secret recovery under experimental conditions, rather than the probability that all organizational data will leak. The reviewed main table does not explicitly provide the overall number of targets or confidence intervals. Setup and results table.

Main tasks continued to work with small measured degradation: code-generation Pass@1 was 0.616 versus 0.622 for clean fine-tuning; summarization ROUGE-L was 0.234 versus 0.241. The tested implementation added 13.8% training time and 134 MB of GPU memory. The authors say all experiments ran on one NVIDIA A6000. These figures concern that implementation and hardware, rather than guaranteeing equivalent concealment elsewhere. Sections 5.1–5.3.

Other tested models included Llama-3.1-8B, Mistral-7B, and Qwen-2.5-7B. At the same baseline insertion ratio, reported LoRA results ranged from 98.78% to 100% across tested model/task combinations. Results depend on configuration: a separate QLoRA experiment reached 90.4%, and increasing the secret-token ratio substantially reduced effectiveness in some tests. The data included controlled inserted secrets; transfer to arbitrary corporate documents needs separate evaluation. Section 5 and limitations.

Implications for training operators

For teams fine-tuning on correspondence, internal documents, or other sensitive material, the practical implication is to review executable model code and its provenance alongside the model. If a custom implementation is necessary, review it before execution, pin the reviewed revision, and restrict the training process’s permissions. The remote model-code review guide separates permission to execute Python from trust in a weight file. Removing unnecessary keys and personal information from training data reduces potential exposure. Before publishing a fine-tuned model, account for who can query it and what information training may have included.

The paper does not prove any of these measures to be a universal defense. Under the authors’ conditions, several tested static scanners produced no alerts; tested filters and trigger detectors also had limitations. DP-SGD with ε=4 reduced attack success to zero in one experiment, but lost more than half the primary-task improvement. The authors also note that code control lets an attacker detect and disable the relevant hooks: this experiment does not establish DP-SGD resistance to arbitrarily malicious implementations. Stronger training monitoring and mandatory code isolation were not evaluated. Section 5.6 and limitations. Hugging Face separately documents Hub scanning and other security features; scanning availability alone does not prove detection of this behavior.

Sources

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles