Skip to main content

RLM: Recursive Language Model

The RLM architecture is designed for “thinking” at scale. It uses a recursive loop structure to handle inputs that exceed standard context windows or require multiple rounds of deliberation.

Using RLM Zero-Shot

You can use the RLM architecture immediately by targeting the zero_shot_rlm_single graph ID. This allows you to provide a massive context and a complex system prompt without any prior optimization.

RLM for Standalone Reasoning (Policy)

Use RLM when you have a high-complexity task that requires deep reasoning but you don’t need a verifier score.
import os
from synth_ai.sdk.graphs.completions import GraphCompletionsAsyncClient

client = GraphCompletionsAsyncClient(
    base_url="https://api.synth-ai.com",
    api_key=os.environ["SYNTH_API_KEY"],
)

result = await client.rlm_inference(
    query="Analyze this 500k token log for security anomalies.",
    context="...(massive log file)...",
    system_prompt="You are a senior security researcher...",
)
print(result["output"])

RLM as a Verifier

RLM can also be used as a high-fidelity verifier for verification tasks. It is the default architecture used when traces exceed 500k tokens or 100+ events. However, RLMs aren’t only for verification—they’re a general-purpose architecture for handling massive context and complex recursive reasoning.
# Using the same client from above
result = await client.run(
    job_id="zero_shot_verifier_rubric_rlm",
    input_data={
        "trace": {...},
        "rubric": {...},
    }
)
print(result.output)

Why use RLM?

  1. Unlimited Context: Automatically handles massive inputs that would crash a standard single-prompt LLM.
  2. Recursive Auditing: RLM nodes can check each other’s work, significantly reducing hallucinations in long-context tasks.
  3. Optimizable: While zero_shot_rlm works out of the box, you can use Graph Evolve to optimize the RLM recursive prompts for your specific domain.