arXiv:2508.06931cs.AIcs.LG2025-08被引 8

用检索增强提升大模型数学形式化准确率,解决定义错误和语义模糊问题。

Automated Formalization via Conceptual Retrieval-Augmented LLMs

  • 从Lean4数学库自动构建26000+定义的知识库,支持概念精准检索
  • 通过双通道重排序检索,实现核心数学概念的高精度匹配
  • 在多个基准上提升形式化准确率,最高达62.1%,适合自动化证明研究者

交互式定理证明器需要人工进行形式化,耗时且需专业知识。尽管自动化形式化有潜力,但仍面临两大挑战:模型幻觉(如未定义谓词、符号误用、版本不兼容)和自然语言描述中前提模糊或缺失导致的语义鸿沟。为此,我们提出CRAMF——一种基于概念检索增强的数学形式化框架。CRAMF通过检索核心数学概念的正式定义,为代码生成提供上下文支撑。由于缺乏结构化知识库、数学概念的多态性及形式化检索的高精度要求,该任务极具挑战。我们从Mathlib4(Lean4的标准数学库)自动构建知识库,涵盖超过26,000个正式定义和1,000多个核心数学概念。针对概念多态性,提出融合领域与应用级信号的上下文查询增强方法;设计双通道混合检索策略并引入重排序机制,确保检索准确性与相关性。在miniF2F、ProofNet及新提出的AdvancedMath基准上的实验表明,CRAMF可无缝集成至大模型形式化系统,在翻译准确率上实现持续提升,最高达62.1%,平均相对提升29.9%。

原文摘要 · Abstract (English)

Interactive theorem provers (ITPs) require manual formalization, which is labor-intensive and demands expert knowledge. While automated formalization offers a potential solution, it faces two major challenges: model hallucination (e.g., undefined predicates, symbol misuse, and version incompatibility) and the semantic gap caused by ambiguous or missing premises in natural language descriptions. To address these issues, we propose CRAMF, a Concept-driven Retrieval-Augmented Mathematical Formalization framework. CRAMF enhances LLM-based autoformalization by retrieving formal definitions of core mathematical concepts, providing contextual grounding during code generation. However, applying retrieval-augmented generation (RAG) in this setting is non-trivial due to the lack of structured knowledge bases, the polymorphic nature of mathematical concepts, and the high precision required in formal retrieval. We introduce a framework for automatically constructing a concept-definition knowledge base from Mathlib4, the standard mathematical library for the Lean 4 theorem prover, indexing over 26,000 formal definitions and 1,000+ core mathematical concepts. To address conceptual polymorphism, we propose contextual query augmentation with domain- and application-level signals. In addition, we design a dual-channel hybrid retrieval strategy with reranking to ensure accurate and relevant definition retrieval. Experiments on miniF2F, ProofNet, and our newly proposed AdvancedMath benchmark show that CRAMF can be seamlessly integrated into LLM-based autoformalizers, yielding consistent improvements in translation accuracy, achieving up to 62.1% and an average of 29.9% relative improvement.

形式化验证检索增强大模型数学推理

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