Personalizing a frozen black-box language model is difficult when no reliable reward model or verifier is available. We study online best-of-$K$ response selection: at each interaction, the model generates a size-$K$ candidate set, among which the system chooses one response to present. By formulating this task as a nonparametric stochastic contextual bandit problem, we propose Black-Box Test-Time Nearest Neighbors, $\mathtt{(BTN)}^2$, an adaptive nearest-neighbor upper confidence bound policy that smartly learns user preferences from sequential feedback. Matching regret upper and lower bounds are established up to logarithmic factors, revealing a phase transition in the candidate-set size~$K$. To accelerate learning across multiple users, we extend this framework to a collaborative bandit setting and characterize user similarity through the distributions of preferred choices, which allows effective information sharing among users with the same preference ordering despite potentially different reward models. Based on this similarity measure, we propose a two-stage procedure that detects latent user clusters and pools feedback for joint decision-making. Theoretical guarantees on cluster recovery and collaborative regret are established. Extensive numerical experiments are also provided, including simulations examining the predicted rates and collaboration effects, and a question-answering benchmark with constructed user preferences showing the superiority of our methods over other state-of-the-art baselines.
翻译:暂无翻译