---
title: 'Test-Time RSA for LLMs: Inference Aggregation Strategies'
url: https://www.emergentmind.com/topics/test-time-rsa-for-llms
type: topic
---

# Test-Time RSA for LLMs: Inference Aggregation Strategies

Test-Time RSA for LLMs (Large Language Models) encompasses a family of test-time (inference-time) strategies designed to improve model output quality by aggregating or re-ranking multiple candidate generations according to explicit principles of reasoning or pragmatic communication. This collection of techniques draws on classical Rational Speech Act (RSA) modeling from linguistics and cognitive science, as well as recent advances in repeated sampling, self-consistency, evolutionary aggregation, and multi-model switching. The fundamental aim is to leverage additional inference-time compute—over and above a single forward pass—either within a single model or across several models, yielding solutions that are more reliable, robust, and, in some formulations, more pragmatically informative.

## 1. Conceptual Foundations of Test-Time RSA in LLMs

Test-Time RSA originated as a mechanism to approximate rational pragmatic reasoning, most notably via the Rational Speech Act framework, wherein agents recursively model each other's beliefs and utterances. In the LLM context, RSA-inspired methods treat the model as a probabilistic speaker or listener and score (and sometimes generate) utterances or solutions by aggregating over multiple alternatives—often using explicit Bayesian or information-theoretic objectives.

Recent literature extends these ideas beyond strictly linguistic settings, encompassing domains such as code generation, mathematical reasoning, and multi-step problem solving. Key contributions include recursive self-aggregation (RSA), repeated sampling with majority voting, and multi-model sample pooling with dynamic stopping and weighting. These approaches are empirically motivated by the strong correlation between consistency across multiple outputs and correctness, as well as by the ability to exploit diverse failure modes among different models or reasoning trajectories [2509.26626, 2504.00762, 2411.01562].

## 2. Formal Problem Setting and Baseline Paradigms

Let $x \in X$ denote a test input (e.g., a math question or code task), and $p_{\text{ref}}(\cdot|x)$ a reference LLM parameterizing a conditional distribution over output chains $T$. Each output $T$ is scored via a reward function $r(T, y) \in [0,1]$, where $y$ is a ground-truth answer. The goal is to maximize expected reward $\mathbb{E}[r(T, y)]$ under a fixed inference compute budget $B$ (e.g., total LLM calls).

Standard baseline paradigms include:

- **Parallel scaling:** Drawing $N$ independent samples, each with a call to $p_{\text{ref}}$, and aggregating (e.g., by majority vote among final answers).
- **Sequential scaling (self-refinement):** Iteratively prompting the model to refine its own output, performing $T$ sequential calls.
- **Repeated-sampling-then-voting:** Sampling $K$ output candidates and selecting the answer with maximal support or weighted by confidence/entropy [2504.00762].

Test-time RSA generalizes these by allowing mixed parallel and sequential aggregation, and by using explicit scoring schemes motivated by Bayesian, pragmatic, or evolutionary principles.

## 3. Algorithmic Instantiations of Test-Time RSA

### 3.1 Recursive Self-Aggregation (RSA)

Recursive Self-Aggregation, as described in [2509.26626], maintains a _population_ of $N$ candidate solutions, iteratively aggregating random subsets of size $K$ over $T$ steps:
- **Initialization:** $T_1^{(i)} \sim p_{\text{ref}}(\cdot|x)$ for $i=1,\ldots,N$.
- **Aggregation:** At each step $t$, for each $i=1,\ldots,N$:
  - Sample $S_t^{(i)} \subset P_t$ ($\lvert S_t^{(i)} \rvert = K$, $P_t=$ current population)
  - Aggregate: $T_{t+1}^{(i)} \sim p_{\text{ref}}(\cdot|x, S_t^{(i)})$
- **Final selection:** Output $P_T$, and optionally reduce to a final answer via majority vote.

Mathematical formalism:
$$
T_1^{(i)} \sim p_{\text{ref}}(T \mid x), \qquad S_t^{(i)} \sim \text{UniformSubsets}(P_t,K), \qquad T_{t+1}^{(i)} \sim p_{\text{ref}}(\cdot|x, S_t^{(i)})
$$

RSA exploits the information embedded in full solution chains (not merely final answers), enabling incremental improvement by leveraging partially correct reasoning trajectories [2509.26626].

### 3.2 Multi-LLM Aggregation: ModelSwitch

ModelSwitch [2504.00762] introduces multi-model sampling, distributing a fixed sample budget $K$ across $n$ diverse LLMs. Each LLM $M_i$ is allotted $B=K/n$ calls:
- After $B$ samples, if all answers from $M_i$ are consistent, that answer is returned.
- Otherwise, sampling proceeds to the next model; all responses are eventually aggregated via a weighted vote, where weights account for both a model's internal consistency (empirical entropy) and an external prior.
- Theoretical analysis demonstrates that ModelSwitch can achieve higher accuracy and reduced compute compared to single-model, high-sample baselines.

Weighted voting combines answer frequency, model strength, and consistency-derived weighting:
$$
\text{Score}(a) = \sum_{i=1}^n W_\beta^{(i)} W_\alpha^{(i)} \lvert \{j: a_{i,j}=a\} \rvert
$$
where $W_\alpha^{(i)}$ decreases with (normalized) entropy of model outputs, and $W_\beta^{(i)}$ reflects prior model confidence [2504.00762].

### 3.3 Pragmatic RSA Re-ranking for Language Generation

Within linguistic RSA [2411.01562], candidate utterances $u \in U$ for state $w$ are scored according to a pragmatic speaker posterior:
$$
P_{S_1}(u|w) \propto \exp\left[\alpha \left( \ln P_{L_1}(w|u) - \text{Cost}(u) \right) \right]
$$
Inputs to this re-ranking:
- $U$: top-$k$ LLM generations plus logically constructed alternatives
- $M(u,w)$: meaning function (prompt or rule-based)
- $\text{Cost}(u) = \ln \lvert u \rvert$ (token length)

Final scores for candidate selection interpolate between LLM log-probability and $S_1$ pragmatic score:
$$
\text{Score}(u) = \lambda \cdot \ell_{\mathrm{LLM}}(u) + (1-\lambda) \cdot \log \hat{S}_1(u)
$$

This test-time RSA recipe enables more human-like informativeness and brevity in referential generation [2411.01562].

## 4. Compute-Efficiency and Scaling Trade-offs

Test-time RSA strategies exhibit different compute-profiles:
- **RSA (Recursive Self-Aggregation):** Requires $N \cdot T$ total LLM calls (initial plus all aggregation rounds). $N$ controls parallel breadth, $T$ sequential depth, with practical trade-off: parallelization is hardware-dependent, while increased $K$ and $N$ can slow convergence and inflate memory usage.
- **ModelSwitch:** Typically uses $n=2$ or $3$ lightweight models, allocating $B=K/n$ calls per LLM. Empirical results show up to $34\%$ fewer LLM calls needed to reach a given accuracy compared to single-model self-consistency.
- **Pragmatic RSA Re-ranking:** Dominant cost is in candidate generation (often using beam search or combinatorial logic). Meaning function and re-ranking add negligible overhead.

Ablation studies indicate: for RSA, increasing $T$ yields near-monotonic gains; gains plateau for $K \gtrsim 3$; larger $N$ raises asymptotic upper bound but also increases resource demands [2509.26626, 2504.00762].

## 5. Aggregation-Aware Reinforcement Learning Extensions

Standard RL fine-tuning focuses solely on optimizing the model's own chain generation. Aggregation-aware RL, as introduced for RSA, expands the RL objective to explicitly include aggregation contexts:
- For each training tuple $(x, y)$ and candidate subset $S$, optimize expected reward under policies that aggregate multiple reasoning chains:
$$
\max_\theta \ \mathbb{E}_{(x,y)\sim D, S \sim p_\mathrm{ref}^K(\cdot|x)} \left[ \mathbb{E}_{T \sim \pi_\theta(\cdot|x, S)} [ r(T, y) ] - \beta \mathrm{KL}(\pi_\theta(\cdot|x, S) \| p_\mathrm{ref}(\cdot|x, S)) \right]
$$
Policy gradient (e.g., PPO, RLOO) yields an aggregator optimized for the multi-chain, aggregation-aware scenario. Empirical results show that aggregation-aware RL yields performance boosts ($+5$–$15$ points on Pass@1) compared to vanilla RL [2509.26626].

## 6. Empirical Comparisons and Practical Implications

Multi-step and multi-model RSA unlocks substantial performance gains across both math and code tasks, and across models and scales:
- On AIME-25, RSA boosts Qwen3-4B-Instruct-2507 performance from $43.9\%$ to $73.2\%$; on HMMT-25, from $27.2\%$ to $47.6\%$.
- ModelSwitch, with two lightweight LLMs, achieves MATH accuracy equal to or surpassing much larger models with fewer calls; self-consistency baselines require $16$ samples, ModelSwitch delivers at $9.4$–$10.7$ samples on average [2504.00762].
- On linguistic referential tasks, pragmatic RSA achieves moderate (but not maximal) correlation with LLM scoring, indicating that current LLMs can be pushed closer to pragmatic competence but do not fully realize it by default [2411.01562].

RSA and its variants require no external verifier—a contrast with multi-agent debate or reward-model-based selection—and can be further improved by fine-tuning on aggregation-specific objectives.

## 7. Extensions, Limitations, and Future Directions

Test-time RSA methods are highly modular: aggregation operators, subset selection schemes, and scoring functions can all be adapted—from language-centric pragmatic formulations to complex reasoning over population chains. ModelSwitch demonstrates the value of error mixing across LLMs, while pragmatic RSA shows that explicit re-ranking by informativity and cost can shift model outputs closer to human-like communication.

Current limitations reside in diminishing returns for very large $N$, reliance on strong meaning functions or reward models, and dependence on the diversity and complementarity of model outputs. A plausible implication is that as LLMs become even more accurate and less diverse, the marginal benefit of repeated sampling and aggregation may decrease, shifting future focus to more data- and context-sensitive aggregation (e.g., via highly expressive reward models or interactive verification mechanisms).

Empirical results consistently show that RSA-inspired test-time strategies enable smaller LLMs to outperform larger models' single-call baselines in both accuracy and compute efficiency. The architectural agnosticism of these methods ensures compatibility with future model and inference pipeline innovations [2509.26626, 2504.00762, 2411.01562].

Source: https://www.emergentmind.com/topics/test-time-rsa-for-llms