Augmenting In-Context-Learning in LLMs via Automatic Data Labeling and Refinement

Joseph Shtok, Amit Alfassy, Foad Abo Dahood, Eliyahu Schwartz, Sivan Doveh, Assaf ArbellearXiv 2024 · DOI

Introduction

In-Context Learning (ICL) and Chain-of-Thought (CoT) prompting have significantly advanced the capabilities of Large Language Models (LLMs), enabling them to tackle complex reasoning tasks through a few provided examples. However, a critical bottleneck persists: the manual curation of high-quality examples containing intermediate reasoning steps—such as executable code or logical deductions—is both expensive and time-consuming. While simple input-output pairs are abundant, they often lack the depth required for complex problem-solving. Furthermore, random example selection frequently leads to inconsistent model performance.

To address these challenges, researchers at IBM Research AI developed Automatic Data Labeling and Refinement (ADLR). This method transforms weakly labeled datasets into high-quality, multi-step demonstrations, enhancing LLM performance without manual intervention.

The ADLR Framework

The ADLR pipeline consists of three distinct phases designed to harvest, filter, and utilize high-quality reasoning examples.

The three-stage ADLR pipeline: Harvesting correct demonstrations, selecting a useful subset, and final inference.

Part I: Harvesting (Pool A)

The process begins by utilizing a baseline LLM, guided by a minimal seed of manual examples, to process a large training set of questions and final answers. If the LLM generates intermediate steps that lead to the correct final answer, the example is "harvested" into Pool A. The core assumption is that a correct final answer serves as a reliable proxy for the correctness of the underlying reasoning or code.

Part II: Refinement (Pools B & C)

Recognizing that not all correct examples are equally effective as "teachers," ADLR applies two layers of filtering:

  1. Hardness Filter (Pool B): Examples are ranked by difficulty. "Hard" samples—those the model solves correctly in only a small fraction of attempts (e.g., <20%)—are prioritized. Easy examples are excluded as they provide minimal new information.
  2. Utility Filter (Pool C): The remaining hard samples are evaluated for their pedagogical value. Through one-shot experiments, the system identifies which examples from Pool B best assist the model in solving other difficult queries. Only the most "useful" examples are retained in Pool C.

Part III: Inference

During the final task execution, the system employs a robust inference strategy. It samples multiple diverse subsets from Pool C to construct various prompts. The LLM processes each prompt, and a final answer is determined via majority vote across the multiple outputs.

Experimental Evaluation

The effectiveness of ADLR was tested across three prominent benchmarks requiring complex reasoning: WikiTableQuestions (WikiTQ), Table Fact Checking (TabFact), and TabMWP (mathematical word problems involving tables).

Cumulative distribution of examples by difficulty for WikiTQ and TabFact datasets.

Key Insights and Results

The study yielded several significant findings regarding the nature of effective ICL:

  • The Value of Difficulty: Counter-intuitively, using the entire pool of correct examples (Pool A) can degrade performance. Optimal results are achieved when the model is prompted with examples it previously found challenging.
  • Measurable Utility: The "pedagogical" quality of an example can be quantitatively ranked based on its ability to improve performance on a validation set of hard queries.
  • Diversity over Similarity: Randomly sampling from the refined Pool C outperformed semantic similarity (K-NN) selection. This suggests that a diverse set of high-quality examples is more robust than a set tailored to "look like" the query.

Performance Gains

When integrated with state-of-the-art frameworks like Binder and ReAcTable, ADLR delivered consistent improvements:

  • TabMWP: CodeLlama-34b saw a 5.5% accuracy gain, while Mixtral-8x7b improved by 2.6%.
  • WikiTQ: Accuracy rose from 58.9% to 64.3% using a fine-tuned version of the harvested data.
  • TabFact: Performance increased from 78.6% to 83.8%.

Limitations and Future Work

While ADLR significantly boosts performance in reasoning-heavy tasks, it has limitations. It is primarily designed for tasks requiring intermediate steps (CoT or code) and may be less effective for simple creative writing or basic fact retrieval. Additionally, the "Harvesting" and "Utility" phases incur a significant one-time offline computational cost. Future research will focus on generalizing the ADLR method and exploring its integration into more complex, agentic workflows.

Summary updated

BibTeX
@misc{shtok2024augmenting,
  author = {Joseph Shtok and Amit Alfassy and Foad Abo Dahood and Eliyahu Schwartz and Sivan Doveh and Assaf Arbelle},
  title = {{Augmenting In-Context-Learning in LLMs via Automatic Data Labeling and Refinement}},
  year = {2024},
  eprint = {2410.10348},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.10348},
}
Figure