arXiv:2610.29520cs.IROct 2026

Manuscript Offprint

arXiv:2610.29520

Beyond the Vote: When Do LLMs Add Value to Retrieval-Based Tabular Classification?

Ziquan Wang, Yuxuan Nie, Jian Ma, Yingjie Li

Abstract

Retrieval-based in-context learning (ICL) enables large language models (LLMs) to predict tabular labels from similar examples, but it remains unclear whether LLM inference improves on direct voting over those same examples. We address this question by comparing four general-purpose LLMs with distance-weighted nearest-neighbor voting (Distance-KNN) using identical retrieved neighbors across 19 tabular classification datasets. With the number of demonstrations fixed, enlarging the retrieval candidate pool improves accuracy for all predictors, yet Distance-KNN achieves the highest mean accuracy at every pool size. More detailed analyses reveal that LLM gains are concentrated where retrieved neighbors exhibit low label consensus and vary across models. These gains further depend on the average feature-space distance to the test query: under low label consensus, some LLMs outperform Distance-KNN in close and intermediate neighborhoods, but all fall behind on average in the most distant group. Complementary experiments on the number of demonstrations, prompt formulation, retrieval representation, and label-balanced demonstration selection largely preserve the overall findings. These results characterize when LLM inference adds predictive value beyond distance-weighted voting in retrieval-based tabular ICL.

1 Introduction

Tabular classification is a widely studied machine learning task with applications in healthcare (Yang et al., 2024), commerce (Sun and Li, 2024), and energy (Alawi et al., 2024). The goal is to predict class labels from instances described by numerical and categorical features. Traditional methods include nearest-neighbor classifiers, which predict labels from similar training instances (Dudani, 1976),

Figure

Figure 1: Illustration of shared-neighbor prediction in tabular classification. Distance-KNN and the LLM use the same eight retrieved neighbors. Label consensus measures the majority-label fraction, while feature proximity is measured by the mean query-to-neighbor distance. In this example, Distance-KNN correctly predicts class A, whereas the LLM predicts class B.

and tree-based ensembles, which have demonstrated strong performance on heterogeneous tabular data (Chen and Guestrin, 2016; Grinsztajn et al., 2022).

Recent research has explored alternative approaches that leverage pretrained models for tabular prediction. Specialized tabular foundation models, including TabPFN, learn transferrable predictive patterns through pretraining (Hollmann et al., 2023, 2025; Ma et al., 2025). Another line of work adapts language models to tabular data through supervised or instruction tuning (Hegselmann et al., 2023; Li et al., 2024; Wen et al., 2024; Zhang et al., 2024). More recently, researchers have explored applying frozen general-purpose large language models

†^{\dagger}Corresponding author.

(LLMs) through few-shot in-context learning (ICL) (Brown et al., 2020; Wu and Hou, 2025; Yuan et al., 2025). In this setting, labeled tabular instances are serialized as demonstrations, often selected according to their similarity to a test query, enabling prediction without task-specific parameter updates.

Despite these advances, it remains unclear how much predictive value LLM inference adds beyond direct voting on the same retrieved examples. In retrieval-based tabular ICL, performance differences may arise from either the selection of demonstrations or the predictions made from them, making these contributions difficult to distinguish when different retrieved examples are used. Moreover, expanding the candidate pool changes the available retrieval evidence, but whether LLM inference benefits more from this change than direct voting remains unclear. Their relative performance may also depend on two characteristics of the retrieved neighborhood: label consensus, the fraction of neighbors sharing the most frequent label, and feature proximity, measured by the mean feature-space distance from the test query to those neighbors, as illustrated in Figure 1. A controlled comparison on identical retrieved neighbors is therefore needed to assess when LLMs can provide additional predictive value.

In this work, we systematically compare four general-purpose LLMs with distance-weighted nearest-neighbor voting (Distance-KNN) across 19 tabular classification datasets using a shared-neighbor evaluation protocol. At each candidate-pool size, both predictors use the same eight retrieved examples: LLMs predict from their serialized features and labels, while Distance-KNN predicts from their labels and retrieval distances. By expanding the candidate pool while keeping the number of retrieved examples fixed, we examine their performance and how LLM gains vary with label consensus and feature proximity. Our results show that Distance-KNN achieves the highest mean accuracy across all evaluated candidate pools, while LLMs exhibit selective gains under low label consensus. Feature proximity further distinguishes these gains, with improvements occurring in selected close and intermediate neighborhoods but disappearing in the most distant ones.

In summary, our contributions are as follows: 1) We present a systematic shared-neighbor comparison of four frozen LLMs and Distance-KNN across 19 datasets, enabling a direct assessment of the contribution of LLM inference over distance-weighted voting. 2) We find that Distance-KNN achieves the highest mean accuracy across all evaluated candidate pools, while LLMs exhibit selective gains in low-consensus neighborhoods that vary with feature proximity. 3) We further examine how the number of demonstrations, prompt formulation, retrieval representation, and label-balanced demonstration affect the comparison, finding that the advantage of Distance-KNN largely persists across these experiments.