Skip to content

OptiLeak: Efficiently Reconstructing Prompts with Reinforcement Learning in Multi-Tenant LLM ServicesOptiLeak: Efficient Prompt Reconstruction via Reinforcement Learning in Multi-tenant LLM Services

arXiv· arXiv:2602.20595· Longxiang Wang, Xiang Zheng, Xuhao Zhang, Yao Zhang, Ye Wu, Cong Wang·Indexed by this site · 2026-10-12· Originally publishedAttacks

Quick read

Attacks

Based on the paper PDF (AI-generated); refer to the original

OPTILEAK's two-stage fine-tuning optimizes prompt leakage; the authors claim ARPT is reduced by 12.48× on FinanceBench, Qwen-2.5-3B.

Threat modelThe attacker aims to reconstruct other clients' prompts through a cache side channel. Knowledge is black-box: the model structure and parameters are unknown, the specific template and original text are unknown, but the general domain of the query is known, and a public tokenizer can be used. Queries with a limit on the number of attempts can be sent, and TTFT can be measured to detect cache hits; internal logs cannot be viewed, configurations cannot be changed, and other channels cannot be accessed. The victim system is a multi-tenant LLM service sharing the same KV cache pool.

Questions
Multi-tenant LLM services share KV caches, and hits can change TTFT or scheduling order, thereby leaking other users' prompts. The authors say prior work expanded the attack surface, but request costs are high and underestimated attackers who have domain data and optimize probing.
Methods
OPTILEAK first performs SFT on domain auxiliary data, then uses token likelihood ranking to automatically identify hard tokens, pairs them with high-confidence erroneous tokens from greedy decoding, and performs DPO. The attack sends probe batches token-by-token under SGLang's LPM, using response position intervals to determine hits.
Experiments and results
In Table 1, OPTILEAK's ARPT is lower than Base, SFT, and DPO-only across four local models and three benchmarks. The authors state that FinanceBench, Qwen-2.5-3B decreases by 12.48× relative to Base. ARPT increases with wrong-domain training or when SFT is extended to 3000 steps.
Limitations and future work
The paper does not list limitations separately; Section 6 lists designing validators for other scheduling policies and inference engines as future directions. The experimental server is fixed to Qwen-2.5-3B-Instruct, and distribution shift is only reported for this 3B local model; γ, β, θ, and repetition counts are not reported.
Experimental setupQwen-2.5-3B-Instruct、Qwen-2.5-7B-Instruct et al. · MedQA、PubMedQA et al. · ASR500、ASR1000 et al.
Evaluated models
Qwen-2.5-3B-InstructQwen-2.5-7B-InstructQwen-2.5-14B-InstructLlama-3.1-8B-Instruct
Benchmarks
MedQAPubMedQAFinanceBench
Metrics
ASR500ASR1000ASR10000ARPTw/l
AI summaryThe researchers propose OptiLeak, a framework that uses reinforcement learning to improve prompt reconstruction efficiency in multi-tenant LLM services, reducing the average number of requests per token by up to 12.48 times compared to baselines across three benchmarks in medical and financial domains. The method uses two-stage fine-tuning: first, automatically identify hard domain tokens that carry sensitive information and are hard to predict via likelihood ranking, then construct preference pairs with these tokens for direct preference optimization, eliminating manual annotation and avoiding overfitting from extended supervised fine-tuning. Consistent improvements are observed on models ranging from 3B to 14B parameters. The authors claim the prompt leakage threat based on shared KV cache is more severe than previously reported, and production deployments need stronger cache isolation.

The researchers propose OptiLeak, a framework that uses reinforcement learning to improve prompt reconstruction efficiency in multi-tenant LLM services, reducing the average number of requests per token by up to 12.48 times compared to baselines across three benchmarks in medical and financial domains. The method uses two-stage fine-tuning: first, automatically identify hard domain tokens that carry sensitive information and are hard to predict via likelihood ranking, then construct preference pairs with these tokens for direct preference optimization, eliminating manual annotation and avoiding overfitting from extended supervised fine-tuning. Consistent improvements are observed on models ranging from 3B to 14B parameters. The authors claim the prompt leakage threat based on shared KV cache is more severe than previously reported, and production deployments need stronger cache isolation.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Shared KV caches can leak prompts through side channels, and previous attacks require many requests; OPTILEAK uses two-stage fine-tuning to improve reconstruction efficiency.

    Shared KV cache creates a prompt leakage side channel in multi-tenant LLM services; the authors claim existing attacks have request costs that are impractical.

    • Scenario: Frameworks like vLLM and SGLang share KV cache across requests and are starting to offload cache to CPU or persist it. The authors claim cache hits reduce TTFT, and schedulers like longest prefix matching change response order, exposing other users' queries; the more persistent the cache, the more this privacy risk needs evaluation.
    • Shortcomings of existing methods: The authors claim Zheng et al. (2024), Song et al. (2024), and Wu et al. (2025) mainly expand the attack surface without exploiting the side channel according to a realistic adversary's optimization capability. The introduction states that extractions reported by Gu et al. (2025) and Luo et al. (2025) require many requests, thus underestimating leakage severity and hindering countermeasure design.
    • Core observation: Attackers can infer the general domain of queries from application context, service endpoints, or metadata, and fine-tune a local model on public domain data. The authors believe longer SFT is prone to overfitting because domain QA is still dominated by general language; PPO and GRPO rewards are also hard to design, as semantic similarity fits surface patterns while exact token matching provides insufficient feedback.
    • This paper proposes: OPTILEAK, a two-stage fine-tuning framework: first SFT, then use likelihood ranking to automatically label hard tokens, construct preference pairs, and perform DPO, then reconstruct prompts token by token via an order side channel. The authors claim this formalizes attacker optimization in cache prompt leakage.
    • Threat model:
      • Goal: Reconstruct prompts sent by other victim clients to the server.
      • Knowledge: Capabilities equivalent to an ordinary LLM client, with only black-box access, unable to know model structure or parameters; knows the general domain of queries, not the specific template and original text; can use public tokenizers. The service returns in a streaming manner.
      • Capabilities: Can send queries (with a maximum limit per victim query) and measure TTFT to detect cache hits; cannot view internal logs, modify server configuration, or directly access other users' channels.
      • Victim system: Multi-tenant LLM inference service. The authors assume victim and attacker queries fall into the same KV cache pool; experiments use SGLang's Longest Prefix Match (LPM). This assumption is consistent with Wu et al. (2025), Zheng et al. (2024), and Song et al. (2024).
  2. What related research exists?

    The paper divides related work into active/passive cache side channels and RL red teaming, and positions this work as optimizing probing rather than expanding the attack surface.

    Active cache side channels

    • Scheduling and timing: Wu et al. (2025) exploit service order such as longest prefix matching to leak information when probe and target queries match; Zheng et al. (2024) use timing to determine whether a probe hits the cache; Song et al. (2024) analyze timing side channels in LLM serving systems. The paper says these works mainly demonstrate the attack surface rather than optimizing probe query generation.
    • Hardware caches: Adiletta & Sunar (2025) and Gao et al. (2025) infer the positions of accessed embeddings by monitoring hardware cache changes, thereby inferring user queries.
    • Cost: The introduction says Gu et al. (2025) and Luo et al. (2025) show that extraction usually requires a large number of requests. The paper uses this to argue that unoptimized attacks underestimate the risk.

    Passive side channels

    • Traffic and timing fingerprints: Weiss et al. (2024) infer character lengths of response tokens from encrypted traffic, thereby inferring user prompts; Zhang et al. (2024a) use timing patterns of response generation to identify queries. Appendix C also writes that Wei et al. (2024) and Soleimani et al. (2025) use speculative decoding to build query fingerprints. The paper limits itself to active side channels, with passive attack details in Appendix C.

    RL red-teaming

    • Jailbreaks: Paulus et al. (2024), Chen et al. (2024), and Tang et al. (2024) use RL to strengthen jailbreaks to bypass victim models' guardrails and alignment.
    • Harmful outputs: Perez et al. (2022), Casper et al. (2023), Zheng et al. (2025), and Zhao et al. (2025) use RL to make models generate responses containing toxic content, sensitive terms, or factual errors.
    • Privacy extraction: Nie et al. (2025) use word-edit similarity as a reward for system prompt extraction and training data extraction. The paper says OPTILEAK's scenario is different: it optimizes probing strategies to recover users' real-time prompts via cache sharing.

    Baselines and benchmarks

    • Comparisons: Wu et al. (2025)'s base local model directly predicts, as well as SFT-only and automatically labeled DPO without SFT. Benchmarks are MedQA, PubMedQA, and FinanceBench.

    The authors distinguish this work from the above active side-channel works by writing: it does not expand the attack scenario, but uses RL to optimize probe query generation to estimate real adversary capabilities.

  3. How does the paper address this problem?

    OPTILEAK first performs domain SFT, then automatically constructs hard token preference pairs by likelihood ranking and performs DPO, then probes token by token.

    OPTILEAK has two stages: first fine-tune the local model to the attacker-known domain, then probe token by token under SGLang's LPM scheduling, using response order to determine cache hits. Overview in Figure 2, steps in Algorithm 1 in the appendix.

    Problem Setting

    • Auxiliary data: The attacker has a domain auxiliary set Daux, with samples as concatenations of user queries and model responses. The paper assumes the attacker only knows the general domain, not the victim prompt template or original text.
    • Recovery unit: Each round recovers one token of the target prompt. The recovered prefix is denoted as q<t。整段攻击在完整重构或达到每 token 最大尝试次数时停止。
    • 侧信道:受害查询的 token 写入共享 KV cache。攻击者发送一批哑查询,观察响应顺序和 TTFT。LPM 会优先调度前缀匹配更长的等待请求。

    监督微调

    • 目标:在 Daux 上最大化拼接序列每个 token 的条件似然,得到 πSFT,使本地模型熟悉该领域的说法。
    • 不再加长 SFT 的理由:作者在实验中发现增加 SFT epoch 会降低攻击表现,并归因于过拟合和 mode collapse。第 4.1 节称延长 SFT 会使猜测次数增至基线的 3.70×;具体步数在第 4 问。

    hard token 自动标注与 DPO

    • 排名:用 πSFT 对每个位置的目标 token 在词表 V 上的似然排名。论文把恢复难度写成该排名,hard token 满足 Rank(st)>γ. Higher rank means harder to recover.
    • Preference pairs: Tokens above the threshold and their prefixes form preferred responses; on the same prefix, greedy decoding with πSFT yields high-confidence but incorrect tokens as non-preferred responses. No manual annotation needed.
    • Example: Figure 2 illustrates with a medical phrase, where a token's likelihood rank is 478, and after exceeding the threshold, it forms a pair with the SFT-sampled token. The paper does not give the value of γ.
    • DPO: Optimize πSFT on the above preference set. The reference model is initialized from πSFT and fixed, with β controlling the KL strength relative to the reference model. The paper does not give β. The authors claim this focuses alignment on hard-to-predict tokens carrying domain information and avoids superficial fitting of semantic rewards.

    Order-Based Cache Probing

    • Batch construction: When guessing position t, send k=2m+|Qgen| queries. The generated candidates are sandwiched between two groups of m dummy queries each. Dummy queries share the same low-probability token given by the local model; candidates share the recovered prefix, differing only in the last token. Experiments set both m and the number of candidates to 20.
    • Hit rule: If the minimum position difference between a candidate's response position and the rest is greater than ceil(θ·m), it is judged a hit and the token is appended. θ∈(0,1), the paper does not give the value. If no hit, continue generating until a hit or reaching the per-token attempt limit.
    • Decoupling from feedback: The authors claim query generation is separated from side-channel verification, so the verifier can be swapped when changing scheduling strategies. The compatibility discussion in Section 6 does not provide another implementation.
  4. What experiments did the paper conduct?

    In Table 1, OPTILEAK's ARPT is lower than Base, SFT, and DPO-only across four local models and three benchmarks.

    Experimental Setup

    • Models: Local backbones are Qwen-2.5-3B-Instruct, Qwen-2.5-7B-Instruct, Qwen-2.5-14B-Instruct, and Llama-3.1-8B-Instruct. The server model is fixed to Qwen-2.5-3B-Instruct for all experiments, so the 3B row's local model is the same as the server. The serving framework is SGLang.
    • Data: MedQA English subset original split is 10178/1272/1273; evaluation samples 150 randomly from the test set; the paper does not specify whether fine-tuning uses all 10178. PubMedQA uses 1000 expert-annotated items, split 800/100/100. FinanceBench has no official split; randomly split 400/50/50.
    • Baselines: Base is Wu et al. (2025)'s base local prediction; also SFT, and DPO without SFT, directly training the base with auto-labeled data. OPTILEAK is SFT followed by DPO.
    • Metrics: ASR is the prompt leakage attack success rate under different maximum request limits. The text example writes ASR10000 to mean a 1000-request limit, which does not exactly correspond to the column name ASR10000; the table below references Table 1's column names. ARPT is the average number of effective requests to recover one token. w/l is the proportion of queries where the optimized model requires fewer requests than the base.
    • Protocol: All methods use the same prompt prefix to issue reconstruction instructions and start autoregressive generation. m and candidate count are both 20, consistent with Wu et al. (2025). Hits are determined by response position intervals; the paper does not use LLM judges and does not report repetition counts.

    Main Results

    ARPT on FinanceBench (Table 1; server is Qwen-2.5-3B-Instruct for all):

    Swipe horizontally to read the table

    Local ModelBaseSFTDPO-onlyOPTILEAK
    Qwen-2.5-3B-Instruct240.8120.81238.8119.29
    Qwen-2.5-7B-Instruct259.6569.63246.3866.87
    Qwen-2.5-14B-Instruct214.1939.49213.4636.31
    Llama-3.1-8B-Instruct286.5237.91248.6933.89
    • Other two benchmarks: In Table 1, OPTILEAK's ARPT relative to Base: on MedQA, 3B/7B/14B/Llama are 21.60/40.49/30.60/28.31, with Base at 41.99/54.50/44.35/60.00; on PubMedQA, 208.72/274.91/304.76/241.48, with Base at 628.50/943.05/796.08/801.71. The authors state that the finance domain shows larger improvements because domain language patterns are more consistent; they also state that larger models do not consistently outperform smaller ones. The lowest OPTILEAK ARPT across all three benchmarks comes from Qwen-2.5-3B-Instruct. The authors also state that this 3B model has the highest ASR on two benchmarks; on PubMedQA, Llama-3.1-8B-Instruct's OPTILEAK ASR500/ASR1000 are 14.0%/33.0%, higher than the 3B's 11.0%/31.0%.
    • SFT and DPO-only: The authors state that SFT is a key component. On Qwen-2.5-3B, MedQA, ASR1000 goes from 37.3% to 53.3%, which the authors call a 16.0% improvement; ARPT goes from 41.99 to 26.37, which the authors call a 37.2% reduction. DPO-only's ARPT is close to Base. The authors state that DPO-only's w/l can exceed 50.0%; in Table 1, MedQA, Qwen-2.5-3B DPO w/l is 48.7%, and PubMedQA, Qwen-2.5-14B is 40.0%.
    • Relative to what the 12.48× reduction is: The authors state that FinanceBench, Qwen-2.5-3B's ARPT reduction relative to Base is 12.48×, not relative to SFT. In that row, SFT and OPTILEAK have the same ASR500/ASR1000/ASR10000: 88.0%, 90.0%, 100.0%. The authors state that SFT followed by DPO, on MedQA, Qwen-2.5-3B, reduces ARPT from 26.37 to 21.60, a relative reduction of 18.1%, with other settings around 10%.

    Prior Knowledge and Distribution Shift

    • What was tested: Section 5.3 uses only Qwen-2.5-3B-Instruct, comparing no prior, same domain but different distribution, same distribution, and wrong domain judgment. The metric is ARPT (Table 2).
    • Results: When testing MedQA, Base is 41.99; training with PubMedQA gives 30.27 (the authors write 27.9%↓), with MedQA gives 21.60 (48.6%↓), with FinanceBench gives 51.90 (23.6%↑). When testing PubMedQA, Base is 628.50; training with MedQA gives 484.42 (22.9%↓), with PubMedQA gives 208.72 (66.8%↓), with FinanceBench gives 966.59 (53.8%↑).
    • Authors' interpretation: When the domain is similar but still shifted, ARPT remains lower than Base. When the domain is completely misaligned, ARPT increases; the authors state that the fine-tuned model tends to generate tokens from the training domain, thus deviating from the victim's query.

    Training Steps Ablation

    • What was tested: Figure 3 shows ARPT during SFT on MedQA and FinanceBench, and DPO after selected SFT checkpoints. The caption states the SFT steps on which DPO is based: MedQA 500, FinanceBench 100. The text does not list curve values point by point.
    • Results: The authors state that all models show ARPT decreasing early in SFT, then rising; MedQA is more prone to overfitting, with ARPT rising to 3.70× the base after 3000 steps. Section 4.1 uses the same multiplier for guess counts and attributes it to overfitting and mode collapse. The authors state that DPO, because it only fine-tunes hard tokens, keeps ARPT more stable throughout.
    • Authors' interpretation: The optimal checkpoints for SFT and DPO vary with model scale and need to be tuned on a validation set.

    Other Ablations and Analyses

    • Table 1, PubMedQA, Qwen-2.5-3B: OPTILEAK's ASR500 is 11.0%, lower than SFT's 12.0%; ASR1000 is 31.0%, SFT is 28.0%.
    • Table 1, MedQA, Qwen-2.5-7B: OPTILEAK's ASR500/ASR1000 are 22.7%/48.0%, SFT is 24.0%/49.3%; ASR10000 is 96.0%, SFT is 94.7%.
    • Table 1, PubMedQA, Qwen-2.5-7B: OPTILEAK's ASR500 is 6.0%, lower than SFT's 9.0%.
    • Table 1, PubMedQA, Qwen-2.5-14B: DPO-only's w/l is 40.0%, ASR10000 is 59.0%, Base is 58.0%.
    • The paper does not report scans of γ, β, θ values, nor statistical significance tests.
  5. What are some points that can be further explored?

    The paper does not list limitations separately; Section 6 lists designing validators for other schedulers and inference engines as future work.

    Limitations and Future Directions Noted by the Authors

    • Verifiers for other platforms: Section 6 states that designing specialized verifiers for schedulers and inference engines other than LPM is a key future direction to further understand the actual cache side channel. The paper does not have a dedicated Limitations section; the discussion, conclusion, and appendix do not frame any experimental result as a method limitation.

    Experimental Coverage

    • Models: Local backbones are Qwen-2.5 3B, 7B, 14B-Instruct and Llama-3.1-8B-Instruct; the server for all experiments is Qwen-2.5-3B-Instruct (Sections 5.1–5.2, Table 1).
    • Data and metrics: Evaluation sizes are MedQA 150, PubMedQA 100, FinanceBench 50. Metrics are ASR500, ASR1000, ASR10000, ARPT, and w/l. Hits are determined by position intervals, with no LLM evaluation.
    • Comparisons and shifts: Table 1 compares Base, SFT, DPO-only, and OPTILEAK. Distribution shift is only reported on Qwen-2.5-3B-Instruct (Table 2), with training sources being MedQA, PubMedQA, FinanceBench, or no prior.
    • Ablations and attack channel: Training step ablations cover MedQA and FinanceBench (Figure 3), with SFT checkpoints in the caption at 500 and 100 steps. The implemented channel is LPM on SGLang, with m and candidate count both 20.
    • Experiment information not reported in the paper: Values of γ, β, θ, number of repetitions, number of MedQA fine-tuning samples, and statistical significance tests. Section 6 discusses compatibility with FCFS, TTFT side channels, vLLM, and semantic caching, and also discusses estimating queries needed for leakage via simulated attacks and evicting cache beforehand, but these settings have no ARPT or ASR.
  6. Summarize the main content of the paper

    OPTILEAK uses SFT and hard-token DPO to reduce requests per token; the authors state that the risk of cache prompt leakage is higher than previously reported.
    • Positioning: OPTILEAK is an active prompt reconstruction attack against shared KV cache in multi-tenant LLM services, using reinforcement-learning-style preference optimization to improve probing efficiency, rather than adding another side channel.
    • Problem: Cache hits change the response order under TTFT or LPM. The authors claim previous attacks could recover other people's prompts, but with a high number of requests, underestimating adversaries who know the query domain and can fine-tune local models.
    • Method: The local model is first SFT on domain auxiliary data, then automatically identifies hard tokens by token likelihood ranking, forms preference pairs with wrong tokens from greedy decoding, and performs DPO. Probing is done token by token on SGLang, with candidate queries sandwiched between dummy queries, using response position intervals to determine hits. In experiments, m and the number of candidates are both 20, and the server is fixed to Qwen-2.5-3B-Instruct.
    • Main results: In Table 1, OPTILEAK's ARPT on MedQA, FinanceBench, and PubMedQA for four local models is lower than Base, SFT, and DPO-only. The authors claim a 12.48× reduction relative to Base on FinanceBench, Qwen-2.5-3B; in that row, SFT's ARPT is already 20.81, OPTILEAK is 19.29, and the three ASRs are the same as SFT. The authors claim that DPO after SFT further reduces ARPT by 18.1% relative to SFT on MedQA, Qwen-2.5-3B. The lowest ARPT on all three benchmarks comes from 3B, not 14B.
    • Exceptions: DPO-only's ARPT is close to Base, and Table 1 has cells with w/l below 50.0%. ARPT increases with out-of-domain training; in Table 2, testing on PubMedQA with FinanceBench training increases by 53.8%. On MedQA, after training SFT to 3000 steps, ARPT rises to 3.70× the base.
    • Authors' conclusion: The authors claim that the optimized attacker makes cache prompt leakage more severe than previously reported, so production deployments need reliable cache isolation. Section 6 also discusses using the same process as a service-side pre-eviction risk assessment, as well as existing mitigations such as user-level isolation, selective sharing, and response timing noise; these uses and mitigations are not given numbers in experiments.
Read originalarxiv.org