arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.08466cs.LG
收藏

大型语言模型中的上下文聚类

In-Context Clustering with Large Language Models

New York University(纽约大学)

Ying Wang, Mengye Ren, Andrew Gordon Wilson

AI总结:

本文提出上下文聚类(ICC),利用大型语言模型的注意力机制灵活聚类多样数据,通过零样本和微调提升性能,并支持文本条件图像聚类,扩展了上下文学习到无监督领域。

摘要:

我们提出了上下文聚类(In-Context Clustering, ICC),这是一种基于大型语言模型(LLM)的灵活聚类程序,适用于来自不同分布的数据。与受预定义相似性度量约束的传统聚类算法不同,ICC通过注意力机制灵活地捕捉输入之间的复杂关系。我们表明,预训练的LLM在文本编码的数值数据上展现出令人印象深刻的零样本聚类能力,其注意力矩阵显示出显著的聚类模式。使用注意力矩阵进行谱聚类提供了出人意料的竞争性性能。我们进一步通过使用下一个词元预测(Next Token Prediction, NTP)损失进行微调,增强了LLM在数值和图像数据上的聚类能力。此外,LLM提示的灵活性使得文本条件下的图像聚类成为可能,这是经典聚类方法所缺乏的能力。我们的工作将上下文学习扩展到无监督设置,展示了LLM在聚类中的有效性和灵活性。我们的代码可在 https://agenticlearning.ai/icc 获取。

英文摘要:

We propose In-Context Clustering (ICC), a flexible LLM-based procedure for clustering data from diverse distributions. Unlike traditional clustering algorithms constrained by predefined similarity measures, ICC flexibly captures complex relationships among inputs through an attention mechanism. We show that pretrained LLMs exhibit impressive zero-shot clustering capabilities on text-encoded numeric data, with attention matrices showing salient cluster patterns. Spectral clustering using attention matrices offers surprisingly competitive performance. We further enhance the clustering capabilities of LLMs on numeric and image data through fine-tuning using the Next Token Prediction (NTP) loss. Moreover, the flexibility of LLM prompting enables text-conditioned image clustering, a capability that classical clustering methods lack. Our work extends in-context learning to an unsupervised setting, showcasing the effectiveness and flexibility of LLMs for clustering. Our code is available at https://agenticlearning.ai/icc.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑