---
title: 'POLCA: Prioritized Local Context Aggregation'
url: https://www.emergentmind.com/topics/prioritized-optimization-with-local-contextual-aggregation-polca
type: topic
---

# POLCA: Prioritized Local Context Aggregation

Prioritized Optimization with Local Contextual Aggregation (POLCA) is a framework for stochastic generative optimization in which a generative language model serves as the optimizer, using numerical rewards and text feedback to search for high-performing parameterizations of complex systems such as LLM prompts, multi-turn agents, code translators, and CUDA kernel generators. The method is formulated for settings in which evaluations are noisy because feedback may be stochastic, only minibatches can be sampled, and the underlying system may itself behave stochastically. POLCA addresses these conditions by combining a priority queue for exploration–exploitation management, a semantic $\varepsilon$-Net for diversity control, and an LLM Summarizer for aggregation of historical local context. The framework is presented with a convergence guarantee under stochasticity and evaluated on $τ$-bench, HotpotQA, VeriBench, and KernelBench, where it is reported to outperform state-of-the-art baselines in both deterministic and stochastic regimes [2603.14769].

## 1. Formal problem setting

POLCA is defined over a parameterized program $P_\theta$ with parameter $\theta$ in a typically large, discrete space $\Theta$. There is an underlying distribution $\mathcal{D}$ over pairs $(\omega, x)$, where $x$ is an input and $\omega$ is side information. Running $P_\theta$ on $x$ produces an output $y \sim P_\theta(x)$. A guide $\mathcal{C}$ then provides two feedback modalities from $(\omega,x,y)$: a numerical score $r \in \mathbb{R}$ and textual feedback $f$. The score may take forms such as binary pass/fail, an LLM-judge score in $[0,1]$, or runtime speedup; the textual channel may contain error messages, critiques, or hints.

The target quantity is the true expected performance
$$
\mu(\theta)=\mathbb{E}_{(\omega,x)\sim\mathcal{D}}\Big[\mathbb{E}_{y\sim P_\theta(x)}[\mathcal{C}_r(\omega,x,y)]\Big].
$$
The optimization objective is to interactively propose a sequence $\theta_0,\theta_1,\ldots$ through an LLM optimizer $\mathcal{O}$ so as to maximize $\mu(\theta_{\text{best}})$ under a finite compute budget, where $\theta_{\text{best}}$ is the returned candidate. Because each step may only evaluate a small minibatch $B \subset \mathcal{D}$, empirical scores are necessarily noisy. This formulation places prompt optimization, agent optimization, code translation, and low-level code generation under a common stochastic optimization abstraction.

A central feature of the formulation is that the optimizer itself may be stochastic and error-prone. This departs from classical black-box optimization assumptions in which proposal generation is externally fixed or analytically specified. Here, the search operator is itself a language model conditioned on prior rollouts and textual context. This suggests that POLCA is intended not merely as an evaluation scheduler, but as a framework for coupling statistical decision-making with generative proposal mechanisms.

## 2. Core algorithmic structure

POLCA maintains a priority queue $\mathcal{Q} \subset \Theta$ containing candidate solutions together with empirical histories. The loop begins with initialization $\mathcal{Q}:=\{\theta_0\}$ and proceeds while compute budget remains. At each iteration, a minibatch $B \subset \mathcal{D}$ of size $B$ is sampled, up to $k$ programs $\Theta_{\text{explore}}$ are selected from $\mathcal{Q}$ by highest exploration priority $p_{\text{explore}}(\theta)$, those candidates are evaluated on $B$, and their empirical means $\hat{\mu}(\theta)$ are updated. The queue is then summarized into a compact global context $c_{\text{history}}$, after which the optimizer $\mathcal{O}$ is called for each explored candidate using local rollouts together with the global summary to produce raw proposals $\Theta_{\text{raw}}$. A semantic $\varepsilon$-Net filter reduces these to $\Theta_{\text{new}}$, which are then evaluated on the same minibatch and inserted into the queue with updated statistics. The returned output is
$$
\theta_{\text{best}}:=\arg\max_{\theta\in\mathcal{Q}}\hat{\mu}(\theta).
$$

The default exploration priority is the empirical mean $\hat{\mu}(\theta)$. For theory, however, POLCA uses a UCB-style priority
$$
p_{\text{explore}}(\theta)=\hat{\mu}(\theta)+2\sigma\sqrt{\log n/T_\theta},
$$
where $\sigma^2$ bounds the variance, $T_\theta$ is the number of samples for $\theta$, and $n$ is the total number of samples so far. This substitution is used to guarantee systematic exploration under noise [2603.14769].

The algorithm combines local and global contextual signals. Locality comes from conditioning each optimizer call on the rollouts of the candidate currently being explored. Globality comes from the summary of the entire queue and its evaluation history. The phrase “Local Contextual Aggregation” refers to this combination of candidate-specific evidence and queue-level distilled experience. A plausible implication is that POLCA is designed to preserve exploitative refinement of promising candidates while avoiding myopic dependence on only the most recent rollout.

## 3. Diversity control via the semantic $\varepsilon$-Net

A persistent difficulty in generative search is unconstrained growth of semantically redundant candidates. POLCA addresses this using an $\varepsilon$-Net mechanism defined in an embedding space. Each candidate is mapped to $\phi(\theta)\in\mathbb{R}^d$, and semantic distance is measured by
$$
\tilde d(\theta,\theta')=\|\phi(\theta)-\phi(\theta')\|_2.
$$
At each iteration, the union $\mathcal{Q}\cup\Theta_{\text{new}}$ is maintained as an $\varepsilon$-Net, meaning that no two stored points are within distance $\varepsilon$.

The construction is a farthest-first greedy traversal over the raw proposals. Starting with $\Theta_{\text{new}}\leftarrow\varnothing$, the algorithm repeatedly computes, for each remaining candidate, its minimum distance to the existing queue and accepted new points:
$$
\delta(\theta)=\min_{\theta'\in \mathcal{Q}\cup\Theta_{\text{new}}}\tilde d(\theta,\theta').
$$
It then selects the candidate with maximal $\delta(\theta)$. If this maximal distance is at least $\varepsilon$, the candidate is retained; otherwise the procedure stops. The resulting filtered set is inserted into the queue.

This construction guarantees the bound $|\mathcal{Q}|\leq N_\varepsilon$, where $N_\varepsilon$ is the covering number of $\Theta$ under radius $\varepsilon$ [2603.14769]. Within the framework, the $\varepsilon$-Net serves both as a memory-control device and as a structural bias toward search-space coverage. The reported ablations further indicate that removing the $\varepsilon$-Net degrades both learning speed and final performance on $τ$-bench by $15$–$20\%$, and that setting $\varepsilon=0$ is worst because it permits unbounded growth of $\mathcal{Q}$. The paper also reports that varying $\varepsilon$ in $[0.01,0.1]$ shows robust performance, suggesting that the mechanism is not overly sensitive within that range.

## 4. Historical aggregation through the LLM Summarizer

POLCA includes an external LLM Summarizer that recomputes a compact natural-language summary of the queue and its empirical rollouts at every iteration. The input is the entire set $\{(\theta,\text{rollouts})\}_{\theta\in\mathcal{Q}}$. The summarizer partitions trajectories into “success” cases with $r>\tau$ and “failure” cases with $r\leq \tau$ for a threshold $\tau$, samples contrastive pairs, and outputs a short summary
$$
c_{\text{history}}=\text{Summarizer}(\{(\theta,\text{rollouts})\}_{\theta\in\mathcal{Q}})
$$
that highlights patterns in successes and failures. This summary is prepended to each optimizer call as global context.

The module is explicitly not implemented as a parametric learner with persistent internal updates; instead, “no explicit parameter update is needed” because $c_{\text{history}}$ is recomputed each cycle to reflect the evolving frontier. In practice, XML-style tags are enforced so that actionable guidance is contained within `<summary>...</summary>` [2603.14769].

This mechanism addresses a common ambiguity in LLM-based optimization workflows: whether meta-learning must be embedded in model weights or can arise through repeated context construction. POLCA adopts the latter view. The reported ablation that removing the Summarizer degrades both learning speed and final performance on $τ$-bench by $15$–$20\%$ indicates that historical context aggregation is not merely auxiliary bookkeeping but an active component of the optimization procedure.

## 5. Convergence analysis and theoretical claims

The theoretical analysis is given under a strict-improvement assumption. Specifically, there exist $\gamma>0$ and $\delta_0\in(0,1)$ such that for any $\theta$ with $\mu(\theta)\leq B-\gamma$, an optimizer call producing $\theta' \sim \Pi(\cdot\mid\cdot)$ satisfies
$$
\Pr[\mu(\theta')>\mu(\theta)+\gamma]\geq \delta_0.
$$
Assuming also that each reward observation is $\sigma^2$-sub-Gaussian, the main result states that if POLCA runs for $n$ iterations with UCB priorities, then
$$
\mathbb{E}\Big[\sum_{\theta:\mu(\theta)\leq B-\gamma}T_\theta(n)\Big]
\lesssim
\left(\frac{B}{2\gamma\delta_0}+\frac{64\sigma^2N_\varepsilon}{\gamma^2}\right)\log n.
$$
Here $T_\theta(n)$ is the total number of samples allocated to candidate $\theta$ and $N_\varepsilon$ is the $\varepsilon$-covering number. In the limit $\sigma\to 0$, the bound degenerates to $O((B/(\gamma\delta_0))\log n)$ [2603.14769].

The proof sketch proceeds by partitioning $[0,B]$ into intervals of width $\gamma/2$, showing that $O(\log n)$ draws per interval suffice to propose a $\gamma$-improvement with probability at least $\delta_0$, and then using UCB to distinguish candidates within an interval after $O((\sigma^2/\gamma^2)\log n)$ additional samples. Summation over at most $2B/\gamma$ intervals yields the stated bound.

A second theorem compares POLCA with naive sequential improvement. According to the reported result, using a global best-so-far baseline yields an expected $O(B/(\gamma\delta_0))$ improvement chain, whereas sequential restarting requires $\Omega(\delta_0^{-(B/\gamma)})$ steps in the worst case. This comparison formalizes the claim that queue-based reuse of discovered high-performing candidates changes the scaling behavior of iterative generative optimization under the paper’s assumptions.

## 6. Benchmarks, empirical results, and computational profile

POLCA is evaluated on four benchmark families spanning prompt optimization, agent optimization, program translation, and CUDA kernel generation [2603.14769].

| Benchmark | Setting | Reported result |
|---|---|---|
| $τ$-bench | 10-task retail training, sparse binary reward; held-out 105 tasks | 57.5% pass@1 on train vs. 34.8% base, 55.7% GEPA, 37.3% OpenEvolve; on all 115 tasks 43.9% vs. 38.9% base |
| HotpotQA | 100 validation tasks, binary exact-match reward | With 2,000 metric calls, POLCA outperformed beam-search, GEPA, OpenEvolve by a large margin ($>+10\%$ accuracy) |
| VeriBench | 3-stage evaluation: compile $\to$ unit tests $\to$ LLM judge; score in $[0,1]$ | With 50 samples per task, DSPy $.888\pm.023$, GEPA $.695\pm.010$, OpenEvolve $.738\pm.010$, POLCA $.952\pm.005$ |
| VeriBench (compilation only) | Binary compile-success reward | POLCA reached 95.2% pass rate vs. DSPy $.888$, GEPA $.695$, OpenEvolve $.738$ |
| KernelBench | 16 batched-matmul tasks, require speedup $>1.0$ | POLCA converged fastest, achieving $\text{pass}_{1.0}\approx 65\%$ within 10 eval steps vs. $\leq 30\%$ for baselines |

The reported evaluation criteria emphasize both sample efficiency and final performance. On $τ$-bench and HotpotQA, the setting is prompt or agent optimization under sparse or exact-match reward. On VeriBench, the evaluation pipeline is explicitly staged, moving from compile success to unit tests and then LLM judgment. On KernelBench, performance is expressed through a speedup threshold. Taken together, these tasks instantiate the paper’s claim that the same optimization framework can operate across heterogeneous feedback topologies.

The implementation notes quantify the computational profile. Each evaluation step samples $k$ candidates and $B$ data points, costing $O(k\cdot B)$ guide calls and $k\cdot B$ program runs. The memory bound is $|\mathcal{Q}|\leq N_\varepsilon$; embedding lookups and distance computations require $O(N_\varepsilon\cdot d)$ per filter pass. Each iteration issues $k$ parallel calls to the optimizer $\mathcal{O}$ and one summary call. The paper reports total LLM token usage of at most approximately $3\times10^7$ per 100 steps on $τ$-bench, and notes that asynchronous Evaluate and Propose operations, parallelized LLM API calls, and contrastive sampling in the Summarizer are used for efficiency. The hyperparameters are characterized operationally: $\varepsilon$ trades off exploration versus cost, batch size $B$ trades off noise reduction versus latency, and $k$ trades off breadth versus compute per iteration.

These results support the paper’s central empirical claim that bandit-style prioritization, diversity filtering, and local-plus-global contextual prompting can jointly improve robustness and efficiency in stochastic LLM-driven optimization. A plausible implication is that POLCA is particularly well matched to domains in which evaluation is expensive, sparse, or noisy, and in which textual feedback can be exploited as a structured search signal rather than treated as incidental metadata.

Source: https://www.emergentmind.com/topics/prioritized-optimization-with-local-contextual-aggregation-polca