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 · DOI

Abstract

Entity Resolution (ER) is a critical data integration task that identifies records referring to the same real-world entity. While Large Language Models (LLMs) excel at ER via In-Context Learning (ICL), the high token cost of repeated demonstrations makes large-scale application prohibitive. This paper introduces BATCHER, a framework that optimizes the design space of batch prompting for ER. By grouping multiple entity pairs into a single prompt and employing a novel covering-based demonstration selection strategy, BATCHER reduces costs by 4x–7x while maintaining or improving accuracy. Experimental results on the Magellan benchmark demonstrate that BATCHER achieves competitive performance with significantly fewer labeled examples than traditional fine-tuning methods.

Introduction

Entity Resolution (ER)—determining if two data records (e.g., "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, a labor-intensive process. While LLMs like GPT-4 can perform ER using In-Context Learning (ICL) with just a few demonstrations, the "token tax" is high. In standard prompting, the task description and demonstrations must be sent for every single pair, leading to redundant costs. This paper explores batch prompting—sending multiple questions in one prompt—to distribute costs without sacrificing accuracy.

Comparison between standard prompting and the proposed batch prompting approach.

The BATCHER Framework

The authors propose the BATCHER framework, which decomposes the ER process into two main modules: Question Batching and Demonstration Selection.

1. Question Batching

How should entity pairs be grouped? The authors explored three strategies:

  • Random: Selecting $b$ pairs arbitrarily.
  • Similarity-based: Grouping pairs that are structurally or semantically similar.
  • Diversity-based: Grouping pairs that are distinct from one another.

Counter-intuitively, diversity-based batching outperformed similarity-based batching. Grouping similar questions often made the LLM "lazy," leading to identical, incorrect answers across the batch, whereas diversity kept the model's attention sharp.

2. Demonstration Selection

Selecting the right labeled examples is crucial for guiding the LLM. While standard "Top-k" methods select examples similar to the input, BATCHER introduces Covering-based Selection. This strategy models demonstration selection as a Set Cover Problem. The goal is to find the minimum number of labeled examples needed to "cover" (be relevant to) all questions in a batch. A greedy algorithm ensures that every question in a batch has at least one highly relevant demonstration.

Illustration of different demonstration selection strategies, highlighting the Covering-based approach.

Experimental Evaluation

The framework was evaluated using the Magellan benchmark, covering domains such as electronics, software, citations, and specialized products (e.g., Beer, Restaurants).

Key Results

  • Cost Efficiency: Batch prompting achieved a 4x–7x cost reduction in API fees compared to standard prompting. Furthermore, covering-based selection reduced labeling costs by 10x–100x compared to per-question Top-k selection.
  • Accuracy Gains: Surprisingly, batching often improved accuracy, with F1 score increases ranging from 1.3% to 30.6%. Seeing multiple questions allows the LLM to better identify "deal-breaker" attributes.
  • Data Efficiency: BATCHER reached competitive performance with only 50 labeled samples, whereas traditional fine-tuned models like Ditto or RoBERTa required at least 2,000 samples.
  • Feature Selection: Simple string-similarity features (Levenshtein ratio) proved more effective for demonstration selection than complex semantic embeddings (SBERT), as ER often hinges on small structural differences like model numbers.

Conclusion

BATCHER demonstrates that batch prompting is a highly effective strategy for scaling LLM-based Entity Resolution. While proprietary models like GPT-4 and GPT-3.5-turbo handle batching well, smaller open-source models like Llama-2-70B still struggle with following complex batch formats. Future work will focus on improving batching reliability for open-source models and automating the tuning of the covering algorithm's distance thresholds.

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