arXiv:2509.22023cs.LG2025-09NeurIPS被引 3

用自洽试错法让Transformer仅靠猜和回溯解出99%的数独

Teaching Transformers to Solve Combinatorial Problems through Efficient Trial & Error

  • 用GPT-2做深度优先搜索,结合规则模仿与单次猜测策略
  • 99%数独题仅需一次猜测即可解出,显著优于以往方法
  • 无需外部工具,适合想用通用模型解决组合问题的研究者

尽管大型语言模型在各类语言任务中表现优异,但在可满足性、旅行商问题或基础算术等组合问题上仍表现不佳。本文针对NP类问题提出一种新颖的试错求解方法,通过迭代生成候选解并利用验证器高效验证。以典型的数独问题为例,该方法在不使用外部工具或函数调用的前提下,仅用标准的解码器型Transformer(GPT-2)即达到99%的准确率,超越现有神经符号方法。方法结合简单数独规则的模仿学习与显式的深度优先搜索策略,包含有指导的猜测与回溯机制。进一步地,通过深度为1的猜测策略最小化尝试次数,实证表明几乎所有数独均可仅凭规则与最多一次猜测求解。本文对这一设置进行严格分析,揭示其与算法与随机优化中经典问题‘最小和集合覆盖’的上下文变体之间的关联。

原文摘要 · Abstract (English)

Despite their proficiency in various language tasks, Large Language Models (LLMs) struggle with combinatorial problems like Satisfiability, Traveling Salesman Problem, or even basic arithmetic. We address this gap through a novel trial & error approach for solving problems in the class NP, where candidate solutions are iteratively generated and efficiently validated using verifiers. We focus on the paradigmatic task of Sudoku and achieve state-of-the-art accuracy (99%) compared to prior neuro-symbolic approaches. Unlike prior work that used custom architectures, our method employs a vanilla decoder-only Transformer (GPT-2) without external tools or function calling. Our method integrates imitation learning of simple Sudoku rules with an explicit Depth-First Search (DFS) exploration strategy involving informed guessing and backtracking. Moving beyond imitation learning, we seek to minimize the number of guesses until reaching a solution. This is achieved using depth-1 guessing, showing empirically that almost all Sudoku can be solved using the puzzle's rules with at most one guess. We provide a rigorous analysis of this setup formalizing its connection to a contextual variant of Min-Sum Set Cover, a well-studied problem in algorithms and stochastic optimization.

数独Transformer试错组合优化

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