Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

MRS v1.0 — Modular Recursion Scaffold

A lightweight architectural layer for controlled recursive reasoning in small LLMs

Overview

Modern language models show emergent reasoning capabilities only once they reach large parameter scales.
MRS (Modular Recursion Scaffold) provides an architectural alternative:
a structural layer that gives even very small models the ability to maintain intermediate variables, reuse prior states, and perform stable multi-step reasoning.

MRS does not modify the underlying model.
It wraps it with:

  • Memory slots
  • State update rules
  • Invariant structural constraints
  • Recursion operators

This gives a tiny model the functional profile of a much larger one, without requiring scale.

Why This Matters

Most lightweight models fail at reasoning because they cannot:

  1. Store intermediate results
  2. Correct their own trajectories
  3. Maintain stable representations over recursive steps

MRS adds these abilities explicitly through structure rather than scale.

It is model-agnostic, parameter-free, and computationally cheap.

This makes it ideal for:

  • On-device / low-resource models
  • Custom agents
  • Safety layers
  • Interpretability research
  • Experiments in emergent behavior at small scale

Core Concepts

1. Structural Slots (S)

Named containers that hold intermediate reasoning variables.
Example:
S = {s0, s1, s2, …}
Slots persist across recursion steps.

2. Update Rules (U)

Explicit functions controlling how each slot transforms.
Each U is stable, monotonic, or self-correcting.

3. Constraint Layer (C)

A lightweight rule set ensuring:

  • bounded drift
  • state coherence
  • step-to-step consistency

C acts like a guardrail system for stability.

4. Recursion Operator (R)

The loop engine:
R(S, U, C) → S′
applied until termination or max depth.

This combination gives a small model the equivalent of “scratchpad reasoning” without needing the internal capacity of a large transformer.

Minimal Reference Implementation (C1)

class MRS:
    def __init__(self, num_slots=4, max_depth=8):
        self.S = [None] * num_slots        # structural slots
        self.depth = 0
        self.max_depth = max_depth

    def update(self, model, prompt):
        self.depth += 1
        state_repr = {f"s{i}": v for i, v in enumerate(self.S)}
        inp = {"prompt": prompt, "state": state_repr}
        out = model(inp)
        for i in range(len(self.S)):
            self.S[i] = out.get(f"s{i}", self.S[i])
        if self.depth > self.max_depth:
            return self.S, True
        return self.S, False

    def run(self, model, prompt):
        done = False
        while not done:
            _, done = self.update(model, prompt)
        return self.S

Intended Use

mrs = MRS()
result = mrs.run(small_llm, "Solve this in steps.")

What MRS Enables

  • Stable chain-of-thought
  • Deterministic recursive loops
  • Intermediate variable tracking
  • Multi-pass self-correction
  • Mild emergent behavior without scale
  • Interpretability-friendly internal state
  • Reduced hallucination drift
  • Structured reasoning on models as small as 100M parameters

Roadmap

v1.0

  • Base scaffold
  • 4 slots
  • Simple update rule
  • Basic drift constraints
  • Terminal recursion depth

v1.1

  • Weighted slot updates
  • Error-corrective constraints
  • Deterministic rollback mode

v2.0

  • Hierarchical recursion
  • Specialized slot types
  • Cross-slot influence graphs
  • Stability metrics
  • Metastability detector
  • External verifier mode

License

Apache 2.0

Citation

RJ Sabouhi (2025). Modular Recursion Scaffold v1.0.#

Metadata

Release files for mrs-scaffold 1.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mrs-scaffold 1.1.9
File Size Uploaded Provenance
mrs_scaffold-1.1.9.tar.gz 8.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mrs-scaffold 1.1.9
File Interpreter ABI Platform
mrs_scaffold-1.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 20.9 kB

Release files / mrs_scaffold-1.1.9.tar.gz

Download URL mrs_scaffold-1.1.9.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ee8f043ad462bc54898ea42c125b2be130e249f5de02155f5cd4a97c4a87801d
BLAKE2b-256 checksum
How to use checksums
968515dd19876b6872bba77ff9fc6decb71af0d4f7a682fd4a15c5eeaeff6bb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / mrs_scaffold-1.1.9-py3-none-any.whl

Download URL mrs_scaffold-1.1.9-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
259265bc52f5cd10b5887dacd8fa54f42d9889402b567d470d3e3025db74f619
BLAKE2b-256 checksum
How to use checksums
6784ade5e681e2c199ef39d0c77cc06f261be01542c51f120cf54daaaa213ed3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for mrs-scaffold 1.1.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page