RLM: Recursive Language Models for Large Codebases - Shashi, Superagentic AI

AI Engineer · 17 min · 138 sentences · from YouTube's caption track

Each timecode opens YouTube at the start of that sentence. Line anchors (#s42) are the cue ids in the WebVTT, and every line carries its start and end seconds. All transcripts has every talk, and the whole corpus as one file.

  1. 00:00Hello and welcome to this online track talk for the AI engineer world fair 2026.
  2. 00:08Today we're going to explore the concept of RLM also known as recursive language models and how we can use those concepts or larger code bases.
  3. 00:19My name is Shashi.
  4. 00:21I a founder of super aentic.
  5. 00:23First of all, let's be clear that RLM paper has been published by MIT and friends.
  6. 00:30As you can see, there's a full paper.
  7. 00:32You can read about it.
  8. 00:34But the purpose of this talk is how you can use the concepts of RLM and you can use into your own workflow to implement your own harnesses.
  9. 00:43So first of all, what's the problem?
  10. 00:45If you're using the coding agents for smaller repos or monor repos, they works exceptionally well.
  11. 00:52But if you have ever tried it with the monor repos with the large context you know there's a context problem as the context grows the performance degrade and if you're working with the monor repose
  12. 01:03this problem get worse.
  13. 01:05In this talk we will see we selected the code base and the concept of RLMs are relevant for the larger code bases.
  14. 01:14If you have used the coding agents then you probably saw that there are different approaches that other coding agent harnesses have been taken to solve this problem.
  15. 01:23Most common approach is searching using the tools like grab.
  16. 01:28So basically there's a file system and the coding agent harnesses search using these tools.
  17. 01:34The second approach you probably seen that the semantic search or the local search.
  18. 01:40So idea here is basically you can search through the code and curate the context.
  19. 01:46Another approach is the long context get compressed and you can use the summarized version of the context and there are some memory solutions available in the market as well that you can use
  20. 01:59to persist the memory for the coding agent.
  21. 02:05First of all let's explore the RLM idea.
  22. 02:08Core thesis of the RLM is you need to externalize the context management into programmable execution environment.
  23. 02:17Meaning you should have a separate dedicated environment so that model can operate on that.
  24. 02:23In this case for example your whole repository is treated as a data that model can operate on.
  25. 02:30Then model can write the code to inspect slice and compute the relevant chunks value you can then feed into the main context window.
  26. 02:42So basically rather than putting everything into the model's context create a separate dedicated environment give them a coding agent or ripple and then model write the code to curate the context
  27. 02:57that can be used into the main.
  28. 02:59So it's another context management technique proved to be very effective.
  29. 03:04Could be also be used as a memory layer for your coding agents.
  30. 03:10Let me summarize this giving you a simple analogy.
  31. 03:14Imagine you are a lead software engineer and assigned to the new project with a huge code base.
  32. 03:22Imagine that's a monor repo.
  33. 03:24How does that lead engineer deals with the code?
  34. 03:28So rather than reading line of code line by line engineer probably inspect the code base make some notes see what are the project's dependencies how it is structured if something else
  35. 03:44uh is not understood by the repository engineer probably asked to another engineer or expert to get some ideas and the same concepts applied in RLM so large project like the files and docs and texts and configs because repository has a lot of things
  36. 04:02and the programmable ripple it's kind of a notebook that engineer makes a note about the codebase that can be used researching he may be using other techniques or maybe it's writing some script to search
  37. 04:13something from the repo and then if he stucks then he ask another engineer or specialist where it come to the LLM query and LLM query is basically ally asking another model environment
  38. 04:30to get an answer from and once they get answer then the loop continues and at the end it returns the clean note synthesis.
  39. 04:40So the recussion part here is engineer ask another specialist using LLM query that can be one question or that can be number of questions.
  40. 04:50So this is where the recussion comes in picture.
  41. 04:54Loop is basically your repo as your context and then the model writes the ripple code to get some relevant context that returns the bounded observation and if we if loop needs more information
  42. 05:13it passes through the llm query where it ask another language model or another system to get the response return the value and continue the loop.
  43. 05:25and the loop get terminated until we get a final results.
  44. 05:31Why we talking about the code base and not the big context in terms of like other things for example books or dictionaries is different?
  45. 05:40It has directories, it has test, it has some imports, it has dependencies, it has tests, it has pictures, it has configuration files.
  46. 05:50So the codebase is not only just um the text, it is a structured data and the model need to understand and reason over the text.
  47. 06:01That's why I chose this scenario to use a code basis to prove these concepts of RLM.
  48. 06:09Now let's switch the gear and talk about our own library that we created at super agentai called RLM code.
  49. 06:18You can see RLM codes landing page here where this is just a research playground where you can the concepts of RLM.
  50. 06:29We have um documentation that you can take a look and there's a the GitHub repository.
  51. 06:37It is completely open source project that you can use it and play with it.
  52. 06:46RLM itself is a concept and a pattern and you can implement that concept and pattern in your own way.
  53. 06:56There are official authors also wrote some implementation in their GitHub repos.
  54. 07:04It's called RLM and RLM minimal.
  55. 07:07You can refer that implementation of RLM in DSpy.
  56. 07:12RLM.
  57. 07:13So Omar is author of RLM and he is also author of another popular framework called DSP.
  58. 07:21So DSP got RLM implementation inside it.
  59. 07:26However, you should treat they are completely different.
  60. 07:29So RLM is a pattern and you can implement in your own ways.
  61. 07:34You can find there are various other people implemented RLM in their own way and in the similar way we implemented RLM code as our own independent harness that we will be using in this live demo.
  62. 07:50RLM code is just a reference implementation to demonstrate how the RLM concepts works under the hood.
  63. 07:58So we have implemented something called RLM mode.
  64. 08:02We are using RLM as it is.
  65. 08:04We are not adding anything on top of RLM's ideas and RLM's paper.
  66. 08:09We are using the same concept of recursive calls ripple execution.
  67. 08:14However, you can run it with the local model.
  68. 08:18You can run with run it with cloud-based model.
  69. 08:21You can plug into any observability framework of your choice.
  70. 08:25And that gives you like a lot of flexibility around RLM.
  71. 08:31You can also plug it into the framework of your choice.
  72. 08:35For example, you can use padenti or Google ad or something similar framework and implement ideas of RLN over there.
  73. 08:45In order to demonstrate this, we have created a source code repository where you can try this concept by yourself using MIT's RLM paper and RLM code.
  74. 08:57And we will see how these things works in a in a practice.
  75. 09:03So basically we will show you the loop this you will understand this once you once we see this live demo and what all these files are doing where where is the context has been created
  76. 09:16where the python ripple has written a code and where it's passed to the lm query and how we get the final results.
  77. 09:27So that will be covered as part of the live demo.
  78. 09:30So we can cover this everything here.
  79. 09:34So in nutshell how it looks like is basically it creates the ripple and then observation and the final recursive language output.
  80. 09:43So let me jump into the live demo now.
  81. 09:46Okay, let's do the live demo of this concepts of RLM and RLM code and how it works in a the larger code basis.
  82. 09:55So I have a code repositories here I have checked out and let's open it into the editor so that we can see what's inside it.
  83. 10:05So as you can see there's a demo target which is um we are using RLM code source as a as a demo here and then we have some instructions
  84. 10:17that you can follow along um yourself.
  85. 10:21So basically you have a readme file that you can use to use with your local model or so we are going to use with the Gemini.
  86. 10:30So we will try this script and see what happened.
  87. 10:37So right now you can see we're using the docker as a sandbox.
  88. 10:42If you see the docker container has been just started for this RLM.
  89. 10:50And now coming back to our execution you can see that execution had just finished.
  90. 11:00And in this execution what you have seen basically in the first step model has written the ripple code that you can see here.
  91. 11:08And then it's built the evidence and after that it also made the calls to the LLM query with some prompt and got the result back and after that it gives the the final answer.
  92. 11:27And as you can see here we can have all this all the step coming back to the the final answer.
  93. 11:37And here you can see the it made the two tool calls and how many the tokens is used for this model that you can see it here and the good thing is that
  94. 11:50you can see all these traces in the RLM code repositories.
  95. 11:54So for example you can see all the runs.
  96. 11:57This is the run that we just did.
  97. 12:00You can see all the sessions and all the observability that you can plug it into any of your obser favorite observability platform.
  98. 12:08So this is the CLI path we just demonstrated but we also have this um kind of coding agent style experimental harness where you can try the same thing.
  99. 12:23So first of all let's connect with the Gemini model.
  100. 12:29So you can connect with the Gemini model using the command connect.
  101. 12:34You can you can have a provider and the model name.
  102. 12:38Now you are connected.
  103. 12:41So you can also run the doctor command and see if everything is okay.
  104. 12:55Seems like Dr. Command found some warning.
  105. 12:58But this is related to deep agent ADK and other frameworks which is not relevant to this demo.
  106. 13:04And an interesting part where we will be saying is basically you are sending the prompt.
  107. 13:10So for what we did now we run the command and we ask the question we specify the budget so that we don't not spending too much uh on this run.
  108. 13:21But once we do that as you can see your maximum steps recussion depth and it completed it this run and coming back with the results.
  109. 13:35We can also see that this thing into the the research lab where we can see this spin has been completed.
  110. 13:42We can see some rewards.
  111. 13:45We can also see the trajectory which is important part where we can see the all the RLM loop for example the the ripple and the code and the final output.
  112. 13:57So and also we can see the the events when it started and when it ended.
  113. 14:04So you can play around with this RLM code terminal user interface which is kind of harness and you can experiment your RLM ideas in here.
  114. 14:16So I'm going to quit this for now and let's switch back to the slides.
  115. 14:23In a nutshell, what we just saw basically our context has been loaded.
  116. 14:28We have some ripple code written to extract some snippets.
  117. 14:33We also saw the eleant query has been called to get some more context from another model.
  118. 14:39This is where the recussion comes in picture and we got the final result and we got the the traces in JSONL format that you can import it into the any
  119. 14:51of the observability platform of your choice and we also saw this results coming from different files.
  120. 15:00You can take a look at the source code that will be available uh for you.
  121. 15:04Let's talk about the real thing how AI engineer could use this concepts in the real life and there are few things for example if you're dealing with the large source code
  122. 15:20and you want to for example root cause analysis or on boarding of the repositories or some unfamiliar repos.
  123. 15:29So there are few use cases you can from here and probably try to use RLM concepts over there.
  124. 15:37Basically you can design your own harness um based on your needs.
  125. 15:42So that should capture the whole trajectory all these things like the planning coding observation sub call budget and the final output.
  126. 15:51Now coming back to the final point about RLM concepts and where it's been used.
  127. 15:57I have recently came across a lot of the post on X saying the RLM concepts have been being used into the some of the proprietary things like the managed agent
  128. 16:06dynamic workflows using the RLM concepts under the hood.
  129. 16:11So they have implemented one or more for RLM inside their agent harnesses.
  130. 16:18Recently I saw that the codeex harness is writing the Python Python code in the ripple that you can see to curate the context that is one form of RLM I have seen myself
  131. 16:30and obviously the clouds manage agents or Gemini managed agents they're all kind of concepts of RLM so basically you can get the harness in the sandbox and then you can do the stuff
  132. 16:41and the recent things about the dynamic workflows where one agent given the given the task you can spot on multiple agents that have their separate sandboxes.
  133. 16:51They can work together and give back the final results and the idea is basically generally coming from the um RLMS.
  134. 17:00A lot of software factories concepts are probably using the RLMs but we are not sure yet.
  135. 17:07However, some of the cloud code engineers from anthropic has accepted on X that they have used concepts of RLM.
  136. 17:14You can use this RLM concept on your large context repository.
  137. 17:19And if you have any questions then feel free to reach out to me.
  138. 17:24And finally, thank you so much for listening to my