Skip to main content

Language-rule decision mind: zero-training, ~0.4s real decisions for games and control. One install, one import.

Project description

Meadow Mind

Zero training. Second-level reactions (~400 ms). A language-rule decision mind: write the policy as one sentence, describe the state as one sentence, and a local 7B model makes a real decision every ~0.4 s. No RL, no reward engineering, no gradients, no samples.

🌐 Demo site: meadow-mind.pages.dev (中文) · English · 繁體中文 README

pip install meadow-mind          # weights auto-download on first use
from meadow_mind import MeadowMind, tasks

mind = MeadowMind()                    # loads once, runs on-device
task = tasks.mountaincar()
mind.check(task)                       # sanity gate: decision-table exam
action, info = mind.decide(task, obs)  # obs in, env action out (~0.4s)

Results

All on official Gymnasium environments, untouched physics, zero training. Every frame below corresponds to one real model decision; no scripted policy, no edited speed-ups.

Balance · CartPole-v1
400/400 perfect (solve bar 195)
Landing · LunarLander-v3
+251 safe landing (solve bar 200)
CartPole LunarLander
Maze · FrozenLake 8×8
goal in 14 steps = shortest path
Momentum · MountainCar-v0
flag in 103 steps (limit 200)
Maze MountainCar

The MountainCar policy is one counterintuitive sentence — "push in the same direction the car is moving, to pump energy like a swing" — which replaces an entire RL reward curve.

Real-time reflex (wall-clock, not turn-based)

The model runs in a thread while obstacles fall in real time. If it is still thinking when the obstacle lands, it really crashes.

Parkour dodge: full-generation crashes at #1, Meadow Mind clears 5/6 Shape+color match: 6/6, down to a 0.72 s window
Parkour Shape+color

Working memory

A funnel maze forces both runs into the same dead-end pocket. Reactive (left) paces at its mouth forever; with Task(memory=True) (right) it struggles, backs out, and detours to the goal in 22 steps. The only difference is five words in the perception sentence.

Memory

Decision latency: traditional LLM vs Meadow Mind

A traditional LLM agent must generate its full answer before acting — and latency grows with answer length. Meadow Mind reads the rule and the situation and decides in one fixed-latency pass, right at human reaction speed (0.3–0.4 s):

Latency

Traditional LLM agent                    Meadow Mind
─────────────────────                    ───────────
state → long prompt                      state → one sentence   (Perceiver)
      → generate the answer                    → one sentence rule (Policy)
        token by token (1.2–3.9 s,             → ONE decision pass, fixed ~0.4 s
        grows with length)                     → action letter      (Actuator)
      → parse free text → act            exam-gated before deployment

Why a diffusion LLM underneath

Meadow Mind is built on a diffusion language model (MeadowCoder-7B), not an autoregressive one. The differences that matter:

AR-LLM Diffusion LLM (Meadow dLLM)
Generation left to right, one token at a time; words are final once written drafts the whole answer at once, then refines it over multiple steps
Mid-course correction cannot edit what is already written; fixing means regenerating everything refines while working — any region can be re-opened and corrected in place
Task awareness sees only the next word global: senses the entire task and answer shape at once
Pre-answer self-sense none Σ: before answering, Meadow dLLM senses whether it understands the task; low Σ coherence becomes an escalation signal instead of a wrong answer
Decision latency grows with answer length fixed, independent of answer length
Long free-form prose mature, strong ecosystem weaker; smaller ecosystem (honest trade-off)

Two of these are what make Meadow Mind possible: multi-step self-correction (it can fix its own draft while working) and global task perception with Σ (it knows what it is being asked — and whether it understands — before committing to an answer).

How it works

┌────────────────────────────────────────────────────┐
│ ① Perceiver   your code: numbers -> one sentence   │
│               "The pole tilts right, fast spin."   │
├────────────────────────────────────────────────────┤
│ ② Rule        one sentence = the policy            │
│               edit behavior by editing words       │
├────────────────────────────────────────────────────┤
│ ③ Mind        7B on-device model reads rule+state, │
│               answers an action letter in a single │
│               decision pass, fixed ~0.4 s          │
├────────────────────────────────────────────────────┤
│ ④ Actuator    letter -> env action                 │
└────────────────────────────────────────────────────┘

There is no reward in the loop. The env score is only a report card; improvement happens by outcome feedback: the episode trace shows which sentence was wrong, and you edit it. (LunarLander went from a +27.5 crash to a +251 landing by adding one touchdown-cushion line to the perceiver. Ten seconds.)

Wire up a new game (5 steps)

  1. Understand the task, explore input-output. Variables, actions, win/lose conditions; the reaction deadline must be looser than ~0.4 s. List every action and watch its effect.
  2. Build perception words. One sentence describing the current situation. Bucket continuous values (small/big, fast/slow); always include a velocity/trend term.
  3. Imprint the rule. Invert the effects into "on situation X do action B". Keyword → letter, one-layer mapping, multiple choice only.
  4. Decide on memory. Ask: "is revisiting the same state a failure signal?" Yes (maze, exploration, dead ends) → Task(memory=True). No (balance, landing, tracking — repetition IS the job) → keep it off; annotations measurably hurt regulation tasks (CartPole sanity 7/8 → 6/8). Unsure → leave off; the runner prints a hint when it detects looping.
  5. Take the exam. Enumerate every situation with its expected letter; mind.check(task) passes with at most 1 miss. Failures mean the wording is incomplete — rephrase and re-check, no training.

Or skip all five: hand meadow_mind.ai_prompt() plus your game description to any code agent, and it wires the task for you. You only review the exam score.

API

MeadowMind(model_path=None)

Weight resolution: MEADOW_MIND_MODEL env → explicit path → local cache (~/.meadow-mind/models/) → auto-download.

Method
mind.decide(task, obs) -> (action, info) one real decision; info = {status, letter, lat}
mind.check(task) -> (ok, n) sanity gate; raises if the decision table fails

Task(...)

Field
perceive(obs) -> str (or perceive(obs, task) with memory) perception layer
rule / option_text / options / act_text the one-sentence policy and its multiple-choice actions
sanity the exam: [(status sentence, expected letter)]
memory / mem_key working-memory switch (default off) + state key fn
env_id / env_kwargs / max_steps / judge environment wiring and report card

With memory=True the runner auto-tracks task.visited; use task.seen(key) inside perceive to annotate, e.g. (safe, already visited).

CLI

meadow-mind cartpole        # sanity gate -> play one episode -> video + verdict

Honest limits

  • Reaction floor is one decision pass (~0.4 s ≈ 2 Hz). Tighter deadlines (1 m pole, Pong trajectory prediction) are out of reach today.
  • Suited to tasks whose situations can be said in a sentence and whose policy fits a rule. Continuous high-precision control is not.
  • The perceiver is human-designed (or AI-generated via ai_prompt()); the model's job is reading the rule and deciding.

Roadmap

  • v0.2 — layered perception with early action: accumulate confidence through the network and act when it crosses a threshold; easy situations should land near ~0.15 s.
  • Rule-learning loop: discover rules like MountainCar's swing trick from failed episodes automatically (no gradients — the learned artifact is a readable sentence).

License

MIT © Hey-Meadow Lab

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

meadow_mind-0.1.1.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

meadow_mind-0.1.1-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file meadow_mind-0.1.1.tar.gz.

File metadata

  • Download URL: meadow_mind-0.1.1.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for meadow_mind-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6159eec17b14aaa25c4bfe32a866bfee4ee248d614b3df155259b7f0e428a5e6
MD5 57ef1d4afa726f9c8348d96b9355a2e3
BLAKE2b-256 adef698683078b860ff12aff7510e5865e9475559108f80c6e90e9f34d556c3f

See more details on using hashes here.

File details

Details for the file meadow_mind-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: meadow_mind-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for meadow_mind-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7bc603336c7eac38181cd3e3628466be95d033f18f87fd12ad540918c13c1f3f
MD5 88ac5b45539c75747c53102fe913e1ad
BLAKE2b-256 e70b803df89b58a7e727365055b9ed9244719c86e897c42b7f9eb830c51fdb43

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page