Motivated by Large Language Model (LLM) cascading, we propose an online contextual Pandora's Box model for adaptively querying and selecting LLM APIs. In each period, a decision-maker observes a request context and faces a two-phase decision problem. In the query phase, the decision-maker sequentially queries APIs, where each query reveals a generated output and the decision-maker incurs an (output-dependent) cost. In the selection phase, the decision-maker selects one of the generated outputs to deploy and observes only the downstream reward of the deployed output. This output-mediated feedback structure differs from classical online contextual Pandora's Box models, in which opening a box directly reveals its reward. Rather than estimating the full conditional output and cost distributions of each API, we directly model the reservation index and develop a learning approach for the query phase. Specifically, we impose a parametric structure on the contextual reservation index functions induced by the classical Weitzman's policy. Our policy combines generalized method of moments (GMM) type estimation of these reservation indices with UCB-style confidence bounds for both these indices and the shared output-level reward evaluator. Under regularity conditions, we prove that the resulting policy achieves dimension-dependent $\widetilde O(\sqrt T)$ cumulative regret over a horizon of $T$ periods.
翻译:受大语言模型(LLM)级联应用的启发,我们提出了一种在线语境潘多拉魔盒模型,用于自适应查询与选择LLM应用程序接口。在每个周期内,决策者观察到请求上下文后需要解决两阶段决策问题:在查询阶段,决策者依次调用API,每次调用会生成一个输出结果并产生(与输出相关的)成本;在选择阶段,决策者从已生成的输出中选取一个进行部署,并仅能观测到该部署输出的下游收益。这种基于输出的反馈机制与经典在线语境潘多拉魔盒模型存在根本差异——后者打开盒子即可直接获知奖励。我们无需估计每个API的完整条件输出分布与成本分布,而是直接建模保留指数,并针对查询阶段开发出相应的学习方法。具体而言,我们基于经典Weitzman策略对语境保留指数函数施加参数化结构,采用广义矩估计(GMM)型估计方法结合UCB风格置信区间来同时估计保留指数与共享输出级奖励评估器。在正则性条件下,我们证明该策略在周期长度为T的决策时间域上可实现维度相关的$\widetilde O(\sqrt T)$累积遗憾界。