Spaces:
Sleeping
Sleeping
Commit History
-
Repo cleanup: dead code out, test isolation fix, real README
p4r5kpftnp-cmd- Remove src/lmm_client.py and src/proof_agent.py — MVP-era relics with zero production importers since the provider routing moved into rag_chain. Their tests go with them (including the proof_agent default-model regression test, obsolete with the module deleted). - Fix sys.modules pollution in test_manual_bug_fixes.py: it installed MagicMocks at lean_verifier/retriever/rag_chain at import time and never restored them, poisoning every test module imported later during discovery (alphabetical order put 6 files after it). Mocks are now installed only around the langgraph_agent import and restored in a finally block; the mock-built langgraph_agent is evicted too. - Replace the 344-line MVP design doc README (Ollama-era, described the since-removed reranker) with an accurate project README: architecture diagram, RAG details with real numbers, model matrix, local-run quickstart, honest small-sample benchmark table, project layout, CI notes. HF Spaces frontmatter un…16fb4fc
-
Swap MiniLM retriever for LeanDojo's ByT5 premise encoder
p4r5kpftnp-cmdReplaces the general-English `all-MiniLM-L6-v2` embedder with `kaiyuy/leandojo-lean4-retriever-byt5-small` — a ByT5 encoder fine-tuned on (proof_state, used_premise) pairs from Mathlib. Semantic retrieval now returns directly-relevant lemmas (`Nat.add_comm`, `Nat.add_assoc`, …) where the old setup returned irrelevant matches. What changed: - New `src/byt5_embedder.py` — LangChain Embeddings wrapper around the ByT5 encoder (mean-pooled + L2-normalized). - New `scripts/build_leandojo_index.py` — downloads the 181k pre-computed premise embeddings + dictionary from the LeanDojo HuggingFace repo and builds an IVFPQ FAISS index. IVFPQ compresses ~1 GB flat embeddings to ~17 MB with ~95% recall, keeping us under GitHub's free LFS quota. - `src/retriever.py` — drops BM25 ensemble and the generic `ms-marco-MiniLM-L-6-v2` cross-encoder reranker. The LeanDojo encoder is already domain-specialized; the generic rerank was reordering correct premises below irrelevant ones (verifie…d05440d
-
Add CI/CD: GitHub Actions workflow + ruff config
p4r5kpftnp-cmdNew .github/workflows/ci.yml with three jobs: - lint: ruff check on every push/PR (fast, no project deps) - test: pytest over the ~98-test suite on every push/PR - deploy: on push to main only, pushes to the HF Space (gated on an HF_TOKEN secret — skips cleanly if the secret isn't set) Supporting changes to make the suite CI-green: - ruff.toml: line-length 120; ignore E402 (sys.path.insert-before-import is intentional in tests/scripts) and E741; exclude web/, data/, .claude/. - Fixed test isolation: test_proof_agent.py and test_app_fuzz.py permanently overwrote sys.modules["langgraph_agent"] with a mock and never restored it, poisoning every later test file (31 failures in a full run). They now restore sys.modules after importing their target. - test_retriever_fuzz.py: force a fresh `retriever` import so a cached real module from another test file can't shadow its mocks. - test_lean_verifier.py: skipUnless(`lean` on PATH) so the 3 real-Lean tests skip on CI r…6cf7e7c
-
benchmark.py: support Claude API + local-files mode
p4r5kpftnp-cmd- New --api-key flag forwarded to LangGraphAgent (works for both Groq and Anthropic / Claude models; falls back to env vars). - New --problems-dir mode that iterates local .lean files instead of loading MiniF2F from HuggingFace. Useful for cheap, repeatable benchmarks against the lecture problems committed in problems/. - Default model changed from "gemma3:12b" (old Ollama) to "llama-3.3-70b-versatile" (Groq).51bfe3e
-
Add MiniF2F benchmark harness and improve proof agent robustness
p4r5kpftnp-cmd +1: Claude Sonnet 4.6- scripts/benchmark.py: new benchmark runner against MiniF2F-valid (244 problems); reports pass@k for k=1..max_retries, avg attempts-to-solve, avg wall-clock time, and writes a per-problem CSV for ablation analysis - langgraph_agent.py: track solved_at_attempt in ProofState; expose solve_file_detailed() returning {success, solved_at_attempt, total_attempts}; add _count_theorem_blocks() guard that rejects LLM responses that silently drop theorem statements (false-success bug) - rag_chain.py: rewrite system prompt with tactic reference, common mistakes section, and seven few-shot examples; escape curly braces in Lean implicit-arg syntax so LangChain doesn't treat them as template variables (KeyError crash) - problems/lecture{4-7}_problems.lean: verified Lean 4 solutions for 11 problems drawn from course lecture notes (Lectures 4-7) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>8c51ce7
-
Add LangChain/LangGraph RAG pipeline for retrieval-augmented proof generation
p4r5kpftnp-cmd +1: Claude Sonnet 4.6- src/mathlib_corpus.py: walks Mathlib4 .lean source files and extracts theorem/lemma/def declarations as LangChain Documents - src/retriever.py: MathLibRetriever — FAISS + BM25 hybrid retrieval via EnsembleRetriever (60/40), reranked with CrossEncoder; index persisted to data/mathlib_index/ for reuse across runs - src/rag_chain.py: RAGProofChain — LangChain LCEL chain (ChatPromptTemplate | OllamaLLM | StrOutputParser) that injects retrieved lemma context into each proof-generation call - src/langgraph_agent.py: LangGraphAgent — replaces the plain Python retry loop with a proper state machine (verify → retrieve → generate → verify); exposes the same solve_file() API - src/proof_agent.py: thin backward-compatible wrapper around LangGraphAgent - scripts/build_index.py: one-time offline script to build and save the FAISS index from Mathlib4 source - scripts/run_agent.py: updated to use LangGraphAgent directly - requirements.txt: add faiss-cpu, rank-bm25, sentence-transform…3ac681e