Skip to main content

Modular Reasoning Scaffold (MRS) – a lightweight meta-reasoning layer for small LLMs.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

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.#

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

mrs_scaffold-1.1.9.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

mrs_scaffold-1.1.9-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file mrs_scaffold-1.1.9.tar.gz.

File metadata

  • Download URL: mrs_scaffold-1.1.9.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for mrs_scaffold-1.1.9.tar.gz
Algorithm Hash digest
SHA256 ee8f043ad462bc54898ea42c125b2be130e249f5de02155f5cd4a97c4a87801d
MD5 a9994e4fb42f7c065fe23e97525beffb
BLAKE2b-256 968515dd19876b6872bba77ff9fc6decb71af0d4f7a682fd4a15c5eeaeff6bb1

See more details on using hashes here.

File details

Details for the file mrs_scaffold-1.1.9-py3-none-any.whl.

File metadata

  • Download URL: mrs_scaffold-1.1.9-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for mrs_scaffold-1.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 259265bc52f5cd10b5887dacd8fa54f42d9889402b567d470d3e3025db74f619
MD5 fceaa4ef9781680e1611045711eb8ae7
BLAKE2b-256 6784ade5e681e2c199ef39d0c77cc06f261be01542c51f120cf54daaaa213ed3

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