gwaya
Runs local Qwen/Gwen code-generation models through Ollama to power the sample-and-repair loop (generating candidate solutions and iteratively fixing them from real test feedback), and reports available local Ollama GPU models via the system status tool.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gwayaaudit this generated Python code for stubs and verify it in a sandbox"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GWAYA: Fail-Closed Gate & Real Toolchain Verification for LLM Code Generation
GWAYA (Gwen-Laya Open Model) is a zero-trust, fail-closed verification layer that sits between code-generating language models (such as the Qwen / Gwen series) and execution environments.
Unlike traditional code checkers that yield false positives when toolchains are missing or models emit placeholder stubs, GWAYA is strictly fail-closed: a candidate is accepted only if real, deterministic compilers and sandboxed execution positively succeed. Every situation where checking cannot run (missing compiler, offline fallback, lack of generator) yields
UNVERIFIEDwith maximum penalty energy ($E = 10^6$).
๐ Links to Official Releases & Reports
Zenodo Permanent Archival (v3.1.1): https://doi.org/10.5281/zenodo.23123923
Hugging Face Verified Artifacts & Raw Telemetry: callensxavier/gwaya-v3-verified-report
Verified Research Report (PDF):
papers/gwaya_v3_verified_report.pdf(7-page comprehensive audited report)Pre-Registration & Audit Trail:
results/PREREGISTRATION.md
Related MCP server: Sensory-Grounding MCP
๐ Verified Findings vs. Unverified Research Directions
In compliance with zero-trust empirical principles, this repository strictly separates mathematically & experimentally verified claims from ongoing, unverified research directions.
========================================================================================
GWAYA VERIFICATION LANDSCAPE
========================================================================================
[VERIFIED CLAIMS] [ACTIVE RESEARCH ROADMAP]
----------------- -------------------------
โ AST Zero-Stub Audit (rejection of ? Full Qwen Series Scaling
pass, ..., mock_*, fake_*, sorry, etc.) (0.5B, 1.5B, 3B, 7B, 14B, 32B)
โ Fail-Closed Python Sandbox ? Multi-turn Execution Trace Repair
(Bubblewrap isolation, time/memory bounds) with Rich Exception Feedback
โ Real Rustc Type & Borrow Checking ? Lean 4 Mathlib Formal Proof
(metadata emission, placeholder rejection) Search at Scale (>10k theorems)
โ Lean 4 Kernel Soundness Verification ? Exemplar Retrieval Optimization
(with #print axioms closure audit) (Resolving A4 vs A3 degradation)
โ Low-Tier Sample-and-Repair Loop ? Direct Preference Optimization (DPO)
(+7.78 pt pass@1 on Qwen2.5-Coder:1.5B) on Deterministic Fail-Closed Pairs
========================================================================================1. Retraction of Earlier Unverified Claims
The first revision of this report (version 3.1.0, Zenodo DOI 10.5281/zenodo.23121788) included claims that the low-tier optimizer improved pass rates by at least +8.0 percentage points based on a hand-written results file. That claim was retracted. Version 3.1.1 and this open-source release report only the real, measured benchmarks described below.
๐ Measured Empirical Benchmarks (MBPP-Sanitized)
All benchmarks evaluate qwen2.5-coder:1.5b on the MBPP-sanitized test split.
Setup: Public test is
test_list[0]; hidden tests aretest_list[1:].Outcome criterion: A problem is solved only if the final candidate passes all asserts inside an isolated Linux Bubblewrap (
bwrap) sandbox. The optimizer's internal flags are never taken as proof.Arms:
A0: Raw first sample (zero-shot baseline).
A2: Best-of-3 candidate sampling scored against the public test.
A3: Best-of-3 plus up to 3 iterative self-repair rounds on public test failures.
A4: A3 plus one retrieved exemplar from MBPP train/validation splits (leakage-guarded).
Pre-registered Gate: $A3 - A0 \ge +8.0$ percentage points.
Benchmark Results Table
Evaluation Run | Arm | Configuration | pass@1 (%) | $\Delta$ vs A0 | 95% Bootstrap CI | Gained / Lost | Exact McNemar $p$ | Pre-registered Gate |
Primary Run($n=60$, Local CPU,Ollama 0.1.44) | A0A2A3A4 | Raw baselineBest-of-3Best-of-3 + 3 repairsA3 + Exemplar retrieval | 68.3%71.7%75.0%75.0% | โ+3.33+6.67+6.67 | โ[0.0, +8.3][+1.7, +13.3][-1.7, +15.0] | โ2 / 04 / 06 / 2 | โ0.500.1250.289 | FAIL(+6.67 vs +8.0) |
Full Replication($n=257$, Spot L4 GPU,Ollama 0.5.7) | A0A2A3A4 | Raw baselineBest-of-3Best-of-3 + 3 repairsA3 + Exemplar retrieval | 64.2%69.3%72.0%71.2% | โ+5.06+7.78+7.00 | โ[+2.7, +7.8][+4.7, +11.3][+3.1, +10.9] | โ13 / 020 / 023 / 5 | โ0.0002< 0.0010.0009 | FAIL(+7.78 vs +8.0) |
Key Benchmark Takeaways
Statistically Clear Gain on Full Scale ($n=257$): In the full replication, A3 gained 20 problems and lost 0 compared to raw baseline A0 (exact McNemar $p < 0.001$), demonstrating that test-driven self-repair reliably recovers broken solutions.
Honest Gate Reporting: The pre-registered gate required $\Delta \ge +8.0$ points. The measured gain was +7.78 points (0.22 points below threshold). In strict accordance with the measured-improvement contract, the gate verdict is reported as FAIL without adjusting the threshold post-hoc.
Exemplar Retrieval Underperformed A3: Arm A4 (adding in-context retrieved exemplars) yielded +7.00 points but lost 5 previously-solved problems. Indiscriminate exemplar injection can bias small models away from straightforward solutions.
๐ ๏ธ Architecture: The GWAYA Fail-Closed Gate
For any candidate $c$ in language $\ell \in {\text{python}, \text{rust}, \text{lean4}}$, the gate accepts if and only if:
$$\mathrm{accept}(c) = \mathrm{Avail}\ell \wedge \mathrm{StubAudit}\ell(c) \wedge \mathrm{Oracle}\ell(c) \wedge \bigl(\ell \neq \text{lean} \vee \mathrm{Ax}(c) \subseteq A{\text{std}}\bigr)$$
where:
$\mathrm{Avail}_\ell$ (Toolchain Availability): Confirms compiler binaries are present on the host. Missing compilers immediately yield
UNVERIFIED(never pass).$\mathrm{StubAudit}_\ell(c)$ (AST Zero-Stub Law): Analyzes the AST to reject
pass,...,mock_*,fake_*,dummy_*,sorry,admit,unimplemented!().$\mathrm{Oracle}_\ell(c)$ (Compiler/Execution Oracles):
Python: Syntactic non-triviality check + isolated Linux Bubblewrap execution with memory bounds, temporary directory sandbox, and strict timeout.
Rust: Verifies syntax, types, borrow checker, and lifetime rules via
rustc --emit=metadata.Lean 4: Kernel check ensuring no non-standard axioms were introduced.
$\mathrm{Ax}(c) \subseteq A_{\text{std}}$ (Axiom Soundness): The Lean 4 oracle executes
#print axiomson every named declaration. It strictly limits dependencies to standard Lean axioms: $A_{\text{std}} = {\texttt{propext}, \texttt{Classical.choice}, \texttt{Quot.sound}}$. Bypasses such asaxiom bad : FalseorsorryAxare caught and rejected even ifleanexits 0.
๐ค Model Context Protocol (MCP) Server for AI Agents
GWAYA includes a production-ready Model Context Protocol (FastMCP) server, enabling autonomous AI coding agents (Claude Code, Antigravity, Cursor, Windsurf, OpenHands) to inspect, verify, and repair code before executing or presenting it.
MCP Tools Provided
Tool Name | Parameters | Purpose |
| None | Discovers availability of Python, |
|
| AST audit catching placeholder stubs, mock identifiers, and proof holes. |
|
| Full fail-closed verification (Bubblewrap test sandbox, rustc, Lean 4 kernel). |
|
| Invokes the Qwen sample-and-repair loop with real test feedback. |
Connecting to Claude Code (.mcp.json)
Add the following to your project's .mcp.json or claude.json:
{
"mcpServers": {
"gwaya": {
"command": "python",
"args": ["/path/to/GWAYA-GwenLayaOpenModel/mcp_server.py"],
"env": {
"PYTHONPATH": "/path/to/GWAYA-GwenLayaOpenModel"
}
}
}
}Connecting to Antigravity CLI / IDE
Add to your .antigravity/mcp_servers.json:
{
"gwaya-verification": {
"command": "python",
"args": ["-m", "mcp_server"],
"cwd": "/path/to/GWAYA-GwenLayaOpenModel"
}
}โก Deployment: Consumer RTX GPUs & Ollama
GWAYA is optimized to run locally on consumer NVIDIA GeForce RTX graphics cards using Ollama.
1. Hardware VRAM Sizing Guide
Qwen (Gwen) Model | Parameters | Required VRAM | Recommended Consumer GPUs |
| 0.5 Billion | ~0.5 GB | Any Laptop GPU, Intel/Apple iGPU |
| 1.5 Billion | ~1.5 GB | GTX 1660, RTX 3050, RTX 2060 |
| 3.0 Billion | ~2.5 GB | RTX 3060 Laptop, RTX 4050 |
| 7.0 Billion | ~5.0 GB | RTX 3060 (12GB), RTX 4060, RTX 3070 |
| 14.0 Billion | ~9.5 GB | RTX 3060 (12GB), RTX 4070 (12GB), RTX 3080 |
| 32.0 Billion | ~20.0 GB | RTX 3090 (24GB), RTX 4090 (24GB), RTX 5090 |
2. One-Click Setup Script
We provide an automated setup script that detects your RTX card, checks VRAM, pulls the optimal model, and validates 100% GPU layer offloading:
# Clone the repository
git clone https://github.com/xaviercallens/GWAYA-GwenLayaOpenModel.git
cd GWAYA-GwenLayaOpenModel
# Auto-detect GPU and pull optimal model:
./scripts/deploy_rtx_ollama.sh
# Or pull a specific model:
./scripts/deploy_rtx_ollama.sh 7b3. Running the FastMCP Server
uv pip install -e .
fastmcp run mcp_server.py4. Running the MBPP Benchmark Locally
# Run 10 problems on your local RTX GPU
python scripts/run_benchmark.py --n 10 --model qwen2.5-coder:1.5b
# Run full MBPP replication (n=257)
python scripts/run_benchmark.py --n 257 --model qwen2.5-coder:7b --out-dir results/my_rtx4090_runโก Local Agent Deployment: gwaya-agent CLI & Docker Compose
For developer workstations with NVIDIA RTX GPUs (RTX 3060, 3080, 4060, 4080, 4090) or CPU fallback:
1. Zero-Config GPU Doctor & CLI
# Check GPU VRAM, detect installed models, and get automated model recommendations:
gwaya-agent doctor
# Run fail-closed verified generation:
gwaya-agent ask "def is_prime(n): check if n is prime" --test "assert is_prime(7) and not is_prime(8)"2. Full Local Stack with Docker Compose
Run both the Ollama GPU backend and GWAYA verification agent with a single command:
# Launch Ollama with GPU pass-through + GWAYA agent:
docker compose up -d
# Verify agent status
docker compose run gwaya-agent doctor3. Anti-Hallucination Grounding & Consensus Self-Testing
Small models frequently suffer from:
Symbol hallucinations: Inventing functions (
numpyx.fast_solve), non-existent stdlib attributes, or unbound variables.Over-fitting to a single public test: Emitting hardcoded checks that fail hidden edge cases.
GWAYA resolves this through:
gwaya.grounding: Static AST and pyflakes inspection rejects candidates referencing unresolvable imports or unbound local names before execution.gwaya.consensus_agent: Generates candidate unit tests from multiple independent generations and computes consensus ($k \ge 2$) assert agreement, rejecting candidates that fail consensus tests even if they pass the public prompt test.Full-Context Trace Feedback: Replaces naive error truncations with sandbox-evaluated LHS/RHS runtime values for targeted self-repair.
โ๏ธ Cloud Spot Deployment (Google Cloud / RunPod)
For larger models or massive multi-benchmark runs, we provide a self-deleting Google Cloud spot VM launcher with strict cost caps:
# Launches spot L4 GPU (g2-standard-8, ~$0.45/h), syncs results to bucket, and force-deletes on exit:
./deploy/run_on_gcp.sh --tag gcp_l4_n257 --n 257 --cap-usd 5.0๐งช Open Call for Community Contributions (Humans & AI Agents)
We actively welcome contributions from human researchers, software engineers, and autonomous AI agents!
Top Priority Research Tracks:
Qwen (Gwen) Model Series Scaling:
Run
scripts/run_benchmark.pyon0.5b,3b,7b,14b, and32bmodels and submit rawrows.jsonlandresults.jsonpull requests.
Multi-Turn Exception Trace Self-Repair:
Enhance
low_tier_engine.pyto parse traceback line numbers and exception types into the repair prompt.
Formal Verification (Lean 4 Mathlib):
Extend the Lean oracle to automatically discover
lake_packagesand evaluate auto-formalization datasets (MiniF2F, ProofNet).
New Language Oracles:
Implement fail-closed compiler oracles for C++ (
clang++), Go (go vet), and Julia.
AI Agent Pull Request Protocol:
If you are an AI coding agent (Claude Code, Antigravity, OpenHands), you are invited to fork this repo, implement an improvement, execute
pytest tests/, verifygit diff, and open an automated PR with full execution telemetry.
๐ Citation
If you use GWAYA in your research or applications, please cite the permanent Zenodo record:
@software{callens_2026_gwaya,
author = {Callens, Xavier},
title = {GWAYA v3.1.1: Fail-Closed Gate \& Real Toolchain Verification for LLM Code Generation},
month = oct,
year = 2026,
publisher = {Zenodo},
version = {3.1.1},
doi = {10.5281/zenodo.23123923},
url = {https://doi.org/10.5281/zenodo.23123923}
}๐ License
This project is licensed under the MIT License.
This server cannot be deployed
Maintenance
Related MCP Connectors
Fail-closed, change-aware verification for AI coding agents with affected-test guidance.
Architecture compiler for AI code. 11 tools, 92 actions, 872 Lean4 proofs, 100/100 self-cert.
Deterministic AI code review, with an audit record. Governance inside the agent loop.
Lints + auto-fixes how AI coding agents discover any new product. 24 rules, 6 tools, score 0-100.
Related MCP Servers
- FlicenseAqualityDmaintenanceEnables LLMs to automatically diagnose coding errors through codebase search, test execution, and live debugger integration (DAP/V8 CDP). Provides a secure, policy-gated environment for investigating failures while preventing destructive operations.9-
- AlicenseNot gradedqualityCmaintenanceGives AI coding agents a closed-loop verification cycle for visual, audio, and video output, with enforcement hooks that make verification mandatory.Apache 2.0
- AlicenseAqualityBmaintenanceEnables AI coding agents to run fast, sandboxed pre-flight validationโtests, type-checking, linting, security audits, Git safety scans, and fix suggestionsโbefore committing or pushing code, with instant caching and optional Docker isolation.107 npmMIT
- FlicenseBqualityBmaintenanceEnables AI coding assistants to run a machine-verified DESIGNโPLANโEXECUTEโVERIFYโCOMPLETE workflow with human approval gates, state integrity checks, and DAG task scheduling.7-