用大模型+自定义KNN实现可解释的物品相似搜索
SPELUNKER: Item Similarity Search Using Large Language Models and Custom K-Nearest Neighbors
- 大模型将自然语言转为结构化属性查询
- 自定义KNN结合球树策略提升检索准确率
- 适合需要透明解释的推荐系统场景
本文提出一种混合系统,通过大语言模型(LLM)与定制的K近邻(KNN)算法结合,实现直观的物品相似性搜索。不同于黑箱密集向量系统,该架构首先利用LLM将自然语言查询转化为结构化的属性搜索,再通过采用球树搜索策略和异构距离度量的定制KNN算法进行检索。在包含500条葡萄酒评论的数据集上评估表明,该系统表现优异:LLM在信息提取任务中获得0.9779的F1分数,且与原始文本的杰罗字符串相似度达0.9321。当在KNN中引入基于LLM的重排序后,召回率显著提升(p=0.013),证明其能有效捕捉用户隐含意图。该方法成功弥合了人类语言与机器可理解的物品表示之间的差距,提供透明且细致的搜索能力。
原文摘要 · Abstract (English)
This paper presents a hybrid system for intuitive item similarity search that combines a Large Language Model (LLM) with a custom K-Nearest Neighbors (KNN) algorithm. Unlike black-box dense vector systems, this architecture provides superior interpretability by first using an LLM to convert natural language queries into structured, attribute-based searches. This structured query then serves as input to a custom KNN algorithm with a BallTree search strategy, which uses a heterogeneous distance metric to preserve distinct data types. Our evaluation, conducted on a dataset of 500 wine reviews, demonstrates the system's effectiveness. The LLM achieved an F1-score of 0.9779 in information extraction, while also demonstrating high fidelity with a Jaro string similarity of 0.9321. When we augmented the KNN algorithm with LLM-based re-ranking, we observed a statistically significant improvement in recall (p=0.013), indicating the LLM's ability to identify and promote relevant items that align with nuanced user intent. This approach effectively bridges the gap between human language and machine-understandable item representations, offering a transparent and nuanced search capability.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。