DEV Community

Val Huang
Val Huang

Posted on

WLBS + MoE: Finally, an AI that learns where the bug really lives

You’ve seen this happen.

An AI coding agent tries to fix an ImportError in rbac.py. It edits the file three times, five times, ten times. Nothing works.

The real bug is in roles.py—the file that rbac.py imports. The error shows downstream, but the cause lives upstream.

The AI keeps banging on the wrong file because its memory is temporal, not spatial. It remembers “I failed here” but not “this file depends on that one.”

We built a system that fixes this gap—and it works.

The core idea: keep information in its original shape
Most AI agents today store experience as text: rules extracted from logs, reflections written in natural language. Every translation discards structure. The call graph, the dependency chain, the propagation path—all flattened into words.

WLBS (World-Line Behavior Space) does the opposite.

  • Every function, module, or service node keeps a world-line—an append‑only log of every event that ever touched it. Task ID, action, result, reasoning, whether that reasoning was correct—all stored on the node itself.
  • When a test fails, a curvature increment propagates backward along the call graph. Nodes closer to the root cause get larger increments; after repeated failures, the upstream root cause accumulates the highest curvature.
  • A singularity flag appears on that node—no natural language, no parsing, just a typed attribute the decision layer reads directly.
  • Resolution decay (inspired by the biological fovea) feeds the LLM only what it needs: full history for nearby nodes, key events for the neighbourhood, just identifiers and curvature for distant parts. Context stays small—about 375 tokens for a real cross‑file bug.

No translation, no retrieval, no guesswork. The geometry of the dependency graph itself points to the root cause.

MoE meets WLBS: each node gets its own expert
WLBS gives the system structural memory. MoE (Mixture of Experts) gives it specialised intelligence.

We map every node in the behavior graph to a lightweight expert (a LoRA adapter). A tiny router reads the node’s curvature and world‑line summary, then activates the relevant experts—often the current node plus high‑curvature upstream nodes.


The loop:

  1. A test fails at node rbac.py.
  2. Curvature propagates upstream; roles.py gets a high curvature increment.
  3. Router sees the high curvature upstream and activates both the roles.py expert and the rbac.py expert.
  4. Experts produce a decision: modify roles.py (not rbac.py).
  5. Action is executed, feedback is written back to the world‑lines.
  6. Success → curvature decays for rbac.py and increments for roles.py are already there.
  7. Offline, high‑curvature nodes are fine‑tuned (LoRA) using their world‑line data—only the nodes that actually matter get updated.

The result: continuous improvement without full retraining. The system gets better at diagnosing similar issues every time it encounters them, and the learning is isolated to the nodes that actually need it.

Real numbers from a real bug
We tested on a cross‑file repair task (b‑16: roles.py → rbac.py).

  • Behavioral distance correctly identified as 1 hop.
  • Context assembly took 5–22 ms.
  • Gate prompt size ~375 tokens.
  • First effective write target was roles.py—the correct upstream file.
  • Passing tests went from 34/44 → 42/44.
  • Gate failure rate 4.76%.

And the improvement came without parameter updates—just from world‑line accumulation and curvature propagation.


Why this matters for developers

  • **No more chasing symptoms. **You get spatial root‑cause attribution without hand‑coded rules.
  • Low overhead. The routing prompt is tiny; the curvature propagation is pure arithmetic.
  • Works with existing LLMs. Gate is a standard LLM, fed structured data (graph + curvature + world‑line excerpts). You don’t need to retrain the model.
  • **Scales. **Resolution decay keeps context bounded; experts are updated only when their curvature spikes.
  • Opens the door to other domains. The same pattern works for microservices, supply chains, even clinical diagnosis—anywhere there’s a dependency graph and repeatable failures.

What’s next
We’ve filed two Chinese patents (CN 2026103746505 and CN 2026103756225) and are releasing the core implementation open‑source (repo to be announced). A preprint is on arXiv (cs.SE / cs.AI, March 25, 2026).

We’re actively looking for:

Early adopters to try WLBS on their own codebases or microservice topologies.

Contributors to help with runtime dependency tracking, large‑graph performance, and parameter auto‑tuning.

Researchers to extend the framework to new domains and formalise the curvature propagation theory.


Get involved

Watch the GitHub repo :https://github.com/val1813/wlbs-cli
Try the CLI prototype: pip install wlbs-scan

If you’ve ever spent hours chasing a bug that was upstream, or wished your AI agent had a sense of space, this is for you.

Let’s give AI a map—not just a timeline.

Top comments (0)