avalanche-run/predict-rlm

Production focused Self-harnessed LM runtime (RLM) that allows the LM to call its sub-lm with DSPy signatures. Define your inputs, outputs, and tools — the model handles its own control flow. Get fully interpretable trajectories and performance that scales directly with model improvements. Without context rot.

What it solves

Many LLM workflows are too complex for a single prompt and too adaptive for a fixed chain of steps. predict-rlm gives models a runtime: instead of forcing everything into one prompt, the model can inspect files, keep state, branch, call focused sub-models, use tools, and manage large context through code, returning typed output. You define inputs, outputs, tools, and an operating procedure, and the model writes and executes Python in a sandboxed REPL, adapting as it discovers evidence.

How it works

predict-rlm is based on Recursive Language Models (RLMs). You start with a DSPy signature defining inputs and outputs, then create a PredictRLM instance with a main language model and an optional sub-model. The outer model reads the signature and writes Python code that runs in a sandboxed REPL. The code can loop, branch, call tools, and invoke focused sub-model calls via predict() for narrow tasks (including multimodal with dspy.Image). Large inputs stay as file paths and metadata until needed, avoiding context rot. Every run records a full trace of generated code, output, tool calls, subcalls, timings, token usage, errors, and final SUBMIT payloads. These traces are optimization-ready for tools like GEPA.

Who it's for

predict-rlm is for developers building LLM workflows that require exploration, adaptation, and evidence gathering before producing a final result. Good use cases include codebase analysis, document review and extraction, log analysis, spreadsheet and financial-model workflows, audits, and multi-file synthesis with typed outputs. It is not meant for simple chat completions, one-shot classification, deterministic ETL, or tiny prompts where a direct LLM call is enough.

Highlights

  • Sandboxed Python REPL: the model writes and executes Python adaptively, branching and retrying as it learns
  • Focused sub-model calls: spin up typed DSPy signatures for narrow perception and extraction, including multimodal image calls
  • Skill bundles: package domain instructions, PyPI packages, sandbox modules, and host-side tools (e.g., a built-in spreadsheet skill, PDF skills)
  • File I/O and workspaces: typed File inputs and outputs, with options for copying or mounting local files read-only
  • Full observability: every run exports trace.json and evidence.json for debugging and optimization
  • Async support: native async tool calling and concurrent sub-LM invocations in the WASM sandbox
  • Docker Sandboxes backend: optional sbx backend for a Linux Python runner with pool support for throughput

Related

  • Project
  • Project
  • Project
  • Project