arXiv:2501.13959cs.CLcs.AI2025-01被引 7

用数学库数据训练轻量检索模型,提升形式化证明的效率。

Learning an Effective Premise Retrieval Model for Efficient Mathematical Formalization

  • 基于Mathlib数据,用对比学习训练查询与前提的嵌入模型。
  • 在多个基准上准确率超越基线,计算开销更低。
  • 适合数学形式化新手,开源工具支持快速检索。

形式化数学近年来受到广泛关注,能协助各领域数学家工作。前提检索作为形式化过程中的常见步骤,对新手而言仍具挑战。现有自然语言查询方法需用户具备一定数学知识,而基于形式语言(如Lean)的方法因训练数据稀缺,难以训练出高效且泛化的检索模型。本文提出一种新方法,利用从Mathlib中提取的数据训练轻量高效的前提检索模型。该模型将查询(即Lean提供的证明状态)与前提嵌入到潜在空间,采用专为形式化语料训练的分词器,并在对比学习框架下优化,结合细粒度相似性计算与重排序模块以提升性能。实验表明,该模型在准确率上优于现有基线,同时计算负载更低。我们已在https://premise-search.com/发布基于该模型的开源搜索引擎,源代码与训练模型详见https://github.com/ruc-ai4math/Premise-Retrieval。

原文摘要 · Abstract (English)

Formalized mathematics has recently garnered significant attention for its ability to assist mathematicians across various fields. Premise retrieval, as a common step in mathematical formalization, has been a challenge, particularly for inexperienced users. Existing retrieval methods that facilitate natural language queries require a certain level of mathematical expertise from users, while approaches based on formal languages (e.g., Lean) typically struggle with the scarcity of training data, hindering the training of effective and generalizable retrieval models. In this work, we introduce a novel method that leverages data extracted from Mathlib to train a lightweight and effective premise retrieval model. In particular, the proposed model embeds queries (i.e., proof state provided by Lean) and premises in a latent space, featuring a tokenizer specifically trained on formal corpora. The model is learned in a contrastive learning framework, in which a fine-grained similarity calculation method and a re-ranking module are applied to enhance the retrieval performance. Experimental results demonstrate that our model outperforms existing baselines, achieving higher accuracy while maintaining a lower computational load. We have released an open-source search engine based on our retrieval model at https://premise-search.com/. The source code and the trained model can be found at https://github.com/ruc-ai4math/Premise-Retrieval.

形式化检索Lean数学

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。