Skip to content

About

Autonomous ML research agent with structured Bayesian experiment selection, persistent memory, and active-inference-inspired exploration

Resources

Stars

4 stars

Watchers

0 watching

Forks

Repository files navigation

autoresearcher2

A structured Bayesian research agent with learntropy-inspired appraisal. Active-inference-rooted, but approximate in production. Designed to accumulate transferable research intuition.

The Evolution of AI Research - from autoresearch to active inference researcher

Why this matters

There are at least two ways to make an autonomous research system more powerful:

  1. make it better
  2. make it more dangerous in ways that are initially hard to notice

We're aiming for (1).

The point of autoresearcher2 is not merely to search harder, optimize faster, or become more autonomous.

The deeper goal is to explore whether an autonomous research system can become more capable without becoming less truthful, less corrigible, less caring, or less worthy of trust.

That is why this repository includes two foundational documents:

  • CONSTITUTION.md, which defines what must remain true as capability grows
  • CHARTER.md, which defines how research, judgment, and self-improvement should proceed

The Constitution defines what must remain true. The Charter defines how truth-seeking should proceed under those values.

In other words, if this system is going to recursively improve, it should also recursively improve its judgment, not just its ability to get results.

Together they express a simple idea: recursive self-improvement should not only increase power, but deepen judgment, responsibility, and care.

Current Status

AutoResearcher2 Dashboard — v4.8

v4.8 is running in production on 2× NVIDIA RTX PRO 6000 Blackwell GPUs (96GB VRAM each), autonomously running research across multiple domains simultaneously:

  • NanoGPT — optimizing a GPT training pipeline against val_bpb on ClimbMix. 61 experiments completed, best val_bpb: 1.0399, total cost: 0.30EUR in electricity.
  • Atari Breakout — training RL agents via code_change proposals where the LLM rewrites the training script (not just hyperparameter tuning).

The system maintains per-project world models (beliefs + tensions), generates rationale-first proposals through a generator-critic pipeline, and tracks real energy costs via GPU power monitoring. Both projects run concurrently on separate GPUs with a dispatch executor routing proposals to domain-specific executors.

Research Domains

Domain Target metric Optimize Status
NanoGPT training val_bpb minimize Running — 35 beliefs, 11 tensions
Atari Breakout RL mean_reward maximize Running — code_change proposals rewriting training scripts
Synthetic validation controlled POMDP minimize Complete — v1 exit criteria pass

The Problem

autoresearch is an effective agentic system: an LLM proposes code edits to train.py, trains for 5 minutes, measures val_bpb, keeps improvements, reverts failures, and repeats indefinitely. The LLM brings world knowledge, reads previous results, and can reason about what to try next. This is substantially stronger than random or grid search.

But it has no structured persistent model of why things work. It sees a flat results log, not factor effects, interaction structure, or uncertainty estimates. It can't say "positional encoding matters more than optimizer for this architecture size" — only "this edit improved val_bpb by 0.02." Knowledge lives in the LLM's context window and the results log; structural insight doesn't accumulate across sessions.

autoresearcher2 operates on the same substrate but adds structured inference. The agent maintains a generative model of the research space — factor effects, interactions, uncertainty — and notices when its model can't explain the results. The LLM proposes what the missing dimension might be. Discovery is grounded in an explicit world model rather than implicit pattern matching in a flat log, and structural insight transfers across campaigns.

Bayesian optimization (BO) is better than unstructured search but treats the space as a black box. It doesn't build structural knowledge ("RoPE is generally better than learned positional encodings for this model size") that transfers to the next campaign.

What This Does

autoresearcher2 adds four things:

  1. A generative model that infers latent structure (factor effects, regimes, proxy fidelity) rather than just predicting outcomes directly
  2. Policy evaluation via expected free energy — the agent evaluates short action sequences, not just single next steps, balancing pragmatic value and epistemic value
  3. An appraisal module that measures learntropy-like signals: how much did this result change beliefs, contradict expectations, or reorganize knowledge?
  4. Persistent memory with activation/decay dynamics that carries episodic knowledge across experiments and campaigns

Two Modes

Canonical mode (toy environment): a small POMDP where policies minimize expected free energy under an explicit generative model. Used to validate theoretical claims. Implemented.

Applied mode (GPT pipeline): a research controller operating on the same substrate as autoresearch that preserves the same design intention — balancing preference-seeking and information gain — but uses approximations where exact active inference becomes intractable. Implemented — running on real train.py with SSH-based execution on RTX PRO 6000 Blackwell. Evidence-quality comparison in progress.

The long-term ambition is not merely to borrow the language of active inference, but to progressively replace approximations with explicit generative-model components wherever tractability permits.

The Two Loops (Design Intent)

Outer loop (learntropy-driven): "What should I investigate next?"

  • Controller evaluates candidate interventions by expected free energy
  • Appraisal module scores results for epistemic salience — not just "was the outcome good?" but "did it change what I believe about the research space?"
  • Memory provides episodic context to the LLM for proposal generation

Inner loop (execution): "What happened when I tried it?"

  • Run the selected intervention (train.py knob patch + val_bpb measurement via SSH)
  • Update generative model (factor effects, interactions, precisions)
  • Appraisal module computes learntropy signals
  • Store result in memory

Architecture

┌─────────────────────────────────────────────────────────┐
│              LLM (Proposal Generator)                   │
│  Suggests candidate policies, interprets patterns,      │
│  proposes schema extensions. Does NOT do inference.      │
│  Receives appraisal scores + memory context as input.   │
└──────────────────┬──────────────────────────────────────┘
                   │ candidate policies (2-3 step sequences)
                   ▼
┌─────────────────────────────────────────────────────────┐
│      Layer A: Controller (EFE Policy Evaluation)        │
│  Evaluates policies by expected free energy:            │
│    G(π) = risk + ambiguity                              │
│  Simulates belief updates per step to score sequences   │
│  Selects policy with lowest EFE                         │
└──────────────────┬──────────────────────────────────────┘
                   │ selected policy (execute step by step)
                   ▼
┌──────────────┐   ┌──────────────────────────────────────┐
│  Environment │──→│  Layer B: Generative Model           │
│  (run expt)  │   │  Latent states:                      │
│              │   │    factor effects, interactions,      │
│  returns o   │   │    regime, proxy fidelity, precisions │
│              │   │  Observation model: latent → expected │
└──────────────┘   │  Posterior update after each obs      │
                   └──────────────┬───────────────────────┘
                                  │
                   ┌──────────────┼──────────────────────┐
                   ▼              ▼                       │
    ┌────────────────────┐  ┌──────────────────────────┐ │
    │  Appraisal Module  │  │  Layer C: Memory         │ │
    │  Computes:         │  │  Experiment history      │ │
    │  - surprise        │  │  Activation / decay      │ │
    │  - belief revision │  │  Pattern retrieval       │ │
    │  - knowledge reorg │  │  Feeds LLM with context  │ │
    │  - transfer breadth│  │                          │ │
    │  = learntropy score│  │                          │ │
    └────────────────────┘  └──────────────────────────┘ │
                                                         │
                   ┌─────────────────────────────────────┘
                   ▼
    ┌──────────────────────────────────────┐
    │  Transfer Subsystem                  │
    │  Cross-campaign prior blending       │
    │  Negative transfer guards            │
    │  Proxy fidelity is a latent variable │
    └──────────────────────────────────────┘

Layer Responsibilities

Layer Responsibility Does NOT
A: Controller Evaluates policies by EFE, selects best sequence Know about memory, LLMs, or language
B: Generative model Infers latent structure, predicts observations, updates beliefs Make decisions
Appraisal Measures epistemic salience of results (learntropy signals) Make decisions or update beliefs
C: Memory Stores episodic history, retrieves patterns, feeds LLM Do inference or define latent states
Transfer Reuses knowledge across campaigns with guards Operate without explicit proxy fidelity estimates

The Generative Model

Not a predictor that maps interventions to outcomes. A model of hidden causes that explains why outcomes happen.

Latent States

latent_states = {
    # What structure does the research space have?
    factor_effects:   N(μ_f, Σ_f),       # "how much does each factor matter?"
    interactions:     N(μ_i, Σ_i),       # "which factor pairs interact?"
    regime:           Cat(π_regime),      # "which regime am I in?"
                                          #  e.g., "attention-dominated" vs
                                          #  "optimizer-dominated"

    # How reliable are my observations?
    outcome_noise:    Gamma(α_on, β_on),  # "how noisy are experiments?"
    proxy_fidelity:   Beta(α_pf, β_pf),  # "do proxy results predict real results?"
    proxy_per_factor: {                   # "does the proxy lie about some factors?"
        "optimizer":    Beta(α, β),
        "pos_encoding": Beta(α, β),
        ...
    },
}

Observation Model

The generative model specifies how latent states produce observations:

# Given latent states, what observations do I expect?
P(outcome | intervention, latent_states) = f(
    intervention,
    factor_effects,     # main effects
    interactions,       # pairwise interactions
    regime,             # which regime is active
    outcome_noise       # how noisy
)

This is the key difference from a surrogate predictor. The model doesn't just predict — it explains. When a result is surprising, the agent can ask which latent belief was wrong: was it the factor effect, the regime, or the proxy fidelity?

Precision (First-Class)

Precision is not decorative. It determines how much prediction errors drive belief updates:

belief_update = precision × prediction_error

# High precision → prediction errors drive large updates
# Low precision → prediction errors are discounted (noisy source)

Precisions are inferred, not assumed:

  • Outcome noise precision: learned from experimental variance. Early: low (cautious updates). Later: higher (sharper learning).
  • Proxy fidelity precision: learned by comparing proxy vs. expensive runs. If they disagree, proxy precision drops.
  • Transfer precision: how stable is cross-campaign knowledge? Drops if transferred priors mislead.

Why This Matters

The design aims to let the agent attribute surprising outcomes to specific latent causes — not just "RoPE is good" but "positional encoding matters more than optimizer in this regime." Whether this is achievable depends on the expressiveness and identifiability of the latent model, which is why we validate on the toy environment first.

Policy Evaluation (Expected Free Energy)

The controller evaluates short policies (2-3 step sequences), not just single next actions.

candidate_policies = [
    # Policy 1: explore unknown factor combination
    [try(rope, lion, lr=1e-3), try(rope, lion, lr=3e-3)],

    # Policy 2: test proxy fidelity for n_layers
    [try_proxy(12_layers, rope), try_expensive(12_layers, rope)],

    # Policy 3: exploit known good region
    [try(rope, adamw, lr=3e-4), try(rope, adamw, lr=1e-3)],
]

for π in candidate_policies:
    G(π) = Σ_t [
        risk_t(π)       # D_KL[ Q(o_t|π) ‖ P(o_t) ] — distance from preferred outcomes
      + ambiguity_t(π)  # E_Q(s_t|π)[ H[P(o_t|s_t)] ] — expected observation noise
    ]
    # Crucially: beliefs at step 2 are conditioned on what we'd learn at step 1

best_policy = argmin(G)

A one-step agent can't plan "run a cheap experiment to learn about transfer, then use that to pick a better expensive experiment." A policy-planning agent can. This is active belief shaping — the agent designs experiments to improve its own model, not just to find good outcomes.

Where canonical, where approximate

Aspect Canonical (toy env) Applied (GPT pipeline)
Latent states Full discrete POMDP Factored Gaussians + categorical regime
Policy horizon Full planning horizon 2-3 steps
EFE computation Exact Simulated belief trajectories
Precision Full Bayesian Gamma priors, point estimates where needed
Proxy fidelity N/A Latent Beta variable

The seam between canonical and approximate is explicit. Where the latent space is tractable, we use faithful active inference. Where it isn't, we approximate and document the deviation.

Appraisal Module (Learntropy)

After each experiment, the appraisal module computes epistemic salience — how much this result matters for the agent's understanding, not just whether the outcome was good.

Why This Exists

Standard BO asks "was the outcome good?" and "where am I uncertain?" Learntropy (Wozniak) suggests a richer signal: learning has an intrinsic attractiveness structure. Results that arrive at the boundary of current knowledge — neither obvious nor incomprehensible — drive the most learning.

The appraisal module makes this measurable.

Signals

appraisal = {
    # How much did beliefs change?
    surprise:           KL(posterior_after ‖ posterior_before),

    # Did this contradict a strong prior belief?
    theory_conflict:    max(prior_confidence × prediction_error),

    # How many other beliefs were affected?
    knowledge_reorg:    count(beliefs_revised > threshold),

    # Could this insight transfer to other regions of the schema?
    transfer_breadth:   count(cells_whose_prediction_changed > threshold),

    # Is this in the learntropy sweet spot?
    # (not obvious, not incomprehensible)
    learntropy:         surprise × (1 - ambiguity),
    # High surprise + low ambiguity = the model was confidently wrong
    #   → maximum learning signal
    # High surprise + high ambiguity = noisy, can't tell what happened
    #   → low learning signal
    # Low surprise = expected, nothing to learn
    #   → low learning signal
}

How Appraisal Feeds the System

  • Feeds the LLM: appraisal scores are included in the context for proposal generation. The LLM sees: "Experiment 47 had high theory_conflict — the belief that optimizer matters more than pos_encoding was contradicted." This guides the LLM toward proposing follow-up experiments that resolve the conflict.
  • Feeds memory activation: high-appraisal results get a boost in memory activation. They persist longer and surface more readily. Low-appraisal results (boring, expected) decay faster.
  • Does NOT feed the controller directly: the controller operates on EFE over the generative model. Appraisal is a reporting layer, not a decision layer. It prevents the "memory quietly becomes the generative model" failure.
  • Feeds visualization: appraisal scores over time show whether the agent is in the learntropy sweet spot — learning efficiently at the boundary of its knowledge — or stuck in obvious/incomprehensible territory.

LLM Verbalization (Reporting Channel, Not Control Signal)

LLM verbal reactions may contain useful epistemic appraisal — "Interesting, that changes everything" could reflect genuine surprise at a posterior shift. But surface wording alone is too style-contaminated to trust directly. LLMs are trained for social fluency; "Interesting!" can be cheap style, not genuine epistemic rupture.

Therefore the system grounds appraisal in evidence and posterior change, then allows the LLM to express it richly in language:

{
  "surprise": 0.81,
  "theory_conflict": 0.74,
  "transfer_breadth": 0.68,
  "learntropy": 0.72,
  "utterance": "This overturns the assumption that optimizer choice matters more than positional encoding. Worth investigating whether this holds across context lengths."
}

The verbal output is a rendering of measured appraisal variables, not the variable itself. This keeps the biological and cognitive inspiration alive without collapsing into ungrounded vibes.

Intervention Schema

The schema is a fixed, engineered factorial grid. Each cell maps to a specific combination of factor levels. The generative model reasons about factor effects and interactions across cells.

v1 synthetic validation uses a small schema (3 factors × 3 levels = 27 cells) to validate the architecture:

schema = InterventionSchema(factors={
    "optimizer": ["adam", "adamw", "sgd"],
    "lr": ["1e-4", "3e-4", "1e-3"],
    "batch_size": ["32", "64", "128"],
})

Current train.py schema (implemented, running on real hardware):

schema = InterventionSchema(factors={
    "DEPTH": ["6", "8", "10"],
    "MATRIX_LR": ["0.02", "0.04", "0.08"],
    "WEIGHT_DECAY": ["0.1", "0.2", "0.4"],
})
# 27 cells, ~5 min per experiment, val_bpb ~1.0-1.1

The key idea: autoresearch edits anything in the file; autoresearcher2 maps edits to a structured factor space so it can reason about effects, interactions, and uncertainty. The first real run confirmed this works — the Bayesian model receives real val_bpb measurements and updates factor posteriors accordingly.

Memory System

The generative model infers latent structure (factor effects, regimes, precisions). Memory stores episodic knowledge that the generative model can't capture: which experiments were run, what the LLM's reasoning was, which combinations were tried and abandoned, and why.

What memory does that the generative model doesn't

Need Generative model Memory
"Is RoPE generally good?" Yes — it's a latent factor effect No
"Did I already try this exact config?" No — it has no episodic recall Yes — deduplication
"What happened last time I explored this region?" No Yes — retrieval by similarity
"What should the LLM know for its next proposal?" No — it outputs distributions, not context Yes — structured summaries
"Was I calibrated last week?" No — it only has current posterior Yes — historical tracking
"Which results were most surprising?" No Yes — via appraisal scores

How memory interacts with the other layers

  • Feeds LLM: memory provides episodic context + appraisal history for proposal generation.
  • Informs transfer: campaign-level summaries and calibration history for the transfer subsystem.
  • Receives from appraisal: high-appraisal results get activation boosts; low-appraisal results decay faster.
  • Does NOT feed Layer A or B directly: the controller and generative model operate on the structured posterior. Memory influences decisions only indirectly, through LLM proposals and transfer priors.

Dynamics (neuroscience as metaphor, not claim)

  • Activation decay (Ebbinghaus): old, unretrieved results lose accessibility. The system naturally forgets dead ends.
  • Recall boost (spaced repetition): results that keep being useful persist longer.
  • Association (Hebbian): experiments that co-occur in successful runs link together.
  • Appraisal-weighted: high-learntropy results start with higher activation and decay slower.

Transfer Across Campaigns

Transfer is a first-class subsystem. Proxy fidelity is a latent variable in the generative model, not an assumption.

# What transfers: factor effect posteriors, interaction structure, regime beliefs
# What the agent can also learn about transfer itself:
#   proxy_fidelity — "do small-run results predict large-run results?"
#   proxy_per_factor — "does the proxy lie about some factors more than others?"

# The agent can actively test transfer by running:
#   [proxy_experiment, expensive_validation]
# and updating proxy_fidelity from the comparison.

# Guards against negative transfer:
#   - Schema must be compatible
#   - Tasks must be similar (metadata check)
#   - Source must have been well-calibrated (Brier score check)
#   - Proxy fidelity must be above threshold

Evaluation

v1 Synthetic Results (proven)

v1 has been validated on 3 synthetic environments × 20 seeds × 50 experiments each. All exit criteria pass:

Metric env_a (main effects) env_b (interaction) env_c (high noise)
Beats random (regret) 6.5 vs 17.5 5.4 vs 13.4 7.6 vs 15.9
Competitive w/ greedy 6.5 vs 9.4 5.4 vs 7.2 7.6 vs 9.3
Factor rank accuracy 95% 100% 95%
Epistemic decrease 100% 100% 100%

Full results: artifacts/v1_validation/results.json. Runner: scripts/run_v1_synthetic_validation.py.

Baselines

Implemented (v1):

  • Random search — random schema cells
  • Greedy exploitation — always try predicted best

Implemented (v1.5):

  • autoresearch-style — LLM agentic loop with flat results log, no Bayesian model (the direct comparison)

Planned (not yet implemented):

  • GP-UCB — Bayesian optimization (black-box, no factor structure)
  • ASHA / Hyperband — multi-fidelity scheduling

Falsification Criteria

These apply to the train.py evidence run, not to synthetic validation:

Criterion Condition
Beats random search ≥20% better compute-normalized best-found val_bpb
Beats autoresearch-style Better val_bpb at same experiment count, or same val_bpb with fewer experiments
Structural knowledge Agent correctly identifies top-2 factor effects
Stable across seeds Crossover point variance <30% across 5 random seeds

The evidence run (4 approaches × 20 experiments, same hardware/budget) is in progress. Until it completes, no claims about comparative performance are justified.

Toy Validation Environment

A 27-cell synthetic POMDP (3 factors × 3 levels) with canonical active inference (expected free energy, policy-conditioned beliefs, explicit precision).

This exists only to validate the theory — it is not the GPT pipeline, not a component of the practical system, and not a surrogate predictor. It is a theoretical sandbox where we verify that canonical active inference produces the expected epistemic → pragmatic shift, proper calibration, and baseline-beating convergence. If these properties don't emerge in the toy environment, the applied system inherits no credibility from "active inference."

Theoretical Roots and Deliberate Departures

This project draws on three theoretical traditions. It takes them seriously — not as decoration, but as design constraints. Where the current system departs from canonical formulations, the departure is deliberate and documented.

Active Inference (Karl Friston)

Contribution: The core idea that experiment selection should unify epistemic value (uncertainty reduction) and pragmatic value (preference-seeking) under a single objective — expected free energy. An agent with a generative model of hidden causes can evaluate policies by asking: "will this action sequence move me toward preferred outcomes and teach me something about the world?"

Current status: The applied system uses the same generative-model structure — latent states, observation model, prior preferences, policy-conditioned belief updates — with approximations where exact inference is intractable. The toy validation environment uses canonical active inference without approximation.

Deliberate departure: The applied system's EFE-based policy evaluation over short horizons is an approximation of full active inference, not a repudiation of it. The long-term goal is to progressively replace heuristics with explicit generative-model components wherever tractability permits. The seam between canonical and approximate is part of the contribution, not an embarrassment.

Learntropy (Piotr Wozniak)

Contribution: The idea that some learning opportunities are intrinsically attractive — not because they are novel per se, but because they are surprising, decodable, structurally meaningful, and growth-inducing. (Pleasure of learning)

Why learntropy is not the same as novelty: Random novelty is not enough. A completely unfamiliar, chaotic signal is novel but has zero learntropy — the system can't decode it, can't connect it to existing knowledge, can't use it to grow. Learntropy requires a zone where the signal is surprising but decodable and structurally useful. This is why the appraisal module needs both positive terms (surprise, transfer breadth) and negative terms (ambiguity, noise). The sweet spot is: confidently wrong → maximum learning. Hopelessly confused → no learning. Already knew that → no learning.

Current status: The appraisal module operationalizes learntropy by measuring posterior change magnitude, theory conflict, knowledge reorganization, and transfer breadth. The system does not yet directly optimize learntropy as an objective — it uses it as a reporting and memory-weighting signal. Moving learntropy into the EFE computation itself is an open research direction.

Compression Progress (Juergen Schmidhuber)

Contribution: Intrinsic reward = the first derivative of model improvement. The agent should focus where its model is improving fastest, not where uncertainty is highest per se. The appraisal module's learntropy = surprise × (1 - ambiguity) captures this: maximum signal when the model was confidently wrong, not when observations are just noisy.

What the practical system is today

The practical controller is an approximation designed for tractability, not a repudiation of the theory:

  • Active inference contributes the generative-model structure and the EFE decomposition
  • Learntropy contributes the appraisal module and the insight that epistemic value has internal structure (not all uncertainty reduction is equally valuable)
  • The current system is not yet canonical active inference and does not yet directly optimize learntropy
  • The toy validation environment is the canonical reference; the GPT pipeline system is the working approximation
  • The gap between them is where the research contribution lives
  • The first proving ground — same substrate as autoresearch — is intentionally chosen to make the comparison concrete

Key Papers

What This Is and Isn't

This is a serious attempt to bring active inference and learntropy closer to an applied self-improving researcher.

The core bet: an agent that maintains a structured model of factor effects, uncertainty, and epistemic value — and uses learntropy-inspired appraisal to weight what's worth learning from — will outperform a flat agentic edit loop on the same GPT training pipeline. This bet is now being tested — an evidence-quality comparison run is in progress on the same substrate as autoresearch.

What works today: the full loop runs end-to-end on real hardware. Pilot runs on RTX PRO 6000 Blackwell confirmed: controller → train.py → val_bpb → Bayesian model update → appraisal → memory → LLM context. On synthetic environments with known ground truth, the Bayesian model learns factor structure, the controller outperforms random and greedy baselines, and the appraisal module marks belief-changing events.

What's being measured now: an evidence-quality comparison (random vs Bayesian-only vs flat LLM vs Bayesian+LLM, 20 experiments each, same hardware/budget, full instrumentation). Until this completes and is analyzed, no claims about comparative real-substrate performance are justified.

It is NOT:

  • Pure active inference (yet)
  • Just BO with memory
  • Claiming generality across domains — the first proving ground is deliberately narrow
  • Going to discover fundamentally new architectures within a fixed schema
  • Claiming biological fidelity (neuroscience terms are metaphors, not claims)
  • Claiming comparative real-substrate results until the evidence run completes and is analyzed

Implementation Status

v1 — Synthetic Validation (complete)

v1 validates the core architecture on synthetic environments. It proves the plumbing works.

v1 includes:

  • Bayesian linear model with conjugate updates over one-hot factor features
  • Thompson-sampling controller with EFE-style diagnostics
  • Learntropy-inspired appraisal (surprise, theory_conflict, prediction_impact_breadth, learntropy)
  • Simple episodic memory with appraisal-weighted retrieval
  • Baseline evaluation harness: random, greedy
  • Toy validation environment (27-cell canonical active inference)
  • 3 synthetic environments with known ground truth, validated across 20 seeds
  • All exit criteria passing

v1 does NOT include:

  • GP-UCB / ASHA baselines
  • Transfer across campaigns
  • Multi-step policy planning
  • Memory dynamics (activation decay, Hebbian linking)

v1.5 — Real Substrate + LLM Integration (in progress)

Building on v1, this phase connects the Bayesian engine to real GPU training.

v1.5 includes:

  • TrainPyEnvironment: SSH-based runner that patches train.py knobs, runs real training, parses val_bpb
  • LLM proposal module: claude -p generates experiment suggestions based on history + factor importances
  • Two-step policy lookahead: simulates belief updates to value information gain
  • Memory-grounded LLM context: high-signal experiments (by learntropy) + coverage gaps fed to LLM prompt
  • Autoresearch-style baseline agent (flat LLM, no Bayesian model) for fair comparison
  • 95 tests passing
  • Full instrumentation: val_bpb, tokens_M, num_steps, mfu, wall_time, decision source tracking

Pilot runs (debugging, not evidence)

Three pilot loops ran on RTX PRO 6000 Blackwell (~4.5h total GPU time). These proved the system works end-to-end: train.py executes, val_bpb feeds back, the Bayesian model updates, LLM suggestions enter the selection loop, and actual improvements are found.

What the pilot proved:

  • The full loop runs: controller → train.py → val_bpb → model update → appraisal → memory → LLM context
  • LLM suggestions are part of the selection and produce real experiments
  • The system finds actual config improvements (DEPTH=8 sweet spot)

What the pilot did NOT prove:

  • Fair performance comparison (duplicate-selection bug inflated some runs)
  • LLM value-add vs baseline (no clean ablation, no autoresearch-style control)
  • Learntropy/appraisal effect on selection quality (no ablation)
  • Token-normalized comparison (throughput metadata was not captured)

Known issues fixed after the pilot:

  • Duplicate experiment selection with 1 GPU (both cells picked from same model state before either ran)
  • Missing throughput instrumentation (tokens_M, tok/sec, mfu, num_steps now captured)
  • No unique trial/decision IDs in results

Pilot artifacts preserved in artifacts/pilot/ for reference. These are debugging runs, not evidence runs.

Current: Evidence-Quality Run (in progress)

The evidence run uses the 3-factor schema (DEPTH × MATRIX_LR × WEIGHT_DECAY, 27 cells) with:

  • Full instrumentation per experiment: val_bpb, tokens_M, tok/sec, mfu, num_steps, wall_time_s, decision_id, trial_id, source
  • Truthful decision-source labeling (LLM fallbacks are explicitly marked, not silently attributed)
  • Four approaches on same hardware/budget (20 experiments each):
    1. Random baseline
    2. Pure Bayesian (Thompson sampling + lookahead, no LLM)
    3. Autoresearch-style baseline (flat LLM, no Bayesian model)
    4. autoresearcher2 full (Bayesian + LLM with appraisal context)

v1.5 does NOT yet include:

  • Completed evidence-quality comparison results and analysis
  • Ablation: +/- appraisal signals, +/- coverage gaps
  • GP-UCB / ASHA baselines
  • Transfer across campaigns

Implementation Phases (Full Roadmap)

  1. Toy canonical validation — 27-cell synthetic POMDP with canonical active inference. Verify: calibration, epistemic→pragmatic shift, baselines. Theoretical sandbox only.
  2. Synthetic plumbing validation — Controlled factorial environment with known ground-truth effects. Verify that controller, model, appraisal, and memory integrate correctly. No real training runs.
  3. GPT pipeline integration — Connect to the same substrate as autoresearch: train.py edits → val_bpb measurement → structured model update. Schema maps to real train.py levers.
  4. Head-to-head comparison — Run autoresearcher2 and autoresearch-style baseline on the same GPT pipeline, same compute budget. Measure val_bpb convergence, experiment efficiency, structural knowledge quality.
  5. Appraisal + memory — Learntropy signals feed memory weighting and LLM proposal context. Ablation studies: +/- appraisal, +/- memory.
  6. Stronger baselines — Add GP-UCB, ASHA/Hyperband for rigorous comparison beyond autoresearch-style.
  7. Transfer + proxy fidelity — Cross-campaign transfer with guards. Test whether structural knowledge from one train.py campaign improves the next.
  8. Visualization + evaluation — Dashboard, calibration plots, regret curves, appraisal trajectories, full report.
  9. Scale validation — Test whether knowledge from 5-minute proxy experiments transfers to longer, more expensive training runs.

License

MIT

About

Autonomous ML research agent with structured Bayesian experiment selection, persistent memory, and active-inference-inspired exploration

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages