NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

In-context Clustering-based Entity Resolution with Large Language Models: A Design Space Exploration

Jiajie Fu, Haitong Tang, Arijit Khan, Sharad Mehrotra, Xiangyu Ke, Yunjun Gao

Introduction

Entity Resolution (ER) is a fundamental data-cleaning task aimed at identifying records that refer to the same real-world entity. For instance, a system must recognize that "Alice Johnson, 123-4567" and "A. Johnson, 123-4567" are the same person. Traditionally, ER has relied on pairwise matching—asking "Do Record A and Record B match?" for every possible pair. While effective, this approach suffers from quadratic $O(N^2)$ complexity, making it prohibitively expensive and slow when using Large Language Models (LLMs) via APIs.

Comparison of traditional pairwise matching versus the proposed in-context clustering approach.

The LLM-CER Framework

To address the scalability issues of pairwise matching, this paper introduces LLM-CER (LLM-powered Clustering-based ER). Instead of binary comparisons, LLM-CER prompts the model to directly cluster groups of records in-context. This shift significantly reduces the number of API calls and leverages the inherent ability of LLMs to understand semantic relationships across multiple items simultaneously.

Core Components

The framework consists of three primary innovations:

  1. Next Record Set Creation (NRS): This module optimizes the input prompt by selecting a "sweet spot" of records (typically 9 records representing about 4 entities). It also ensures that semantically similar records are placed consecutively to reduce the model's cognitive load.
  2. Misclustering Detection Guardrail (MDG): To mitigate hallucinations, MDG uses a deterministic verification step. It compares embedding similarities of the LLM's output clusters. If a record's similarity to its assigned cluster is lower than to another, the system triggers a re-prompting mechanism.
  3. Hierarchical Cluster Merging (CMR): This component allows the system to scale beyond small batches. It treats LLM-generated clusters as "representative" records and hierarchically merges them, avoiding exhaustive pairwise checks across the entire dataset.
An example prompt for LLM-based in-context clustering, where multiple records are grouped into a 2D array in a single step.

Key Insights and Design Space

The authors' exploration of the design space revealed several critical factors for success:

  • Prompt Configuration: LLMs perform best when prompts are not overloaded. The optimal configuration found was 9 records per prompt.
  • Record Ordering: The sequence of records in a prompt matters. Grouping similar records together helps the LLM discern subtle differences more accurately.
  • Efficiency vs. Cost: By moving from pairwise comparisons to clustering, LLM-CER achieves up to a 5x reduction in API calls. This makes high-quality ER financially viable for larger datasets compared to previous LLM-based methods or expensive fine-tuning of older models.

Evaluation and Results

LLM-CER was evaluated across nine real-world datasets, including e-commerce, academic citations, and music. The results demonstrate that the method consistently outperforms state-of-the-art LLM baselines like Booster and CrowdER+LLM.

  • Accuracy: The approach achieved up to 150% higher accuracy and a significant increase in the FP-measure (a clustering quality metric).
  • Robustness: The MDG guardrail improved the FP-measure by up to 22% on challenging datasets like Cora, with only a marginal increase in processing time.
  • Cost: On the Alaska dataset, LLM-CER cost approximately $0.15, whereas fine-tuning models like Ditto could exceed $260.

Conclusion

LLM-CER represents a significant step forward in making LLM-based Entity Resolution practical. By reframing ER as an in-context clustering task and implementing robust hierarchical merging and verification guardrails, the framework achieves superior accuracy with a fraction of the computational and financial cost of traditional pairwise methods. Future work will explore more advanced progressive blocking techniques to further enhance the pipeline's scalability.

Summary updated

BibTeX
@inproceedings{fu2025context,
  author = {Jiajie Fu and Haitong Tang and Arijit Khan and Sharad Mehrotra and Xiangyu Ke and Yunjun Gao},
  title = {{In-context Clustering-based Entity Resolution with Large Language Models: A Design Space Exploration}},
  booktitle = {Proc. ACM Manag. Data},
  year = {2025},
  url = {https://openreview.net/forum?id=XZWcL0qda3},
}

Loading related content...

Figure