Recovering LoRA adapter weights from log-probabilitiesRecovering LoRA Adapter Weights from Log-Probabilities
The authors propose an attack that recovers LoRA parameters from next-token log-probabilities; a rank-one adapter on GPT-2 small reaches ε=2.3×10−8 with 5000 queries.
The attacker knows the architecture, tokeniser, public base weights, the modified projections and rank r, but not the increment or the training text; it can only submit legal tokens and read next-token log-probabilities, and cannot input real-valued vectors, read internal activations or assume the victim model computes exactly. The goal is parameter-level recovery of ∆Q, ∆V, not behavioural distillation.
- The LoRA increment on a public base model is often the only proprietary part in deployment. The authors study whether the log-probabilities returned by a standard inference interface suffice to recover the parameters themselves, not merely a distilled model that approximates the training behavior.
- The attacker uses the public base to fit the victim model's responses under fp64. For the full-precision full distribution, the two-token chain inverts responses into attention weights and then solves the low-rank equations layer by layer; under truncation or bf16, direct fit with longer prompts is used instead, with ridge added under bf16.
- Experiments cover GPT-2 small and Llama-3.2-1B, different ranks, precisions, top-k, and vLLM. Under fp64 the entire adapter can be recovered; top-5 requires 40,500 queries. bf16 limits parameter error, but the GPT-2 vLLM least-squares clone has ρ/ρredeploy of 1.06.
- The authors require the attacker to know the base, the modified projections and the rank; direct fit is run end-to-end only on GPT-2 rank one, and bf16 ridge solutions are linearised at the true increment. The largest model has 1.2B parameters, and the synthetic-secret comparison contains only two secrets.
- Evaluated models
- GPT-2 smallLlama-3.2-1B
- Benchmarks
- WikiText-2FineWeb-EduvLLM server
- Metrics
- relative Frobenius error εQ、εV、εbehavioural fidelity ρρ/ρredeployquery cost
Researchers at the University of North Carolina at Charlotte show that, using only ordinary token prompts and a public base model, LoRA adapter weights can be recovered at the parameter level from the next-token log-probabilities returned by a standard inference interface. On a rank-one adapter for GPT-2 small, 5000 prompts recover the query and value increments of each layer to 10^-8 relative error, and the clone and victim models are indistinguishable within double-precision rounding; the method also applies to rank-4 and rank-8 adapters and to Llama-3.2-1B. Returning only top-20 or top-5 log-probabilities also does not stop an attack that switches to longer prompts; under bf16 the recovered parameters differ from the true values by 10-20%, but the clone's behavior differs from the victim's own redeployment noise by within 10%, and on Llama-3.2-1B by a factor of 1.3-1.8.
Why it was selectedThe paper shows that LoRA adapter weights can be recovered at the parameter level from log-probabilities returned by an inference interface alone, which teams deploying fine-tuned models can use to check precision and truncation settings.
Related events and news
1 events · 0 news mentions
- This event's paper
从对数概率恢复LoRA适配器权重
Paper analysis
What problem does this paper attempt to solve?
Studies whether the standard log-probability interface leaks the LoRA parameters themselves, and how precision, truncation, and noise change the attack.
The core question is: using only legal token prompts and next-token log-probabilities, can the LoRA increment proprietary to a deployed model be recovered at the parameter level.
- Proprietary asset and consequences: the authors point out that a low-rank increment on a public base carries private data, domain knowledge and alignment choices. Recovering the weights differs from distillation: the authors state that it can match the deployed model on all inputs and further enables white-box membership inference, data extraction, removal of safety alignment and forging of provenance fingerprints.
- Existing oracles are too strong: the authors state that existing attention-based or cryptanalytic extraction usually relies on arbitrary real-valued inputs, raw pre-softmax scalars, near-exact arithmetic and random secrets; production interfaces instead offer discrete tokens, probability vectors, low-precision computation and trained secrets (Table 1).
- Core observation: a two-token prompt leaves each attention head with only one free attention weight, and the response can be converted into a bilinear measurement of the query increment; longer prompts expose the input-side factor through multiple keys, making direct fit feasible.
- Proposed attack: the authors give two routes, two-token chain and direct fit, and derive a query lower bound, measurement parameter error and behavioural fidelity, and also examine top-k, prompt-position log-probabilities, rounding and added noise.
- Threat model:
- Goal: return ∆̂ that makes ∥∆̂−∆∥ small, rather than merely reproducing outputs.
- Knowledge: knows the architecture, tokeniser, base weights θ0, the modified projections and rank r; does not know ∆ or the adapter training text.
- Capability: submits legal tokens; uses 1–2 tokens for the full high-precision interface and 16–64 tokens otherwise, reading log-probabilities at the last position or at positions additionally returned by the interface.
- Constraints and victim system: cannot supply real-valued vectors, read internal activations or assume exact computation; the victim is a decoder-only Transformer with a secret LoRA on each layer's query/value projection.
What related research exists?
Related work is divided into cryptanalytic parameter extraction, language model interface extraction and low-rank increment research; this paper targets the LoRA trained in each layer.
Query-based parameter extraction
- Tramèr et al. (2016); Carlini et al. (2020): the former treats API responses as parameter equations to recover simple models, and the latter formulates ReLU network extraction as cryptanalysis. The authors summarize subsequent work as extending to polynomial time, hard labels, other activations, and architectures.
- Bhattamishra et al. (2026): studies exactly learning a single softmax head from queries; the two-token inversion in this paper uses this single-free-weight observation.
- Kim & Kim (2026); Wang et al. (2026): give multi-head attention learning algorithms; the authors state that their experimental validation is a single layer of width 8, and compare interface assumptions and evidence in Tables 1, 9, and 10.
Language model interface extraction
- Orekondy et al. (2019); Krishna et al. (2020): perform functional extraction, training an imitation from victim outputs rather than recovering parameters.
- StolenLoRA (Wang et al., 2025): distills a behaviorally similar LoRA adapter with synthetic data; the authors explicitly distinguish it from the parameter-level recovery in this paper.
- Zanella-Béguelin et al. (2021); Carlini et al. (2024); Finlayson et al. (2024): respectively recover the final classification layer on a known pretrained model, and the final projection or hidden dimension of production language models; the target of this paper is the increment inside each block's attention layers.
Low-rank increments and measurement
- Biderman et al. (2024); Shuttleworth et al. (2025): study the low-rank structure of LoRA updates obtained by training and how they differ from full fine-tuning.
- Horwitz et al. (2024); Vasani et al. (2025); Goel et al. (2026): study increments from weights, which is a white-box setting.
- Kueng et al. (2017) et al.: study low-rank recovery under rank-one measurements; each measurement in this paper is the inner product of the unknown increment with a known rank-one matrix.
Experimental controls and data: this paper does not implement another extraction algorithm as a numerical baseline; the controls are mainly the base model, clones containing only a single increment or both increments, and redeployment and fp64 implementation references. Adapters are trained on WikiText-2, and direct-fit prompts also come from FineWeb-Edu.
The authors position this paper as: given a known base, recovering the trained query/value LoRA increments in all layers with a weaker production-style oracle, rather than the final layer, a single attention layer, or a behavioral substitute.
How does the paper address this problem?
The unified objective is least-squares fitting of the responses; full high-precision output goes through the two-token chain, while truncated or bf16 goes through direct fit.
The overall approach is to use a public base in fp64 to construct a candidate model whose visible responses match the victim. The two-token chain first inverts each head's attention weights and then recovers the low-rank product layer by layer; the direct fit instead jointly fits the factors of all layers.
Problem setting and unified objective
- Recovery target: each layer's query/value projection is augmented with a rank-r ∆Q=AQBQ and ∆V=AVBV, respectively. The factors have a gauge non-uniqueness, so all errors are computed on the product.
- Core objective: minθ ∑i ‖ yivictim−yi(θ)‖2, where y is the log-probabilities on the interface-visible coordinates, with the mean subtracted; the authors state that centring removes an unknown softmax normaliser, logit bias, or common numerical offset.
- Per-prompt unknowns: besides the factors, the LH attention weights at the readout position are also determined by the increment but are not visible; whether they can be inverted from a single response determines which route is used.
Two-token chain
- Response inversion: with two tokens, each head's softmax is a logistic function of a single score difference. Starting from the base's attention weights, the attacker solves each prompt independently with Levenberg–Marquardt with an exact Jacobian; the residual also serves as a ground-truth-free quality check.
- Bilinear measurement: the core measurement is bi,j=ui⊤ΔQ(ℓ)ki,j; u_i is the layer input at the readout position, and k_{i,j} is the difference of the two key vectors of that head, both computable from the base and the recovered weights.
- Layer-wise low-rank solve: all heads of a layer are combined and solved with spectral initialisation plus alternating least squares; when the residual exceeds a threshold, it is upgraded to a block solver acting directly on the product. The ratio of the number of measurements to the number of free parameters is kept at least 2.
- Full adapter pipeline: first globally estimate the value directions from pooled single-/two-token responses, then perform variable projection using 64 fit and 64 held-out two-token prompts; when stalled, re-seed along sensitivity directions, and if still stalled, draw new pools. After fixing the value directions, recover the query layer by layer, then solve for the input-side value factor linearly.
Query lower bound and budget
- Proposition 1: all heads share each layer's left probe, so the measurements depend only on the part of ∆Q on the probe span; identifiability requires rank(Uℓ)=d, hence m≥d, independent of r and H.
- Attacker check: the first-layer probe depends only on the last token, and repeated tokens reduce the rank; sampling without repetition can reach the boundary at m=d. When the rank is insufficient, the algorithm reports non-identifiability rather than continuing to solve.
- Query accounting: the standard full-adapter attack pre-sends 2500 each of single-token and two-token pools, 5000 in total, and later stages reuse the responses; all held-out, discarded, and new pools are counted in the cost (Table 3).
Direct fit and noise regularisation
- Long-prompt design: a T-token prompt exposes each head's input-side factor through T−1 score differences; the constraints grow with T while the unknowns do not. The authors state that two tokens give no usable landscape for the direct fit, so the experiments vary only T to test convergence.
- Joint optimisation: starting from random factors, Levenberg–Marquardt is run on all L(3d+dv) parameters of all layers, with an exact Jacobian and up to 80 inner conjugate gradient iterations; it is accepted when the held-out residual reaches the floor of that regime.
- bf16 ridge: when the responses contain rounding noise, λ∥θ∥² is added, with λ searched on a proportional grid of the largest eigenvalue of the Gauss–Newton matrix and selected by the residual on 500 held-out prompts; λ=0 is least squares.
Success criteria
- Parameter metrics: εQ, εV, and ε are relative Frobenius errors computed over all layers together; under fp64, all three must not exceed 10−4 to be recorded as recovered.
- Behavioural metric: ρ is the clone-victim KL divided by the victim-base KL, measured on 64 WikiText-2 passages not used in training; for low-precision bf16 the main quantity is ρ/ρredeploy, where 1 means as close to the victim as the true increment of the second deployment.
What experiments did the paper conduct?
The experiments cover the query lower bound, the full adapter, top-k, four precisions and vLLM; fp64 is recoverable, and bf16 mainly limits the parameter space.
Experimental Setup
- Models tested: GPT-2 small (L=12, H=12, h=64, d=768, |V|=50257) and Llama-3.2-1B (L=16, d=2048, 32 query heads sharing 8 key–value heads, |V|=128256).
- Secret adapters: LoRA on the query/value projections of each layer, trained on WikiText-2 with the same language-modelling loss for 300 steps. The main configuration is 10 rank-one GPT-2 adapters; the rank 4, rank 8, and Llama configurations have 3 each.
- Prompts and interface: two-token prompts are drawn from legal tokens; 16-token prompts are sampled from the public base; 64-token prompts come from FineWeb-Edu or from WikiText windows that do not overlap with training or evaluation. Interfaces include full, top-20, top-5, and all positions, with logit bias disabled.
- Precision and real serving: victims run under fp64, fp32, bf16 weights+fp32 arithmetic mixed, and all bf16; the attacker always uses fp64. There is also an experiment with merged bf16 GPT-2 on vLLM 0.19.1 on an L40S.
- Metrics and references: reports εQ, εV, ε, ρ, and query cost; bf16 uses ρ/ρredeploy. ρ is computed on 64 WikiText-2 segments, and redeployment changes rounding through batch composition.
- Repetition and criteria: each row of Table 2 takes the worst case over the N adapters of that configuration; there is no LLM judge or human judgment. The fp64 success threshold is all three errors ≤10−4, and low precision is judged by the noise floor or the redeployment ratio.
Main Results
According to Table 2; fp64 rows are the two-token chain, top-k rows are direct fit, and values are the worst case over the adapters in that row.
Swipe horizontally to read the table
Model r Interface/arithmetic εQ εV ε Queries Floor reached GPT-2 small 1 full/fp64 3.0×10−8 2.4×10−10 2.3×10−8 5000§ rounding, 10/10 GPT-2 small 4 full/fp64 3.5×10−7 4.7×10−10 2.3×10−7 5000 rounding, 3/3 GPT-2 small 8 full/fp64 3.6×10−7 3.5×10−10 2.5×10−7 23,000 rounding, 3/3 Llama-3.2-1B 1 full/fp64 1.3×10−5 4.6×10−8 1.2×10−5 8500§ rounding, 3/3 GPT-2 small 1 top-20/fp64 1.2×10−12 2.7×10−13 9.6×10−13 10,500 rounding, 1/1 GPT-2 small 1 top-5/fp64 6.7×10−13 2.1×10−13 5.3×10−13 40,500 rounding, 1/1 GPT-2 small 1 full/fp32 3.6×10−3 4.4×10−4 2.7×10−3 5000 noise 10−3, 5/5 GPT-2 small 1 full/mixed 4.9×10−3 4.4×10−4 3.7×10−3 5000§ noise 10−3, 10/10 - Stagnation cost: the two adapters in § rows require fresh pools; in fp64 they total 15,000 and 20,000 prompts respectively, in mixed 10,000 and 20,000 respectively, and one Llama adapter requires 12,000 (Table 2 footnote, Appendix C).
- Behavioral fidelity: for the fp64 rows above, the worst-case ρ is between 1.7×10−16 and 4.3×10−16, and 6.1×10−17 for Llama; the authors state that the difference between clones and victims is at the level of double-precision rounding.
- Architectural exception: the error in the first three Llama layers stalls at 10−6 to 5×10−5; the authors attribute this to near-zero gains of input normalisation on 74, 12, and 3 coordinates, and after weighting by gains it is at the floor of the other layers.
Query Lower Bound and Increment Composition
- Boundary experiment: Figure 3 and Table 4 vary m on three GPT-2 adapters. At m=768=d, layers 2–12 are full rank, but layer 1 has only 759 distinct last tokens, and all three adapters fail to recover; at m=784, εQ for A1–A5 is 3.4×10−8 to 3.0×10−7.
- Lower-bound property: at m=500, the relative norm of the part outside the span is 0.46–0.58; the authors state that no solver can recover the part outside the probes' span, that the fit residual does not detect the m=768 failure, whereas the rank check does.
- Both increments are necessary: the text annotations in Figure 4 show that clones with only ∆̂Q give ρ=0.77–0.82, with only ∆̂V give 0.23–0.26, and with both give ≤1.5×10−16; the main text gives corresponding ranges of 0.77–0.84, 0.21–0.26, and ≤1.7×10−16 for ten adapters.
Truncation, bf16, and Real Serving
- Effect of prompt length: Figure 5a compares direct fit with the value increment fixed, top-20, and 5000 prompts; the authors state that 16-token prompts reach the fp64 floor from two random starting points, whereas 2-token prompts stall even from a starting point at |cos|=0.9 from the true value. For the whole adapter with top-5, the first layer is still wrong at 20,000 prompts, and the floor is reached only after fitting further at 40,000.
- GPT-2 bf16 parameters and behavior: with 16-token, full interface, m=10⁴, least squares gives εQ=0.24, εV=0.12, ε=0.20; ridge selected on held-out data lowers ε to 0.12. Table 6 gives their ρ/ρredeploy as 1.09 and 1.06 respectively.
- vLLM and composition limits: on vLLM, least squares gives ε=0.155 and ridge gives 0.098, and the least-squares clone has ρ/ρredeploy=1.06 (Tables 2, 6). With top-20 plus bf16 and only the read-out position returned, ridge still gives ε=0.48 at m=10⁴; after returning all positions and using 64-token prompts, ridge gives ε of 0.09–0.11 for the three adapters, with ratio at most 1.10.
- Llama bf16: in the Table 2 configuration of 64-token web+BOS, top-20 all positions, m=2500, the held-out/best-strength ratios for the three adapters are 1.28/1.27, 1.28/1.28, and 1.77/1.28; these solutions are linearized at the true increment. The authors state that format mismatch without BOS and held-out strength selection cause higher ratios.
Other Ablations and Analyses
- Re-seeding: in Table 5, spectral and three random directions all reach the floor; spectral uses 6 iterations, and the random draws use 7, 7, and 6 respectively.
- Return-value rounding: in Table 7, on one GPT-2 adapter, ε=5.1×10−3 at b=4, ε=3.8×10−5 at b=6, and ε=4.8×10−9 at b=10.
- Added-noise defense: in Table 8, σ=10−3 nats makes the chain quality gate fail, the solution without the gate gives ε=0.74, and the user cost is ρdef=8.2×10−7; the authors explicitly state that direct fit was not run under additive noise.
- Synthetic secrets: in Appendix H, two random rank-one secrets give εQ=5.2×10−2 and 1.8×10−2 under fp64, whereas ten trained adapters reach the floor; on this basis the authors do not treat equal-norm random secrets as a substitute for trained secrets.
- Fidelity regularity: in the random-perturbation experiments of Figure 6, the authors report that for ε≤0.3 all configurations approximately satisfy ρ=cε², with c varying by model and secret.
What are some points that can be further explored?
The authors list limitations including base/rank priors, rank-one direct fit, linearization, and model scale; the experiments also leave the question of direct fit under added noise.
Limitations and future directions noted by the authors
- Prior requirements: the attacker must know the base model, the modified projections and the rank (Section 6, Limitations).
- End-to-end scope: direct fit is run end-to-end only on GPT-2 rank one (Section 6, Limitations).
- Computational approximation: bf16 ridge solutions are linearised at the true increment, and the authors state that a nonlinearity check confirms to 2–3% (Section 6; Appendix B.11).
- Hardware dependence: fidelity ratios vary by 4–6% across GPUs; the Llama ratios in the paper all come from A100 (Section 6; Appendix B.12).
- Scale and selector: the largest model has 1.2B parameters; on Llama, the choice of held-out ridge strength costs 38% on one adapter (Section 6, Limitations).
- Random-secret evidence: the synthetic-secret comparison uses only two secrets (Section 6; Appendix H).
- Open questions: the gap between fp32 clones and the information bound is called by the authors a conditioning problem left for future work; the added-noise experiment only shows that σ=10−3 blocks the two-token chain, and direct fit has not yet been run under additive noise (Section 5.2; Appendix G).
Scope of the experiments
- Models and adapters: the models tested are GPT-2 small and Llama-3.2-1B, 2 in total; the main experiments include 10 rank-one GPT-2 adapters, and 3 each for rank 4, rank 8 and the Llama configuration (Section 5.1).
- Interfaces and precisions: covers full, top-20, top-5, prompt-position log-probabilities, and fp64, fp32, mixed, bf16; there are also vLLM 0.19.1 experiments (Section 5.1, Appendix D).
- Defence evaluation: includes top-k without logit bias, prompt log-probabilities, additive noise, weight/arithmetic precision and return-value rounding (Table 10; Appendix G).
- Queries and repetition: the standard chain is 5000 prompts, with fresh pools all counted; each prompt is sent only once, with no averaging over repeated responses (Appendix C).
- Evaluation method: ρ uses 64 WikiText-2 passages; the paper reports no human evaluation or LLM judge, and no total attack runtime (Section 3.3, 5.1).
Summarize the main content of the paper
The authors turn LoRA parameter extraction into response fitting and show that interface precision, returned coordinates and positions determine results more than increment magnitude.
This is a study of parameter-level model extraction against LoRA deployment: the attacker knows the public base, the modified projections, and the rank, can only submit legal tokens and read log-probabilities, and aims to recover the product of ∆Q and ∆V in each layer rather than to distill behavior.
- Method: under the full high-precision distribution, the two-token chain inverts each head's response into an attention weight, then forms bilinear measurements and solves layer by layer for the low-rank solution; under top-k or bf16, 16–64 token prompts are used for joint direct fit, with ridge added under bf16. Proposition 1 gives the m≥d query lower bound for the chain.
- fp64 main results: all ten GPT-2 small rank 1 adapters reach the rounding floor with the standard 5000 queries, with worst-case ε=2.3×10−8 in Table 2; rank 4 and rank 8 have worst-case ε of 2.3×10−7 and 2.5×10−7 respectively.
- Cross-model results: the three rank-one adapters of Llama-3.2-1B reach worst-case ε=1.2×10−5 and ρ=6.1×10−17 with 8500 queries; the first three layers have higher error due to near-zero normalisation gains.
- Truncation is not sufficient protection: GPT-2 small fp64 direct fit reaches ε=9.6×10−13 and 5.3×10−13 under top-20 and top-5 respectively, with query costs of 10,500 and 40,500; the intermediate 20,000-prompt solution for top-5 once had an incorrect first layer.
- What bf16 means in practice: parameter error stays at the order of about 0.1–0.2, but the GPT-2 vLLM least-squares clone has ρ/ρredeploy=1.06; in the Llama BOS, top-20 all-positions configuration, the held-out ratios for the three adapters are 1.28, 1.28, and 1.77.
- Authors' conclusions and boundaries: the authors state that the degree of protection is determined by the interface's precision, truncation, returned positions, and noise, not by the increment size; added noise of σ=10−3 nats can block the chain, but direct fit was not run under that noise. The attack still requires priors such as base/rank, the end-to-end evidence for direct fit is limited to GPT-2 rank one, and the largest model is 1.2B parameters.