HyperAIHyperAI

Command Palette

Search for a command to run...

LLM

프롬프트 적응형 비용 인지 LLM 추론을 위한 앙상블 라우팅

Saul Urso Emanuele Carlini Patrizio Dazzi Matteo Mordacchini

초록

대규모 언어 모델(LLM)은 이질적인 요청 전반에서 응답 품질과 추론 비용을 균형 있게 조정해야 하는 웹 기반 서비스를 점점 더 많이 지원하고 있다. 기존 라우팅은 프롬프트마다 하나의 모델을 선택하는 반면, 고정 앙상블은 개별 요청에 맞게 구성과 비용을 조정할 수 없다. 본 연구에서는 프롬프트 적응형 비용 인지 단일 모델 라우터인 PISA와 이를 앙상블 라우팅으로 확장한 PISA-E를 소개한다. 두 방법의 핵심에서 PISA는 소프트 클러스터 소속도와 모델별 예측기를 결합하여 개별 모델의 역량을 추정한다. 이러한 추정치를 바탕으로 PISA-E는 재학습 없이 추론 시점에 조정 가능한 명시적 비용-품질 선호도 하에서 앙상블 구성과 크기를 공동으로 선택한다. 계산 가능한 앙상블 성공 대리 지표와 효율적인 후보 선택을 통해 앙상블 특화 학습 없이도 이러한 확장이 가능하다. 분포 내(ID) 및 분포 외(OOD) 조건의 네 가지 LLM 라우팅 벤치마크에서 PISA는 평가된 단일 모델 라우터 중 두 설정 모두에서 가장 높은 매크로 평균 비용-성능 하이퍼볼륨을 달성했다. 한편 PISA-E는 응답 품질을 우선시할 때 평가된 앙상블 접근법 중 가장 높은 매크로 평균 작업 성능을 달성하여, ID 및 OOD 조건에서 각각 최강 경쟁 모델을 2.09%p와 2.87%p 능가했다. 선택된 저비용 운영 지점에서는 최강 앙상블 경쟁 모델의 매크로 평균 작업 성능을 능가하면서도 평균 추론 비용을 각각 약 36%와 25% 절감했다. 이러한 결과는 단일 모델 라우팅과 선택적 앙상블 구성 모두에서 프롬프트 적응형 역량 추정의 효과를 입증한다.

One-sentence Summary

Researchers from CNR institutes and the University of Pisa propose PISA, a prompt-adaptive cost-aware single-model LLM router, and PISA-E, its ensemble extension, both using soft cluster memberships with model-specific predictors to estimate individual model capabilities; PISA-E jointly selects ensemble composition and cardinality under an adjustable cost-quality preference, surpassing the strongest competitors by 2.092.092.09 and 2.872.872.87 percentage points under in-distribution and out-of-distribution conditions while reducing average inference cost by approximately 36%36\%36% and 25%25\%25% at selected lower-cost operating points.

Key Contributions

  • The paper introduces PISA, a prompt-adaptive and cost-aware single-model router that combines soft cluster memberships with model-specific predictors to estimate prompt-dependent capabilities of individual models.
  • The paper presents PISA-E, an ensemble-routing extension that jointly selects ensemble composition and cardinality under an explicit cost-quality preference adjustable at inference time without retraining, using a tractable ensemble-success surrogate and efficient candidate selection without ensemble-specific training.
  • Across four LLM routing benchmarks under in-distribution and out-of-distribution conditions, PISA achieves the highest macro-average cost-performance hypervolume among the evaluated single-model routers. PISA-E achieves the highest macro-average task performance among the evaluated ensemble approaches when prioritizing response quality, surpassing the strongest competitors by 2.09 and 2.87 percentage points under ID and OOD conditions, and at selected lower-cost operating points exceeds the strongest ensemble competitors’ macro-average task performance while reducing average inference cost by approximately 36% and 25%, respectively.

Introduction

Large language models are increasingly deployed in web-based services such as search, recommendation, and intelligent agents, where providers must balance response quality against inference cost across heterogeneous user requests. Prior routing methods select a single model per prompt, which cannot exploit the complementary strengths of multiple LLMs, while existing ensembling approaches often fix ensemble cardinality, optimize only part of the cost-quality tradeoff, or rely on classification-specific aggregation or sequential execution. The authors introduce PISA, a prompt-adaptive and cost-aware single-model router, and PISA-E, an ensemble routing extension that reuses individual model capability estimates to select both which and how many models to invoke for each prompt. A key advantage is that the cost-quality preference can be adjusted at inference time without retraining or additional hyperparameter optimization.

Method

The authors propose a shared capability-estimation framework that supports both single-model and ensemble routing, referred to as PISA and PISA-E. This unified pipeline estimates the prompt-dependent capabilities of individual large language models and uses these estimates to perform cost-aware selection.

As shown in the figure below:

Shared Front-End and Capability Estimation The pipeline begins by mapping an input prompt qqq to an embedding x=f(q)x = f(q)x=f(q). To capture semantic similarities among prompts, the authors partition the training embeddings using X-means clustering to determine the number of clusters KKK and their centroids μk\mu_kμk​. Instead of relying on hard assignments, the framework represents each query through soft memberships over the learned centroids. After L2L_2L2​-normalizing the embeddings and centroids, these memberships are computed from cosine distances as:

uk(x)=exp⁡(−βdk(x))∑j=1Kexp⁡(−βdj(x)),dk(x)=1−x⊤μku_k(x) = \frac{\exp(-\beta d_k(x))}{\sum_{j=1}^K \exp(-\beta d_j(x))}, \quad d_k(x) = 1 - x^\top \mu_kuk​(x)=∑j=1K​exp(−βdj​(x))exp(−βdk​(x))​,dk​(x)=1−x⊤μk​

where β>0\beta > 0β>0 controls the concentration of the assignments. This representation allows the model to exploit information from multiple neighboring regions rather than relying on a single cluster.

Using the membership vector u(x)u(x)u(x), the framework learns an independent logistic predictor for each candidate model m∈Mm \in \mathcal{M}m∈M. The estimated capability of model mmm for a given prompt is:

p^m(x)=σ(wm⊤u(x)+bm)\hat{p}_m(x) = \sigma(w_m^\top u(x) + b_m)p^​m​(x)=σ(wm⊤​u(x)+bm​)

where σ(⋅)\sigma(\cdot)σ(⋅) is the logistic sigmoid, and the parameters are fitted using L2-regularized logistic regression. The inference cost for each model is estimated from its average observed training-set cost and normalized to the range [0,1][0, 1][0,1].

Cost-Aware Single-Model Routing (PISA) For single-model routing, the authors formulate the decision as selecting the model that maximizes a cost-aware utility function:

m^(q)=arg⁡max⁡m∈M[αp^m(q)+(1−α)(1−cˉm(q))]\hat{m}(q) = \arg\max_{m \in \mathcal{M}} \left[ \alpha \hat{p}_m(q) + (1 - \alpha)(1 - \bar{c}_m(q)) \right]m^(q)=argm∈Mmax​[αp^​m​(q)+(1−α)(1−cˉm​(q))]

where α\alphaα controls the trade-off between predicted response quality and inference cost.

Prompt-Adaptive Cost-Aware Ensembling (PISA-E) To extend routing to model subsets, PISA-E evaluates candidate ensembles E⊆ME \subseteq \mathcal{M}E⊆M with sizes up to kmax⁡k_{\max}kmax​. Directly estimating the performance of every combination is intractable, so the authors construct an ensemble-level utility estimate from the individual capabilities. They use the probability that a strict majority of the selected models produce correct responses as a tractable surrogate. Assuming conditional independence, this strict-majority success probability is computed using a Poisson-binomial dynamic program.

The ensemble cost is normalized by the sum of the kmax⁡k_{\max}kmax​ largest average model costs to allow fair comparison across different cardinalities. To avoid a combinatorial search, PISA-E employs a greedy candidate-construction procedure. Models are first ranked by their individual utilities. Candidate ensembles are then constructed as progressively larger prefixes of this ranking, restricted to odd cardinalities up to kmax⁡k_{\max}kmax​. This restriction is justified because an even-cardinality ensemble can always be improved by removing one model, which increases the strict-majority success probability while lowering the cost.

Once the optimal ensemble E^\hat{E}E^ is selected, its constituent models are queried in parallel. The final response is determined using self-weighted BERTScore, a capability-aware extension of minimum Bayes risk decoding. The framework normalizes the capability estimates over the selected ensemble to compute weights:

wi(x,E)=p^i(x)∑j∈Ep^j(x)w_i(x, E) = \frac{\hat{p}_i(x)}{\sum_{j \in E} \hat{p}_j(x)}wi​(x,E)=∑j∈E​p^​j​(x)p^​i​(x)​

Each candidate response yiy_iyi​ is scored by weighting its BERTScore similarity to all other responses in the ensemble:

Si(x,E)=wi(x,E)∑j∈Ewj(x,E)BERTScore(yi,yj)S_i(x, E) = w_i(x, E) \sum_{j \in E} w_j(x, E) \text{BERTScore}(y_i, y_j)Si​(x,E)=wi​(x,E)j∈E∑​wj​(x,E)BERTScore(yi​,yj​)

The response with the highest score is selected as the final output.

Experiment

The experiments evaluate PISA and PISA-E on four LLM routing benchmarks under in-distribution and out-of-distribution conditions, comparing them against single-model routers and ensemble methods using task performance and inference cost. PISA achieves the best aggregate cost-performance tradeoffs among single-model routers, while PISA-E attains higher macro-average task performance at lower inference cost than competing ensemble approaches and adapts ensemble cardinality per prompt, with adaptive cardinality helping especially in out-of-distribution settings. Component analysis indicates that the Poisson-binomial estimator paired with self-weighted BERTScore is the most effective configuration, and ablations confirm that prompt-dependent model ranking independently improves cost-performance tradeoffs.

This evaluation compares single-model routers on normalized hypervolume across four benchmarks in ID and OOD settings. PISA achieves the highest macro-average normalized hypervolume in both settings, ahead of EmbedLLM-MF and the other baselines. Its advantage is broad, with the best result in most benchmark-setting combinations, although it does not lead every individual benchmark. PISA records the highest macro-average normalized hypervolume among single-model routers in both ID and OOD settings. PISA ranks first in six of eight benchmark-setting combinations and leads RouterBench, FusionBench, and SPROUT in the ID results shown. EmbedLLM-MF is the strongest competing router on aggregate and leads the Track-2 benchmark in ID, while MLP consistently trails the field by a wide margin.

On ID benchmarks, PISA-E attains higher macro-average task performance than the strongest competing ensemble approaches while requiring lower inference cost. Under OOD conditions, it also improves performance relative to the best competitor with lower cost. Varying the cost-performance tradeoff parameter yields large inference cost reductions with moderate performance declines. PISA-E outperforms SelectLLM by 0.60 percentage points on ID macro-average performance while reducing inference cost by approximately 36 percent. With quality prioritized, PISA-E reaches the highest macro-average performance among deployable approaches in both ID and OOD settings, exceeding the strongest competitors by 2.09 and 2.87 percentage points respectively.

On held-out OOD task groups, PISA-E achieves higher macro-average performance than the strongest prior ensemble, DFPE, while also reducing inference cost. The highest-quality PISA-E configuration reaches the best deployable macro performance, and lower-cost configurations still slightly outperform DFPE. Across its tradeoff range, PISA-E spans a large cost-performance curve while Oracle remains far above the deployable approaches. PISA-E outperforms DFPE on OOD macro average by 0.48 percentage points at about 25% lower query cost. Lowering PISA-E's tradeoff parameter from the highest-quality setting reduces inference cost by roughly 106-fold while macro average falls from 63.24% to 50.54%.

PISA-E shows a controllable cost-performance trade-off through its alpha parameter. Lower alpha settings reduce the number of models per query and increase singleton usage, lowering inference cost but also lowering task performance. Raising alpha to 1.0 yields the highest reported performance in both ID and OOD settings, but at substantially higher cost, especially under OOD conditions. At alpha=0.3, PISA-E uses about 1.3 models per query with singleton rates around 82 to 84 percent, achieving the lowest reported costs but the lowest reported performance among the evaluated PISA-E settings. From alpha=0.3 to 1.0, ID performance improves from 70.75% to 75.27% and OOD performance improves from 50.54% to 63.24%, while ID cost rises roughly 21-fold and OOD cost rises roughly 106-fold.

Adaptive prompt-dependent ensemble routing achieves the highest macro-average hypervolume under both ID and OOD conditions, with a larger improvement over the best fixed-cardinality alternative on OOD benchmarks. Fixed cardinality can remain competitive or even better on specific benchmarks, such as RouterBench where single-model selection records higher hypervolume. Hypervolume generally declines as the fixed number of selected models increases, suggesting cardinality is more effective as a prompt-dependent decision. Adaptive routing achieves the highest macro-average hypervolume in both ID and OOD settings. The advantage of adaptive routing over fixed-cardinality alternatives is larger under OOD conditions. Fixed single-model selection outperforms adaptive routing on RouterBench, so adding models is not universally beneficial. Larger fixed cardinalities tend to produce lower hypervolume, with steep declines at the largest ensemble sizes.

The experiments evaluate PISA and PISA-E on in-distribution and out-of-distribution routing benchmarks, including single-model router comparisons, ensemble cost-performance tradeoffs, and adaptive prompt-dependent routing. PISA ranks highest overall among single-model routers, while PISA-E outperforms prior ensemble methods with lower inference cost and offers a controllable tradeoff between cost and task performance through its alpha parameter. Adaptive prompt-dependent routing achieves the best aggregate performance, especially in out-of-distribution settings, although fixed single-model selection can be better on specific benchmarks, and larger fixed ensembles generally reduce hypervolume.


AI로 AI 구축

아이디어에서 출시까지 — 무료 AI 코코딩, 즉시 사용 가능한 환경, 최적의 GPU 가격으로 AI 개발을 가속화하세요.

AI 협업 코딩
바로 사용 가능한 GPU
최적의 가격

HyperAI Newsletters

최신 정보 구독하기
한국 시간 매주 월요일 오전 9시 에 이번 주의 최신 업데이트를 메일로 발송합니다
이메일 서비스 제공: MailChimp