arXiv:2610.29918cs.LGOct 2026

Manuscript Offprint

arXiv:2610.29918

Preventing Model Extraction in Contextual Linear Optimization

Adam N. Elmachtoub, Tianyi Lin, Wenxuan Liu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Consider a contextual linear optimization problem, where a predict-then-optimize (PTO) system returns optimal decisions without revealing the cost vectors used in its downstream linear program. Our focus is on how to prevent attackers, who can submit context queries, from extracting the underlying prediction model. Although the cost-to-decision map is many-to-one, observations across contexts can reveal the underlying prediction model. For linear models, we provide sufficient conditions where the attacker can learn the model up to positive scaling by only observing the decision. These conditions motivate an adaptive attack that alternates inverse optimization with boundary sampling, i.e., using context queries leading to decision boundaries of the current attacker model. To prevent extraction, we propose a mechanism that perturbs decisions only when the predicted cost vector is near a decision boundary. We establish a regret bound in terms of the perturbation radius. For the attackers that fit the defended responses as optimal decisions under the evaluation distribution, we also prove a lower bound on expected extraction error. Experiments on synthetic instances and real data quantify the security-performance tradeoff of the defense mechanism and illustrate that our defense can increase the extraction error.

1 INTRODUCTION

Many decision-making problems can be formulated as optimization problems whose parameters are unknown and must be inferred from contexts. For example, a recommendation system uses user features to predict click probabilities before optimizing which items to display. In portfolio optimization, asset returns must be estimated before making allocation decisions. This class of problems is referred to as contextual optimization (Sadana et al., 2025). A widely adopted approach to contextual optimization is the predict-then-optimize (PTO) framework (Elmachtoub and Grigas, 2022). In the linear optimization setting studied here, PTO proceeds in two stages: (i) a machine learning (ML) model predicts the unknown objective cost vector from a given context and (ii) the predicted cost vector is used to solve the downstream linear optimization problem and produce a decision. Due to its modularity and empirical effectiveness, PTO has been successfully applied across a broad range of application domains, including recommendation systems, e-commerce, logistics, and resource allocation.

This setting raises a model-security question: can an attacker recover the hidden prediction model by interacting only with the optimization system's decision outputs? Such a threat is known as a model extraction attack: the attacker repeatedly queries the deployed system with contexts (perhaps through an API) and uses the returned decisions to build a substitute prediction model. Successful extraction can allow the attacker to replicate the service while bypassing access costs or usage restrictions, and moreover, can provide a stepping stone for user privacy or inference attacks (Narayanan and Shmatikov, 2008; Papernot et al., 2017; Shokri et al., 2017; Salem et al., 2019; Juuti et al., 2019) and information leakage (Tan et al., 2016; Zhang et al., 2023). At first glance, the optimization layer appears to make extraction difficult. The attacker does not observe predicted costs directly, and the map from costs to optimal decisions is many-to-one in linear optimization. This intuition is incomplete: the same polyhedral geometry that hides costs in the interior of normal cones creates boundary contexts where small changes in predicted costs change the returned decision. This leads to two central questions: (i) when do decision-level observations identify the underlying prediction model, and (ii) how can we mitigate extraction while preserving decision quality?

Existing approaches do not answer these questions directly. Prior work on privacy in contextual decision-making has studied differential privacy (DP) (Lei et al.,

(2024), which protects training data but does not directly defend the deployed predictive model against extraction. A second related line is inverse optimization (Chan et al., 2025), which infers unknown parameters of an optimization problem from observed optimal decisions. While inverse optimization includes both fixed-parameter and contextual formulations, our focus is on whether decision-level observations identify the deployed predictor. More importantly, because the decision map is many-to-one, decision consistency does not in general imply prediction recovery.

In this paper, we focus on model extraction in contextual linear optimization. First, we study vulnerability through a loss calibration condition that links global inverse feasibility consistency to prediction recovery. Motivated by this condition, we then develop an adaptive attack that combines inverse optimization with boundary sampling to reconstruct the hidden predictor using only decision-level observations. This insight motivates a defense that perturbs the returned decision only when the deployed predictor's cost vector is near a decision boundary. Our theory establishes a regret bound for linear predictors and a lower bound on expected prediction error under a response-matching condition. Our experiments on synthetic instances and real data examine the security-performance trade-off.

Contributions. We formalize model extraction in contextual linear optimization under the predict-then-optimize paradigm and study when the decision-level observations identify the predictor and how to mitigate extraction while limiting the loss in decision quality. Our contributions are summarized as follows:

  • We identify loss calibration as a vulnerability criterion: if it holds, global inverse feasibility consistency is sufficient for prediction recovery up to positive scaling. For linear predictors and unrestricted contextual queries, we use boundary contexts to establish this identification result under sufficient geometric and regularity conditions. This motivates an adaptive attack that alternates inverse optimization with boundary sampling, which targets contexts near decision boundaries of the current attacker model.

  • We propose a decision perturbation defense that randomizes only near decision boundaries and prove a regret upper bound that is linear in the boundary radius. For attackers that fit the defended responses as optimal decisions under the evaluation distribution, we also prove a lower bound on expected prediction error. This lower bound is nondecreasing in the boundary radius.

  • We evaluate the attack and defense on synthetic instances and a short video recommendation task. In the tested settings, boundary sampling achieves lower prediction error than the non-adaptive inverse-optimization baseline, while the proposed defense can increase the prediction error of the evaluated attacks at modest regret.

Related work. Privacy in contextual optimization has been studied through differential privacy, including personalized pricing and revenue management (Chen et al., 2022, 2023; Lei et al., 2024; Mochaourab et al., 2021; Sun et al., 2025; Chowdhury and Zhou, 2023; Fu et al., 2026; Selvi et al., 2026). These works are complementary to ours: DP protects data privacy, whereas we study model extraction attacks that target the deployed predictor itself. In model extraction attacks, the goal is to recover a substitute model via query access to a target system (Wang and Gong, 2018; Reith et al., 2019; Orekondy et al., 2019; Milli et al., 2019; Chandrasekaran et al., 2020; Pal et al., 2020; Truong et al., 2021; Huang et al., 2024; Ferry et al., 2024; Khouna et al., 2025; Gorgé et al., 2026). Our work is also related to adaptive query attacks (Tramèr et al., 2016; Zhao et al., 2025). In our setting, the attacker observes downstream decisions but not predicted cost vectors. Since the prediction-to-decision map is generally many-to-one, we examine how the geometry of the downstream feasible set affects predictor recovery.

Another related line concerns inverse optimization, which infers unknown problem parameters from observed decisions (Chan et al., 2014; Aswani et al., 2018; Babier et al., 2021; Sun et al., 2023; Besbes et al., 2025; Chan et al., 2025; Patel and Vempala, 2026). We use inverse optimization to study when decision consistency identifies the underlying predictor.

Notation. We write x∥yx \parallel y for parallel vectors and ∠(x,y)\angle(x, y) for the angle between two nonzero vectors. The polyhedral cone generated by a1,…,aka_1, \ldots, a_k is denoted by polycone {a1,…,ak}\{a_1, \ldots, a_k\}. For a polytope S⊆RnS \subseteq \mathbb{R}^n, we let VV denote its vertex set. For a vertex w∈Vw \in V, we denote cone( ww) as its normal cone: the set of cost vectors c∈Rnc \in \mathbb{R}^n satisfying c⊤(u−w)≥0c^\top(u - w) \geq 0 for all u∈Su \in S. We also denote by NV(w)={v∈V:dim⁡(cone(v)∩cone(w))=n−1}N_V(w) = \{v \in V : \dim(\text{cone}(v) \cap \text{cone}(w)) = n - 1\} the set of vertices whose normal cones share a facet with cone( ww). For c≠0c \neq 0, its angular distance to cone( ww) is ∠(c,cone(w))=inf⁡u∈cone(w)∖{0}∠(c,u)\angle(c, \text{cone}(w)) = \inf_{u \in \text{cone}(w) \setminus \{0\}} \angle(c, u).

References (38)