Loading repository data…
Loading repository data…
Sanskar1724 / repository
Build a Recursive Language Model (RLM) from scratch using Python, OpenRouter, and a custom REPL. Learn iterative reasoning, recursive sub-LLM calls, and long-context problem solving.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
A hands-on implementation of a Recursive Language Model (RLM) built from scratch using Python, OpenRouter, and a custom Python REPL. This project demonstrates how Recursive Language Models overcome long-context limitations by generating, executing, and refining Python code through an iterative reasoning loop.
Traditional Large Language Models (LLMs) struggle with long-context reasoning because all information must fit within the model's context window. Recursive Language Models (RLMs) address this limitation by allowing the model to generate Python code, execute it in a REPL, observe the results, and continue reasoning until the correct answer is found.
In this project, I implemented an end-to-end RLM that stores large contexts outside the prompt, executes model-generated code, supports recursive sub-LLM calls, and iteratively solves long-context reasoning tasks.
llm_query()FINAL() mechanism for returning answersBy building this project, I gained hands-on experience with:
llm_query().FINAL() mechanism to return validated answers. User Query
│
▼
Recursive Language Model
│
Generates Python Code
│
▼
Execute Inside REPL
│
▼
Capture Execution Output
│
▼
More Reasoning Required?
│ │
Yes No
│ │
▼ ▼
Recursive Sub-LLM FINAL(answer)
│
└──────────────► Repeat
re)contextlib)Recursive-Language-Model/
│
├── RLM_MODEL.ipynb # Complete notebook implementation
├── README.md
└── Documatation
If you found this project helpful, consider giving it a ⭐ Star. It motivates me to build and share more AI, LLM, and Agentic AI projects.