1. Introduction
Since 2022, generative artificial intelligence represented by ChatGPT and GPT4 [1] has garnered widespread attention globally. These advanced systems, known as Large Language Models (LLMs), are built on the Transformer architecture [2] and typically contain hundreds of billions of parameters. Trained on massive text corpora, LLMs can effectively understand natural language instructions and generate human-like responses. Large language models have demonstrated state-of-the-art performance across various natural language processing tasks. For instance, on the question-answering dataset TriviaQA [3], GPT3 improved accuracy by 3.2% over previous best models; on the Multimodal Multitask Language Understanding (MMLU) dataset [4], GPT4 achieved more than 10% accuracy improvement compared to contemporary best models.
Although large language models excel at processing unstructured text data, there is still limited research on their application in prediction tasks primarily involving structured data. Unlike text and image data, structured data is typically presented in tabular form [5]. In such tables, each row represents a prediction instance, while each column represents a feature of that instance, describing its attributes, which can be continuous or discrete values. The fundamental challenge in prediction tasks with structured data is to predict the target variable of an instance based on its attribute data. This target variable may be a continuous numerical value, such as predicting housing prices, or a discrete category label, such as determining whether an email is spam. Table 1 shows an example of structured data and its target variable to be predicted. The left portion of the table displays various attributes including age, education level, gender, ethnicity, and marital status. Among these, ethnicity and marital status are discrete variables. The right portion shows the prediction target: based on the attributes in the left table, the goal is to predict whether annual salary exceeds $50,000. It is worth noting that age is a continuous variable, while education level, gender, ethnicity, and marital status are discrete variables.
Table 1. Structured data and prediction target.
Age |
Education |
Gender |
Ethnicity |
Marital Status |
Annual Salary > $50K |
49 |
Bachelor’s |
Male |
USA |
Divorced |
No |
... |
... |
... |
... |
... |
... |
25 |
Master’s |
Female |
USA |
Unmarried |
Yes |
Table Reasoning (also known as structured data reasoning), particularly applications like table fact verification and question answering, holds significant value in the information age. Due to its advantages of being information-dense and highly structured, tables serve as an indispensable core data format in numerous fields such as finance and public health [1]. Unlike typical data processing tasks, table fact verification and question answering require complex reasoning that integrates unstructured information such as statement/question text or textual content within tables. For instance, tasks include judging the accuracy of a statement based on table data, determining whether a data-supported diagnosis is reliable, or answering various questions according to the table data [2]. Traditionally, these complex reasoning tasks had to be performed manually, which is not only time-consuming but also prone to errors. Consequently, major international conferences in the field of artificial intelligence, such as ACL [6], ICLR [7], and NIPS [8], have been actively discussing the latest technologies and methods for automated table reasoning in recent years.
Generally speaking, current table reasoning primarily employs two types of methods: 1) Training machine learning models for table reasoning by using large amounts of joint data comprising both tables and text [9]; 2) Leveraging the advantages of large language models (such as the GPT and LLaMA series) in natural language understanding and logical reasoning, either through fine-tuning or utilizing In-Context Learning (ICL), to employ LLMs for table reasoning [10]. However, both approaches have limitations. On one hand, methods based on machine learning models involve complexity and require substantial computational resources during model training and selection, and they struggle with understanding irregular table formats and performing commonsense reasoning. On the other hand, table reasoning methods based on LLM-ICL, while largely addressing the above issues, are still in the preliminary exploration stage and face challenges such as token limitations, uncertainty, and difficulties in debugging, necessitating validation and exploratory improvements based on real-world data.
Based on the context learning capabilities of large language models, this paper proposes a prediction algorithm based on the LLM-ICL model for structured data prediction problems. This method designs a sample selection strategy to select samples closely related to the problem and transforms these samples, which consist of structured data, into text sequences, which are then used as input for context learning and provided to the large language model for prediction. This approach not only enables the large language model to analyze patterns based on the input samples but also integrates the common sense learned by the large language model during the pre-training stage into the analysis process.
2. Related Research
2.1. Large Language Model
LLMs are advanced artificial intelligence models built on deep learning architectures. These models undergo pre-training on massive text corpora, allowing them to learn complex linguistic structures and patterns. Typically comprising hundreds of millions to hundreds of billions of parameters, they exhibit exceptional language comprehension and generation capabilities, allowing them to perform complex natural language processing tasks.
In 2018, OpenAI introduced GPT (Generative Pre-trained Transformer) [11], a language model with 150 million parameters that pioneered the era of large-scale pre-trained language models. Subsequently, models such as GPT2 [12] and GPT3 [13] were released, continuously pushing the boundaries of training dataset sizes, parameter scales, and performance, thereby advancing the field of NLP. By 2023, multiple companies including Meta, Baidu, Alibaba, and DeepSeek had launched LLMs with parameter counts exceeding tens of billions. Among them, several globally recognized large language models were trained on datasets ranging from hundreds of billions to trillions of tokens.
Compared to traditional deep learning models, LLMs exhibit two distinctive characteristics: first, their parameter complexity is extremely high, with counts ranging from billions to hundreds of billions; second, the scale of their training datasets is immense. These two core features endow LLMs with remarkable comprehension and generation capabilities. Taking the GPT series as an example, GPT1 had 117 million parameters [11], GPT2 increased to 1.5 billion parameters [12], and GPT3 reached a staggering 175 billion parameters [13]. Alongside the significant growth in parameter scale, the training datasets also expanded accordingly. GPT1 was trained on BookCorpus, a dataset containing approximately 7,000 unpublished books with a data volume of about 4.6 GB [11]. GPT2 used WebText, a dataset constructed from 8 million Reddit articles that received at three upvotes, comprising 40 GB of text data [12]. GPT3 utilized an even more extensive training dataset, including two undisclosed book datasets, an expanded version of WebText, and a filtered Common Crawl dataset, totaling over 570 GB of text data [13].
The training corpora for LLMs encompass diverse resources such as books, internet text, news articles, and forum posts. During training, the models learn linguistic rules and knowledge from these corpora and store this information internally as parameters. Consequently, when a model receives a text sequence as input, it can generate corresponding outputs based on these parameters.
2.2. In-Context Learning
In-Context Learning (ICL) enables large language models to perform tasks directly through natural language prompts without requiring parameter updates or additional training. When provided with appropriate task descriptions and representative demonstrations, LLMs can effectively interpret task requirements and generate appropriate responses. The carefully designed input sequence used to guide the model, known as a prompt, typically comprises three essential components: the task specification, demonstration examples, and the target query.
For effective ICL, the task specification must clearly define the objective and expectations, while the demonstration set consists of input-output pairs illustrating similar problems and their solutions. For example, in machine translation, demonstrations would show source texts with their corresponding translations. These illustrative examples help the model recognize task-specific patterns and expected output formats.
Research has shown that model performance strongly depends on prompt construction strategies, including both the formulation of task instructions and the selection of demonstrations. Recent studies indicate that curating examples based on semantic similarity to the target problem significantly enhances performance in reasoning tasks. The LENS methodology further advances this approach by employing support vector selection for demonstration assembly, demonstrating consistent accuracy improvements across various text classification benchmarks.
3. Prediction Methods Based on Large Language Models
In this section, we formalize our proposed approach for structured data prediction using LLMs with in-context learning.
Let
be a
-dimensionalrandom vector representing the feature vector of the known structured data, and
denote the target value to be predicted. Assume that
samples of
and their corresponding target values have been observed, and that
follows some distribution
.The goal of this structured data prediction task is to predict the corresponding
value for any given
.
Supervised machine learning algorithms transform this prediction problem into a parameter optimization problem: define
as a function with parameters
, and
as a loss function. Based on the observed sample set
, solve the optimization problem:
(1)
To obtain
, which is then used to predict
for any
. Common loss functions include Mean Squared Error (MSE) and Cross-Entropy. MSE measures the average squared difference between predicted and true values, typically used for regression problems:
(2)
Cross-Entropy measures the discrepancy between predicted and true probability distributions, commonly applied to classification problems:
(3)
where
is the number of classes and
is the binary indicator for class
.
After estimating parameters
, performance is validated on test dataset
:
(4)
Unlike supervised methods, LLMs require no parameter training but rely on prompt design. Let
and
denote text sequences for the demonstration examples and target problem respectively. Let
represent the mapping from structured data to text sequences. The demonstration set
is a subset of training dataset
. Define
as the strategy for selecting demonstrations given target feature vector
. The prediction using LLMs is:
(5)
The optimization problem becomes:
(6)
Two key elements are: determining
(demonstration selection strategy) and defining mapping
(structured data to text).
The demonstration set
significantly impacts performance. This paper designs two selection strategies:
(7)
where
and
are the
components of
and
.
For textual representation, samples are converted as:
where
is the
attribute name,
and
are attribute values, and
is the target value.
4. Technical Approach and Experimental Methods
4.1. Technical Roadmap
This paper aims to build an automated fact verification and question answering system based on LLM-ICL technology for tabular data analysis. Our research initiative serves two primary purposes: firstly, it provides the basic functional framework for subsequent research; secondly, it explores the potential of current LLM-ICL tabular reasoning methods in practical applications and identifies potential problems. A key technical challenge we address is the contradiction between token restrictions and reasoning with large tabular data. To systematically tackle this challenge, our research can be divided into eight sub-tasks, unfolding in three phases, with the specific technical roadmap shown in Figure 1.
4.2. System Setup
4.2.1. Data Preparation
This paper uses the IPUMS dataset as an example to validate the effectiveness of the structured data prediction algorithm based on large language models. The dataset originates from the Integrated Public Use Microdata Series (IPUMS) database and includes various features describing individual social attributes such as age, occupation category, education level, and profession. The prediction target is to determine whether an individual’s annual income exceeds $50,000.
Relying on social common sense, one can make a reasonable prediction of an individual’s income level based solely on social attributes provided by the dataset, such as “age” and “occupation category”, without the need for complex data analysis. This characteristic provides an experimental basis for investigating whether the prior knowledge embedded in the parameters of large language models can positively influence the prediction task.
Figure 1. Technical roadmap for LLM-ICL-Based table reasoning system development.
Specifically, the dataset includes 14 attribute variables, i.e.,
, with the feature vector
, where each component corresponds to an attribute in Table 2 (one row). Among these, eight are discrete variables, including work unit nature, education level, marital status, occupation, social relationship, race, gender, and nationality; six are continuous variables, including age, census enumerator serial number, years of education, capital gains, capital losses, and hours worked per week. Table 2 provides the variable types and specific meanings. The prediction target is whether an individual’s annual income exceeds $50,000, i.e.,
, where
indicates that the individual’s annual income exceeds $50,000, and
indicates that it does not.
Table 2. Variable types and descriptions of the IPUMS dataset.
Variable Name |
Variable Type |
Description |
age |
Continuous |
Age |
workclass |
Discrete |
Nature of work unit |
fnlwgt |
Continuous |
Census enumerator serial number |
education |
Discrete |
Education level |
education-num |
Continuous |
Years of education |
marital-status |
Discrete |
Marital status |
occupation |
Discrete |
Occupation |
relationship |
Discrete |
Social relationship |
race |
Discrete |
Race |
sex |
Discrete |
Gender |
capital-gain |
Continuous |
Capital gains |
capital-loss |
Continuous |
Capital losses |
hours-per-week |
Continuous |
Hours worked per week |
native-country |
Discrete |
Native country |
4.2.2. Selection of LLM Models
Given the diversity of Large Language Models (LLMs), several different LLM models-including GPT-3.5, Ernie-lite,Qwen-plus, Deepseek-V3.1, and Llama-4-will be used for systematic evaluation. A performance comparison will be conducted to determine the performance of each model across various specific tasks, including processing speed, accuracy, and adaptability to the economic and social development data of Xiangxi.
4.2.3. System Setup
Based on the performance evaluation results, the selected models will be integrated and optimized to improve the input-output process and adapt to the economic and social development data of western Hunan. Furthermore, multi-model fusion strategies will be explored so that the system can automatically select the most suitable model or model combination based on the nature of the question. Through model selection and strategy optimization, an efficient and accurate question-answering system prototype will be built, and system construction and preliminary testing will be conducted to ensure its stability and response speed, laying the foundation for the next stage of technological exploration and iterative improvement.
4.3. Technological Exploration
To improve the performance of table reasoning, this study will explore technologies from several aspects, including prompting strategies, selection of contextual content, and table serialization methods, to address challenges such as token quantity limitations. The accuracy of the system’s fact verification and question answering based on the evaluation indicators determined in the previous stage will be iteratively optimized.
Prompting Strategies: By designing effective prompting strategies, the model can be guided to reason along the correct thought path, thereby improving the quality and accuracy of the answers. A prompting strategy can be selected at runtime based on the specific statement/question. Various prompting strategies, including direct prediction, self-consistent decoding, thought chain, thought tree, and thought graph, will be tested.
Contextual Content Selection: Since LLMs typically have input token length limitations and computational costs are positively correlated with the number of tokens, how to fit as much accurate and relevant contextual content as possible into a limited input space is a key issue. Solving this problem is of great significance for complex data and large table data application scenarios. The plan is to draw on the large table processing methods in research and the vector database-similarity search method commonly used in current research.
Table serialization refers to transforming complex tabular data into a format more suitable for language models to process, thereby improving the LLM’s ability to understand and process table content. Currently testable and improveable table serialization methods include table-to-text description conversion, key-value pair conversion, entity relation extraction, and cell coordinate encoding.
5. Computer Experiments
5.1. Overall Evaluation Results
To rigorously evaluate the predictive performance of LLM-ICL in few-shot settings, this study employs a dual baseline approach, using XGBoost as the representative parametric machine learning algorithm and KNN for non-parametric approaches.
XGBoost: Developed by Chen Tianqi and colleagues, XGBoost [14] is an open-source machine learning tool based on the second-order tree algorithm GBDT (Gradient Boosting Decision Tree). The tool incorporates significant improvements to the original GBDT method at both algorithmic and engineering levels. In recent years, XGBoost has emerged as one of the most stable and effective machine learning tools available.
KNN: The K-Nearest Neighbors algorithm, introduced by Cover et al. [15], represents a non-parametric machine learning approach. This method identifies the K closest samples to the target instance in the feature space and determines the classification based on the majority class among these neighbors. KNN’s strength lies in its simplicity and intuitive nature, as it operates without relying on specific assumptions or model structures.
To assess LLM-ICLs’ predictive capability with limited samples, this research randomly selects 10 samples from the IPUMS dataset as the training set for both XGBoost and KNN algorithms, denoted as
, while using 100 randomly chosen samples as the test set, represented as
. A grid search strategy is implemented to optimize hyperparameters for both XGBoost and KNN algorithms. The optimal hyperparameter values are determined through five-fold cross-validation on the training dataset.
When applying the proposed LLM-ICL-based prediction framework, the “demonstration dataset” in the prompt consists of exactly 10 samples, meaning the contextual learning for LLM-ICLs is constrained to this limited sample size. For comprehensive evaluation of LLM-ICL performance, this study examines several prominent models: OpenAI’s GPT-3.5-turbo [16], Baidu’s Ernie-lite [17], Alibaba’s Qwen-plus [18], DeepSeek’s Deepseek-V3.1 [19], and Meta’s Llama-4 [20].
The evaluation employs accuracy, the most commonly used metric for binary classification tasks, defined as the proportion of correctly predicted samples. LLM-ICL outputs of “yes” correspond to predictions of “annual income exceeding $50,000”, while “no” indicates “annual income below $50,000”. If an LLM-ICL generates “uncertain” as output, it is considered an incorrect prediction regardless of the actual income level. To mitigate random variability, the study adopts a multiple random sampling strategy, with the final accuracy metric representing the average across all test iterations.
Table 3 presents the accuracy performance of XGBoost and KNN on the test dataset with equivalent training sample sizes, compared against LLM-ICLs utilizing the same 10 samples as demonstration examples. With a training sample size of N = 10, The XGBoost and KNN models achieve accuracy rates of 0.735 and 0.711, respectively. Although performance fluctuates across different sample sets, this value consistently falls below the accuracy levels attained by LLM-ICLs using equivalent sample quantities. These results demonstrate that LLM-ICLs substantially outperform supervised machine learning algorithms in scenarios with limited training data.
Further analysis reveals that when employing only 10 demonstration samples, the top-performing Qwen-plus model achieves an accuracy of 0.794. Remarkably, KNN and XGBoost require approximately 500 and 16,000 samples respectively to reach comparable accuracy levels. This finding underscores LLM-ICLs’ exceptional capability in handling structured data prediction tasks. Even with minimal samples, LLM-ICLs leverage their powerful learning capacities to achieve accuracy comparable to supervised machine learning models trained on substantially larger datasets, highlighting their significant potential for structured data prediction applications.
Table 3. Accuracy comparison of different algorithms on test dataset (presented as mean ± standard deviation).
Model Category |
Model Name |
Accuracy |
2*Supervised Machine Learning |
KNN |
0.711 ± 0.018 |
XGBoost |
0.735 ± 0.022 |
5*LLM-ICL Models |
GPT-3.5-turbo |
0.749 ± 0.010 |
Ernie-lite |
0.768 ± 0.007 |
Qwen-plus |
0.794 ± 0.009 |
Deepseek-V3.1 |
0.776 ± 0.014 |
Llama-4 |
0.759 ± 0.011 |
5.2. In-Depth Analysis of Sample Strategies and Scaling Effects
Table 4 presents a systematic comparative analysis of how “random sampling” and “nearest neighbor selection” strategies affect large language model prediction performance across varying sample sizes. In this carefully controlled experimental series, all data features were converted using natural language descriptions to ensure fair comparison. The experimental results unequivocally demonstrate that when maintaining identical sample quantities, models utilizing the nearest neighbor strategy for constructing demonstration sets significantly outperform those using random sampling. This consistent pattern confirms that selecting demonstration samples with high similarity to target samples effectively enhances model performance in structured data prediction tasks, thereby aligning with and extending findings observed in natural language processing applications.
As the number of demonstration samples increased from 3 to 10, all models exhibited steady improvement in prediction accuracy, regardless of the selection strategy employed. This indicates that providing more examples initially helps the model better understand the task pattern.
However, when sample size was further expanded to 15, certain models showed performance degradation. This phenomenon reveals a crucial characteristic of LLMs’ in-context learning mechanism: model performance does not continuously improve with increasing sample size.
Potential explanations for this pattern include: first, the “lost-in-the-middle” effect, where excessively long input sequences may impair models’ ability to identify critical information; second, an overabundance of demonstration examples could complicate pattern recognition processes, as the model struggles to identify the most relevant reasoning path among too many examples.
Additionally, the fixed context window of Transformer architectures forces a trade-off: more demonstration samples consume limited context resources, potentially leaving insufficient space for the model to effectively process the target query.
Table 4. Prediction accuracy under different sample selection strategies and sample sizes.
LLM-ICL Model |
Selection Strategy |
|
|
|
2*GPT-3.5-turbo |
Random Strategy |
0.736 |
0.749 |
0.745 |
Nearest Neighbor Strategy |
0.748 |
0.757 |
0.754 |
2*Ernie-lite |
Random Strategy |
0.752 |
0.768 |
0.758 |
Nearest Neighbor Strategy |
0.764 |
0.781 |
0.788 |
2*Qwen-plus |
Random Strategy |
0.775 |
0.794 |
0.788 |
Nearest Neighbor Strategy |
0.788 |
0.803 |
0.805 |
2*Deepseek-V3.1 |
Random Strategy |
0.761 |
0.776 |
0.783 |
Nearest Neighbor Strategy |
0.774 |
0.788 |
0.786 |
2*Llama-4 |
Random Strategy |
0.742 |
0.759 |
0.774 |
Nearest Neighbor Strategy |
0.754 |
0.771 |
0.788 |
6. Conclusions
This paper presents a novel LLM-ICL framework for structured data prediction, demonstrating significant advantages in few-shot learning scenarios. Experimental results on the IPUMS dataset show that our method achieves 79.4% accuracy with only 10 demonstration samples, substantially outperforming traditional machine learning approaches. The nearest neighbor sample selection strategy proves particularly effective, while an optimal sample size (10 - 15) balances information richness and model capacity.
Despite token limitations and model dependency challenges, this work validates LLM-ICL’s potential for tabular data reasoning, especially in data-scarce environments. Future research will focus on optimizing context selection strategies, exploring efficient table serialization methods, and extending the framework to multi-modal and cross-domain tabular reasoning tasks to enhance practical applicability.
Fund Project
This work was supported in part by the Natural Science Foundation of China under Grants 62466018, and by the Jishou University Scientific Research Project Jd24007.