Spaces:
Sleeping

p4r5kpftnp-cmd Claude Sonnet 4.6 commited on
Commit
ef4afaa
·
1 Parent(s): 5543636

Fix LLM hallucinated imports and slow thinking mode

Browse files

- langgraph_agent.py: add _sanitize_imports() which strips all LLM-generated
import lines and replaces them with `import Mathlib`. LLMs consistently
hallucinate non-existent Lean paths (e.g. Mathlib.TacticLibrary.Peel) that
break compilation; the correct import for any Mathlib proof is always
`import Mathlib`.

- rag_chain.py: tighten system prompt with explicit rules (keep imports,
no spurious `open`, prefer simple tactics). Add num_predict=1024 cap and
think=False to disable chain-of-thought mode on qwen3/gemma3 models —
without this, models spend 20+ minutes generating reasoning tokens before
the actual answer.

Tested: simple_add.lean (n + 0 = n) solved in 2 attempts with gemma3:12b,
verified by Lean REPL. Proof: `simp`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

2 files changed +25 -4
Files changed (2)
src/langgraph_agent.py+12-1
src/rag_chain.py+13-3