All MicroEvals
MAGENTA-in-Rust Implementation Report The MAGENTA-in-Rust ar...
Create MicroEval

MAGENTA-in-Rust Implementation Report The MAGENTA-in-Rust ar...

Prompt

MAGENTA-in-Rust Implementation Report The MAGENTA-in-Rust architecture has been implemented according to the build plan and the methodology of the paper ("MAGENTA: Closing the Loop Between Mathematical Reasoning and Formal Verification", Joshua Ong Jun Leang et al., arXiv:2609.11319v2). 1. Architecture & Repository Structure The implementation is structured as a Rust crate with a pinned Lean 4 verification environment: taya/ β”œβ”€β”€ Cargo.toml # Crate dependencies (tokio, reqwest, serde, clap, etc.) β”œβ”€β”€ rust-toolchain.toml # Pinned stable Rust toolchain β”œβ”€β”€ config.example.toml # Full pipeline, LLM, Lean, and budget configuration β”œβ”€β”€ prompts/ # Paper prompt templates (Appendix B.1) β”‚ β”œβ”€β”€ reasoner.txt # K2 informal reasoner prompt β”‚ β”œβ”€β”€ self_correction.txt # K2 mathematical self-correction prompt β”‚ β”œβ”€β”€ formaliser.txt # Goedel formaliser prompt β”‚ β”œβ”€β”€ statement_judge.txt # DeepSeek statement-alignment judge prompt β”‚ β”œβ”€β”€ prover.txt # Leanstral proof-generation prompt β”‚ └── error_judge.txt # DeepSeek error-attribution judge prompt β”œβ”€β”€ lean/ # Pinned Lean 4 & Mathlib environment β”‚ β”œβ”€β”€ lean-toolchain # leanprover/lean4:v4.29.1 β”‚ β”œβ”€β”€ lakefile.toml # Project dependencies and targets β”‚ β”œβ”€β”€ lake-manifest.json # Manifest recording Mathlib revision β”‚ └── Magenta/ β”‚ └── Verifier.lean # SafeVerify helper for Lean 4 β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ lib.rs # Library module definitions β”‚ β”œβ”€β”€ main.rs # CLI entrypoint (doctor, run, eval, replay) β”‚ β”œβ”€β”€ types.rs # Core domain types with strict invariants β”‚ β”œβ”€β”€ budget.rs # Multi-resource budget tracking ledger β”‚ β”œβ”€β”€ config.rs # Configuration loader and schema validator β”‚ β”œβ”€β”€ prompts.rs # Template loader and prompt formatter β”‚ β”œβ”€β”€ sandbox.rs # Subprocess sandbox with timeout & cleanup β”‚ β”œβ”€β”€ lean.rs # Lean runner, comment stripper, axiom auditor β”‚ β”œβ”€β”€ llm.rs # HTTP client with retries and mock client β”‚ β”œβ”€β”€ roles.rs # Typed contracts for R, F, Js, P, Je β”‚ β”œβ”€β”€ pipeline.rs # Full state machine controller (Algorithms 1-4) β”‚ β”œβ”€β”€ trace.rs # Non-interleaved JSONL event logger and artifacts β”‚ └── eval.rs # Evaluation metrics (Ver, VerCor, FCR, cost) β”œβ”€β”€ tests/ β”‚ β”œβ”€β”€ controller.rs # 9 deterministic controller state machine tests β”‚ β”œβ”€β”€ lean_runner.rs # 3 Lean runner and SafeVerify policy tests β”‚ β”œβ”€β”€ parsers.rs # 5 structured JSON & LaTeX boxed answer tests β”‚ └── replay.rs # 1 event trace and replay verification test β”œβ”€β”€ data/ β”‚ β”œβ”€β”€ smoke.jsonl # Smoke dataset with competition-style problems β”‚ └── smoke_refs.jsonl # Separate ground-truth reference answers └── runs/ # Artifact and event trace outputs 2. Key State Machine Invariants Implemented Strict Type Boundaries (AcceptedStatement): AcceptedStatement has private fields and can only be constructed if the statement judge verdict is Right. It preserves the proposition source, SHA-256 source hash, environment hash, statement verification evidence, and judge evidence. Statement Resampling Without Calling R: Rejection by $V_s$ (elaboration error) or $J_s$ (semantic misalignment) resamples the formaliser $F$ within budget $M$ and never triggers the reasoner $R$. Frozen Immutable Target for Prover: During the proof search inner loop (up to $K$ attempts), the accepted statement $s$ is immutable and strictly preserved. Attribution-Guided Routing: A code_error (SYNTAX) error routes locally to proof repair, leaving the reasoning chain, answer, and statement unchanged. A math_error (MATH) error constructs structured feedback $\varphi \in \mathcal{F}_{\mathrm{math}}$ and initiates a new reasoning attempt $t+1$ with a fresh statement search. Clean Exhaustion Policy: $M$ samples exhausted $\to$ UNCERTIFIED(StatementBudget). $K$ proof attempts exhausted $\to$ UNCERTIFIED(ProofBudget). $T$ attempts exhausted with MATH $\to$ UNCERTIFIED(ReasonerBudget). Global call, token, or time limits $\to$ UNCERTIFIED(Global*Budget). Infrastructure Failure Isolation: Subprocess crashes, timeouts, or network errors are marked as infrastructure failures and are never forwarded to the error judge as mathematical errors. SafeVerify Axiom Policy: Audits proofs to allow only propext, Classical.choice, and Quot.sound. Strips comments before token inspection, rejecting sorry, admit, sorryAx, and native_decide while avoiding keyword false positives in benign comments. 3. Test Suite Verification Results All 18 unit and integration tests across 4 test suites pass: running 9 tests in tests/controller.rs: test test_vs_rejection_skips_js ... ok test test_m_exhaustion_stops_with_statement_budget ... ok test test_k_exhaustion_stops_with_proof_budget ... ok test test_global_api_calls_budget_enforcement ... ok test test_math_error_triggers_reasoner_feedback_and_new_statement_search ... ok test test_syntax_keeps_statement_unchanged ... ok test test_js_rejection_calls_f_again_never_r ... ok test test_math_at_final_t_stops_with_reasoner_budget ... ok test test_infrastructure_failure_stops_without_calling_error_judge ... ok result: ok. 9 passed; 0 failed running 3 tests in tests/lean_runner.rs: test test_mock_verifier_statement_elaboration ... ok test test_mock_verifier_policy_checks ... ok test test_accepted_statement_constructor_invariants ... ok result: ok. 3 passed; 0 failed running 5 tests in tests/parsers.rs: test test_parse_boxed_answer_nested ... ok test test_statement_judgment_deserialization ... ok test test_answer_integer_parsing ... ok test test_extract_json_substring ... ok test test_error_judgment_deserialization ... ok result: ok. 5 passed; 0 failed running 1 test in tests/replay.rs: test test_event_trace_serialization_and_replay ... ok result: ok. 1 passed; 0 failed 4. End-to-End CLI Verification doctor bash cargo run -- doctor Verifies Rust/Cargo versions, Lean/Lake toolchain status, configuration file syntax, and API key presence. run bash cargo run -- run --mock --input data/smoke.jsonl --config config.example.toml --run-id smoke_test Runs the end-to-end pipeline on input problems, generating trace events in runs/smoke_test/events.jsonl, results in runs/smoke_test/results.jsonl, and per-problem artifacts in runs/smoke_test/problems/<id>/. eval bash cargo run -- eval --results runs/smoke_test/results.jsonl --references data/smoke_refs.jsonl Produces the formal evaluation summary: ======================================== MAGENTA EVALUATION REPORT ======================================== Total Problems (N) : 3 Certified Problems (C) : 3 Certified Correct (C_cor): 3 Verification Rate (Ver) : 100.00% VerCor Rate : 100.00% False Cert. Rate (FCR) : 0.00% Overall Answer Accuracy : 100.00% ---------------------------------------- Stop Reasons: - CERTIFIED: 3 ======================================== is this ok or some thing needed to to improved theen i needed to run t=with a local modal wirh llma cpp or anyting read this webste paper first https://arxiv.org/html/2609.11319v2 then all the best plan like best of alll https://github.com/WeiboAI/CLR i want to intrage this and give me a full read me

Drag to resize