atlas

Research map / Large language models / Agents, code and math

Teaching Transformers to Solve Combinatorial Problems through Efficient Trial & Error

NeurIPS 2025 · Large language models › Agents, code and math · approach: LLM-guided program synthesis · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Trains a vanilla GPT-2-style causal Transformer to solve Sudoku (and 1-in-3 SAT) via DFS trial-and-error transcripts with multi-target loss, then optimizes guess selection as a contextual Min-Sum Set Cover problem.

Problem

LLMs and neural solvers struggle with combinatorial NP problems such as Sudoku, SAT and TSP; prior neural Sudoku solvers use custom architectures or single-pass prediction without error recovery, and imitation-learning transcripts cannot represent mistakes.

Approach

Train a standard causal Transformer on DFS trial-and-error transcripts (rule application, informed guessing, backtracking) with action-level 3-digit tokens and a multi-target cross-entropy loss; then, for depth-1 non-adaptive guessing, train the guess node with a loss L1 = (sum of backdoor probabilities)^-1 derived from Min-Sum Set Cover, trained only on successful trajectories.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use trial-and-error search with informed guessing and backtracking instead of direct rule-based imitationCausal Transformer Trial & Error · Kaggle unfilteredboard accuracy: 67.16% -> 98.90%Helped
Use trial-and-error search with informed guessing and backtracking instead of direct rule-based imitationCausal Transformer Trial & Error · Kaggle filteredboard accuracy: 87.18% -> 99.50%Helped
Use trial-and-error search with informed guessing and backtracking instead of direct rule-based imitationCausal Transformer Trial & Error · RRNboard accuracy: 94.80% -> 99.40%Helped
Train RRN on Random instead of RRN dataRRN · Randomboard accuracy: 79.30% -> 92.40%Helped
Use L1 expected-trials loss instead of L2 multiple-target Cross-Entropy (ablation)Depth-1 guessing policy · Sudoku, Randomguesses to solution (median): 2.2 -> 1.5 guessesHelped
Use L2 multiple-target Cross-Entropy rather than the upper-bound oracle orderingDepth-1 guessing policy · Sudoku, Randomguesses to solution (median): 2.3 -> 2.2 guessesNo clear effect
Replace triplet tokenization with compact action-level encoding (ablation)Causal Transformer rule-learning setup · Sudoku rule-logic trainingrule-logic accuracyHelped
Use multi-target loss instead of single-target loss (ablation)Causal Transformer rule-learning setup · Sudoku rule-logic trainingrule-logic accuracyHelped
Train only on successful trajectories, excluding incorrect guess tokens (ablation)Depth-1 guessing policy · Sudoku, Randomguesses to solutionHelped

Surprising findings

Limitations

Experimental setup

Datasets: Random Sudoku generator (SudokuPy) Kaggle Sudoku (unfiltered 3M) Kaggle filtered 1.9M RRN Sudoku dataset 1-in-3 SAT random instances

Benchmarks: Random Sudoku 100K test Kaggle unfiltered Kaggle filtered RRN test set 1-in-3 SAT

Metrics: board accuracy cell accuracy rule-logic accuracy time (sec/puzzle) median number of guesses

Baselines: RRN Recurrent Transformer Causal Transformer MDM GPT-4o Gemini-1.5 Pro o3-mini DeepSeek-R1

Builds on: Causal Transformer (Sudoku imitation of human strategies) minGPT DPLL Min-Sum Set Cover

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy