https://www.boundaryml.com logo
🟡 Using Recursive Language Models with BAML
# questions
r
How can one use recursive language models with BAML? DSPy just got dspy.RLM and I’m jealous.
p
I'm not sure that BAML can support RLMs right off the bat. The RLM requires a sandbox REPL and programmatic access to manipulate its own context. It's far more than just an LLM calling itself. This is why DSPy is awesome - the latest techniques are always available there first 🙂
The way the DSPy module abstraction works under the hood and the way the signature is used to construct the prompt also play a role. DSPy prompts are inherently structured, and the object structure of the prompts (as the user message chain grows as it accomplishes a complex task) is available to the RLM internally. This can also be composed with GEPA so that you get the benefit of a GEPA run as well as the RLM's ability to work with infinitely long context
Some really advanced functionality thanks to the great underlying abstractions
BAML's prompts are inherently less structured (you can raw dog anything you want, basically). So am not sure if RLMs are a great fit for BAML, but I could be wrong. Will keep an eye out for what folks here think about RLMs as they become more mainstream
v
i have no idea what an RLM is! will need to investigate first
p
Recursive language models for any others that stumble across this. First introduced in this blog post but an arXiv paper is now out https://alexzhang13.github.io/blog/2025/rlm/
r
Seems more like an implementation of RLM could use BAML, and BAML could accomodate the implementation through functions.
p
I dunno, for me the signature + module abstraction in RLMs is pure joy, both to read and write. It won't look as nice if BAML were shoved into it
4 Views