Black-Box Test-Time Personalization: Optimality and Collaboration

Yuheng Ma, Feiyu Jiang, Zifeng Zhao, Yi YuarXiv 2026

TL;DR

How do you personalize a closed-source, black-box language model when you can’t touch its weights and don’t have a reward model? This paper turns test-time "best-of-$K$" response selection into an online learning game, using a clever nearest-neighbor bandit algorithm to learn user quirks on the fly from simple thumbs-up/down feedback. Better yet, it shows how agents can team up across different users—pooling data when people like the same order of answers, even if they grade on completely different curves.

What Problem Does This Paper Address?

Suppose you are building a personal AI assistant powered by a proprietary API. You can't fine-tune the base model, so you rely on test-time compute: for every user query, you ask the LLM to generate $K$ different candidate answers and try to pick the best one.

In math or coding, an automated verifier can easily check which of the $K$ answers is right. For open-ended tasks—like drafting an email or explaining a concept—there is no objective verifier. Every user has their own complex, unspoken preferences (e.g., concise vs. chatty). Your system only gets to show one response per turn and observe sequential feedback.

The authors frame this by splitting the error into two parts: the generation gap (how close the best of the $K$ generated answers is to perfection, which is fixed by the LLM) and the selection gap (how close the agent's chosen answer is to the best of the $K$). The challenge is twofold: how do you shrink that selection gap as fast as possible for a single user without assuming their preferences follow a simple linear formula, and how can you accelerate learning across multiple users without muddying the waters when users have different grading habits?

Figure 1: Illustration of the online interaction process. Left and center (single-user personal- ization): at round t, the user submits a question and the agent queries a black-box LLM to obtain K candidate responses; using the prior history Ft−1 (orange arrows), the agent selects one response to return and records the user’s feedback to update the history to Ft for subsequent rounds. Right (multi-user collaboration): multiple users interact with their personal agents in parallel, and agents exchange historical feedback (dashed lines) across users with compatible preferences to accelerate learning.

Methods

The authors tackle the selection gap as a nonparametric contextual bandit problem—meaning they only assume the user's hidden reward function is smooth (Lipschitz continuous) over query–response embeddings, rather than strictly linear.

  • Single-User $\mathtt{(BTN)}^2$: They introduce Black-Box Test-Time Nearest Neighbors ($\mathtt{(BTN)}^2$). When $K$ candidate responses arrive, the agent looks at past interactions in the embedding space and estimates each candidate's value using $k$-nearest neighbors ($k$-NN). Crucially, it uses an Upper Confidence Bound (UCB) that adaptively picks $k$ for each candidate on the fly—balancing local approximation error (picking neighbors too far away) against noisy feedback (averaging too few neighbors).
  • Preference-Based Collaboration: Standard clustered bandits only group users together if their reward functions are identical. Here, the authors define a $\kappa$-winner distance: the statistical distance between the distributions of which candidates two users would crown the winner. Two users might give wildly different numerical scores (say, an enthusiastic grader vs. a harsh critic), yet share the exact same preference ordering.
  • Two-Stage Clustering: First, users undergo brief uniform exploration to estimate pairwise winner distances across multiple scales, forming a similarity graph that is pruned into disjoint cliques (clusters). Second, users within each cluster pool their histories and run a collaborative version of $\mathtt{(BTN)}^2$.

Datasets

  • Synthetic Simulations: Controlled environments testing candidate-set scaling, high ambient dimensions with low-dimensional manifold structures, and shifted user preference clusters.
  • Modified LMSYS-Chat-1M Benchmark: The authors curate 2,000 self-contained questions from LMSYS-Chat-1M. For each question, they generate 11 answers—one neutral, plus 10 distinct styles (creative, verbose, concise, uplifting, and their pairwise combinations). Using 256-dimensional embeddings (subtracting the neutral answer's embedding to isolate style), they simulate 8 users across two distinct preference clusters.

Key Insights and Ideas

  • The Best-of-$K$ Phase Transition: Generating more candidates ($K$) isn't a free lunch. While larger $K$ shrinks the generation gap, it actually makes the selection gap harder because top candidates become crowded together with tiny utility differences. Eventually, $K$ hits a theoretical saturation point: both selection difficulty and global regret plateau, meaning paying for extra API tokens yields zero benefit.
  • Escaping the Curse of Dimensionality: LLM embeddings have thousands of dimensions, which normally ruins nearest-neighbor algorithms. The authors prove that $\mathtt{(BTN)}^2$ automatically adapts to the intrinsic low-dimensional structure of language representations, keeping regret rates fast without needing explicit dimensionality reduction.
  • Order Matters More Than Scale: Defining user similarity via winner distributions allows harsh raters and generous raters to safely share data, strictly generalizing classical bandit clustering.
  • Better Clusters $\neq$ Better Decisions: On real data, competing linear bandit baselines sometimes recovered the exact user clusters more often (when tuned post-hoc), yet still suffered higher regret because their underlying linear reward assumptions couldn't capture complex stylistic preferences.

Key Results

  • Minimax Optimality: Theoretical upper and lower regret bounds match up to logarithmic factors across both single-user and collaborative settings. In simulations with low-dimensional signals ($d_0 \in \{1,2,3,4\}$) embedded in ambient dimensions up to $d=50$, mean regret varied by at most 1.041x, confirming insensitivity to ambient dimension.
  • Benchmark Superiority: On the LMSYS style-preference benchmark, $\mathtt{(BTN)}^2$ achieved the lowest global regret across every setting ($K=2$ to $10$), statistically outperforming linear bandits (LinUCB, LinTS) and nine clustered/neural bandit baselines (including CLUB, COFIBA, and M-CNB).
  • Near-Oracle Collaboration: At $K=10$, single-user $\mathtt{(BTN)}^2$ achieved a global regret of 1207.0 (vs. 1560.9 for LinTS). Pooling data with unknown clusters dropped $\mathtt{(BTN)}^2$ regret to 1192.6 (and 1797.4 vs. 2018.3 at $K=4$), landing within 3% of an oracle that knew the true user clusters in advance.

Limitations and Future Work

  • Independent Turns: The theoretical framework assumes each query's candidate set is drawn independently of the past. Real multi-turn conversations have evolving, history-dependent contexts and potentially shifting user moods (nonstationarity).
  • Restrictive Intra-Query Dependence: While an appendix extends the math to handle dependent candidates within the same query, the authors note those joint-density assumptions remain restrictive and ripe for relaxation.
  • Individual Regret Trade-offs: While collaboration lowers aggregate group regret, users with very sharp, clear feedback signals can end up carrying more of the exploration burden—potentially doing worse individually than if they learned alone rather than pooling with noisy peers.

Summary updated

BibTeX
@misc{ma2026black,
  author = {Yuheng Ma and Feiyu Jiang and Zifeng Zhao and Yi Yu},
  title = {{Black-Box Test-Time Personalization: Optimality and Collaboration}},
  year = {2026},
  eprint = {2611.40278},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.40278},
}
Figure