https://www.boundaryml.com logo
DSPy and BAML seem to me to have
# general
c
DSPy and BAML seem to me to have completely different philosophies. I'm biased, but I need to see exactly what the inputs / outputs are to my prompts, and I need to know exactly what is being sent to the LLM. DSPy is probably great for you if you want higher level primitives and care less about being precise with your prompts.
p
On the contrary, I think they actually have very similar goals, just having arrived independently to a different set of primitives: BAML | DSPy Types | Signatures Functions | Modules Both use adapters under the hood to coerce the users inputs into something more useful to the LLM. BAML has a sophisticated parser, but DSPy does not. On the other hand, DSPy has optimizers and first class evaluation data types, which BAML does not (yet).
The end goal for both BAML and DSPy is really the SAME: to help people build more reliable compound AI pipelines using composable building blocks. The philosophy of how they get there is only slightly different. DSPy asks users to describe the prompting strategy they want, but BAML asks users to specify the actual prompt they want. Both use type systems to coerce the LLM towards meeting the prompt's objective.
What made DSPy "click" for me and the parallels with BAML become so much more clear, is when I realized that Modules in DSPy are infinitely customizable and composable. You can use one Module to build another Module, and you can compose together any arbitrary combination of Modules to feed into your eval pipeline and optimizer, allowing you to optimize an entire compound AI workflow at once. That basically opens up a world of self-improving AI systems, because you can plug in your optimization pipelines into new data from the real world, auto-improving the end goal without worrying about manually tweaking intermediate prompts every time a new model arrives.
Composable systems are great, but self-improving composable systems are something else entirely. Granted, DSPy needs more time in the wild to actually realize these things. But I think BAML will really benefit from some of these ideas spilling into it, too. It does structured outputs so well, it's just a matter of using the BAML language's capabilities with the optimizers of the future to help people improve their prompts rather than manually tweaking them. The moment your AI pipelines become more than 3-5 prompts composed together, manually tweaking each of them to try out a new model becomes a painful experience.
a
Baml lets you get started based off vibes only, before you write any tests. But once you add tests we can add optimizers using those
3 Views