Cost-Effective In-Context Learning for Entity Resolution: A Design Space Exploration

Meihao Fan, Xiaoyue Han, Ju Fan, Chengliang Chai, Nan Tang, Guoliang Li, Xiaoyong Du

TL;DR

Researchers have introduced BATCHER, a framework that slashes the cost of using Large Language Models (LLMs) for Entity Resolution (ER) by 4x–7x. By grouping multiple entity pairs into a single "batch prompt" and using a novel "covering-based" strategy to select the most informative examples, BATCHER not only saves money but often achieves higher accuracy than traditional one-at-a-time prompting.

What Problem Does This Paper Address?

Entity Resolution (ER)—the task of determining if two data records (like "iPhone 13" and "Apple iPh 13") refer to the same real-world object—is a cornerstone of data integration. Traditionally, this required fine-tuning models on thousands of labeled examples, which is labor-intensive.

While LLMs like GPT-4 can perform ER using "In-Context Learning" (ICL) with just a few examples (demonstrations), the "token tax" is high. In standard prompting, you must send the task description and the same set of demonstrations for every single pair you want to check. If you have 500,000 pairs, you are paying for those demonstrations 500,000 times. This paper explores batch prompting—sending multiple questions in one go—to distribute that cost, while investigating the best way to group questions and select examples without sacrificing accuracy.

Methods

The authors propose the BATCHER framework, which breaks the process into two main modules:

  1. Question Batching: How do we group entity pairs together? The authors explored three strategies:
  2. Random: Just grab $b$ pairs.
  3. Similarity-based: Group pairs that look alike.
  4. Diversity-based: Group pairs that are different from one another.
  5. Demonstration Selection: Which labeled examples should the LLM see to learn the task? They compared standard "Top-k" methods against their own Covering-based Selection.

The Covering-based strategy is the paper's primary algorithmic contribution. The authors modeled demonstration selection as a Set Cover Problem (which is NP-hard). The goal is to find the minimum number of labeled examples needed to "cover" (be relevant to) all the questions in a batch. They used a greedy algorithm to select these examples, ensuring that every question in a batch has at least one highly relevant demonstration to guide the LLM.

Datasets

The framework was evaluated using the Magellan benchmark, a standard in the ER community. It includes eight datasets across various domains:

  • Electronics/Products: Walmart-Amazon (WA), Abt-Buy (AB).
  • Software: Amazon-Google (AG).
  • Citations: DBLP-Scholar (DS), DBLP-ACM (DA).
  • Specialized: Fodors-Zagats (Restaurants), iTunes-Amazon (Music), and Beer.

Key Insights and Ideas

  • The "Batching Bonus": Surprisingly, batching doesn't just save money; it often improves accuracy. When an LLM sees multiple questions at once, it can compare them to identify which attributes are "deal-breakers" (e.g., realizing that a modelno difference always means a non-match).
  • Diversity Over Similarity: Counter-intuitively, grouping similar questions together (Similarity-based batching) performed the worst. It made the LLM "lazy," leading it to give identical, often incorrect, answers to everything in the batch. Diversity-based batching kept the model's "attention" sharp.
  • Extreme Data Efficiency: BATCHER achieved competitive results with as few as 50 labeled samples, whereas traditional fine-tuned models (like Ditto or RoBerta) required at least 2,000 samples to reach the same performance level.
  • Structure-Awareness Matters: Using a simple string-similarity feature extractor (Levenshtein ratio) to select demonstrations worked better than using complex semantic embeddings (SBERT). In ER, small structural differences (like a single digit in a model number) are often more important than general semantic meaning.

Key Results

  • Cost Savings: Batch prompting achieved 4x–7x cost reduction in API fees compared to standard prompting.
  • Accuracy Gains: BATCHER improved the F1 score (a measure of accuracy) by 1.3% to 30.6% across most datasets.
  • Labeling Efficiency: The covering-based selection reduced labeling costs by 10x–100x compared to selecting specific "Top-k" examples for every single question.
  • Model Comparison: While GPT-4 is the most accurate, GPT-3.5-turbo-0301 was identified as the "sweet spot" for cost-effectiveness, providing high accuracy at a fraction of GPT-4's price.

Limitations and Future Work

  • Open-Source Struggles: The authors noted that smaller open-source models like Llama-2-70B struggled with batch prompting, often failing to follow the format or answer all questions in the batch. This suggests batching might currently be a "capability" reserved for larger or more highly-tuned proprietary models.
  • Token Limits: There is a physical limit to how many questions and demonstrations can fit in one prompt (the context window).
  • Future Directions: The authors suggest exploring how to automatically tune the "distance threshold" for the covering algorithm and investigating how to make batching work more reliably on open-source LLMs.

Summary updated

BibTeX
@inproceedings{fan2024cost,
  author = {Meihao Fan and Xiaoyue Han and Ju Fan and Chengliang Chai and Nan Tang and Guoliang Li and Xiaoyong Du},
  title = {{Cost-Effective In-Context Learning for Entity Resolution: A Design Space Exploration}},
  booktitle = {ICDE},
  year = {2024},
  doi = {10.1109/icde60146.2024.00284},
}
Figure