GodelZero is a research reinforcement learning framework designed to enable open-ended, non-episodic self-improvement in Large Language Models (LLMs). Conceptually analogous to AlphaZero, Godel abandons standard episodic optimization in favor of a persistent, multi-tree Monte Carlo Tree Search (MCTS) operating over a lineage of reasoning policies and cognitive scaffolds.
The system is rigorously factored into a client-server paradigm, separating the multi-objective verification logic from the generative agent policy.
The environment operates as a persistent evaluation engine that maintains a registry of all reasoning strategies historically generated.
- Action Space: The primary action primitive is the
StrategyPatch—a structured, grammar-constrained JSON mutation of the agent's current prompt reasoning logic. - Ground Truth Evaluation: Patches are rigorously tested across a held-out evaluation task bundle. The environment's "Governor" module performs multi-axis scoring (correctness, generalization, cost-efficiency, stability) and returns a
PatchDecision. - Clade-Metaproductivity (CMP): Successful evaluations adjust the long-term utility score of the strategy's lineage, producing a delayed reward signal known as Clade-Metaproductivity (analogous to AlphaGo's Elo mechanism).
The agent package (godel) manages an asynchronous fleet of workers performing parallel search and gradient optimization.
- MCTS Lookahead: The self-play loop leverages multi-tree PUCT to explore counterfactual branches. The agent interacts with the environment securely via
evaluate_only=Trueto sandbox and observe the Governor's verdicts without mutating global tournament state. - Grounded Offline Predictor: Because executing actual evaluations is highly compute-intensive, Godel utilizes an in-memory MLP (
GovernorPredictor) as a "world model" to rapidly screen speculative MCTS candidates prior to executing environment steps. - Shared Dual-Head Implementation: The core LLM policy is backed by a custom
DualHeadLLMarchitecture. It applies standard GRPO-style cross-entropy against the MCTS visit distribution on the LM head, while a dedicatedValueHeadsimultaneously regresses against the retrospective CMP generated dynamically by the Prioritized Replay Buffer.
- Grammar-Constrained Decoding: Arbitrary or hallucinatory model outputs degrade the self-improvement loop. The generator enforces strict adherence to the
StrategyPatchschema leveragingoutlines. If structural generation fails, the system safely raises a strict termination error rather than polluting the MCTS tree with raw text. - Schema Boundaries: The project strictly compartmentalizes domain models. Canonical objects (
GodelObservation,PatchDecision,StrategyPatch) are owned uniformly by the environmentgodel_engine. The RL client interprets flattened, agent-specific projections (RewardVector,GodelState) strictly initialized via theenv_clientmiddleware.
1. Starting the Environment Server The persistent GodelEnv instance must be launched first. It maintains the registry and handles WebSocket requests from the RL workers.
python -m GodelEnv.server2. Kickstarting the RL Pipeline
Once the environment is accessible via localhost:7860, spin up the client asynchronous training loop:
python -m godel.trainNote: Achieving positive Clade-Metaproductivity and actual recursive improvement demands an underlying base model with significant reasoning capabilities (e.g., Llama-3-8B minimum). Attempting to run this scaffolding on highly compressed parameter ranges (under 1B) will lead to a 0% baseline Governor acceptance rate and RL loop starvation.