https://www.boundaryml.com logo
🟡 BAML Long-term Roadmap Inquiry
# questions
r
Where can I find the long term roadmap for BAML? I’m contemplating a move to DSPy with the
BAMLAdapter
to get the format…. I need to understand the vision and how we’re going to get there 🙂
Hello @Vaibhav (BAML 🐑) 🙂
a
We likely wont tackle optimization until next year. If you do try dspy let us know what you think of the developer experience or any tips we might learn
Our main focus at the moment is agents and workflowa
Whats the thing thats making you contemplate the move by the way?
g
Here's the roadmap we posted earlier this year: https://boundaryml.com/blog/launch-week-day-5
p
@aaronv (BAML) what are the agents and workflow features that are prioritized over the coming months? It would really help to have a public GitHub issue on the repo where you list these priorities, it helps the community organize their thoughts and experiments and manage their expectations, too
DSPy optimizers (particularly GEPA) are getting very good, very fast. And the quality of prompts they write far surpass what any human can write by hand. If one provides reasonable metrics and evaluation data, it's pretty simple to get really good prompts that can beat any initial prompt by BAML. I've loved the DSPy DevEx so far.
Would love to chat with you and Vaibhav about this some day
@rjurney and I brainstorm a lot behind the scenes and both of us have faced our own unique series of frustrations with the way we have to very delicately structure the prompt by hand in BAML. For e.g., where you place the
{{ ctx.output_format }}
has a disproportionate impact on the outcome with certain models. And there's so much painful, manual tweaking of prompts, esp in multi-agent workflows that DSPy is the most compelling alternative out there, because it has exactly none of those problems. Sure, no playground, but it's amazing for Python devs at least.
I think BAML does (for now) have the advantage of supporting other languages than Python, but the DSPy community is exploding and in a few months, DSRs (Rust) and DSPy's Ruby, Golang and TS communities are gonna grow too. GEPA is the first of several more optimizers that are going to change the way prompts are handled (less human tweaking, more LLM eval-based tweaking would be the norm). And the common issue of "I don't have training data" for optimizers is also actively being addressed by DSPy - by the end of the year, they will have a means to bootstrap training data for the optimizers, with explicit control on how the prompts can get tuned, all with a perfectly reasonable DevEx.
A year from now, the landscape will look a LOT different for DSPy than it has to date. So it's worth planning for that from a BAML perspective and taking as many lessons as possible from that community imo
p
Any quick tips on ctx.output_format placement for the different models? Or is it just a guess and check?
p
Most proprietary models don't really seem to care much. But open source models seem to like it placed downstream of the user message, and you have to also add "_.role('user')" to clearly delineate what's the system message, what's the user message and store your fewshot examples in a template string for open source models. But YMMV based on the model
So I invariably end up trying them all
v
(I'm in a few calls and will longer term thoughts soon 🙂 ) for smaller models and more complex problems, put ctx.output_format at the end. more more capable models, and easier problems, in the earlier works well. Use system message for openai, user for pretty much all others. But jsut test 🙂
a
yeah in a way as DSPy keeps growing we can keep learning from them and the patterns -- i dont think I see everyone using DSPY from the getgo. I'd dare say 90% of engineers are still vibe-prompting initially and/or modifying prompts manually. We can help get that number down as well with easier to use tooling, and we want DSBaml to exist as well. Vaibhav just implemented full type reflection on our typebuilder, so now one could optimize every part of a baml schema (alias, descriptions, etc). We are just missing exposing more components (the full prompt string, etc). And once we have workflows (and adoption), we can look at building a solution that works not just for 1-step pipelines, but N steps, and run optimizations that can even change the signatures of any in-between steps if those perform better (not sure if DSPy does this, but it's a neat idea i think -- a diff schema may perform better)
I agree 100% that LLMS write better prompts
but some cases are super tricky
If someone makes a DSPy optimizer that figures out that using UUIDs is worse than just using simpler ids (1,2,3) in a prompt, as @rjurney implemented manually, I will be very impressed
p
Creating a basic prompt proposer based on dspy's for baml would go a long way. Have been meaning to do this for a bit, might throw something together and see how it does.
a
you may want to wait until this lands 🙂 https://github.com/BoundaryML/baml/pull/2483
p
Love to hear that, and I'd be a very happy and willing beta-tester of DSBaml whenever it does come about. And I'd also love to test any new features in BAML that doesn't have me messing with prompts by hand. Especially something that helps construct and structure the prompt in a way that's more automated and suited to the LLM in question, and also in a way that's easier to switch between LLMs. Right now, compound BAML workflows exhibit wild swings in performance when one LLM is swapped out for another one. I don't experience these wild swings when using DSPy (its results are remarkably more consistent, regardless of the model provider).
> And once we have workflows (and adoption), we can look at building a solution that works not just for 1-step pipelines, but N steps, and run optimizations that can even change the signatures of any in-between steps if those perform better (not sure if DSPy does this, but it's a neat idea i think -- a diff schema may perform better) For this one, DSPy already does this. A saved DSPy program already allows you to inspect the state of multiple internal prompts (very sound support for joint optimization of all sub modules that compose to form a larger module), and it's fully diff-able too (it's just a JSON file on disk). They really nailed the devex on joint optimization for multi-step prompts and how to manage them without human intervention.
Cc @stugorf for these excellent updates too, we all keep discussing these topics! Thanks for clarifying, Aaron
I find it very interesting that the developments in BAML are almost inverted in order from DSPy's. In DSPy, you can't currently modify the descriptions and field names in a signature (but those are fully exposed to the optimizer - there just needs to exist a new optimizer that can target it). But seems like in BAML the first thing the user would do is optimize the field descriptions, followed by a later update that would allow them to optimize the user instructions in the prompt (DSPy does this already)
The more parts of a prompt that BAML exposes, the more likely it is that a future optimization algorithm can ease that pain point for the user
a
if you have an example of a multi-step program where the middle layer of prompt signatures gets optimized/changed away it'd be interesting to see. And yep the goal is honestly to expose everything about BAML so people can write their own
generators
p
Absolutely, I already do - just need to get my code in order and write the blog post up. Coming soon
a
like the whole AST. A generator could potentially be a DSPy-enabled one, that optimizes the prompt before the codegen
s
I was able to get the prompt and other features out of BAML using the collectors but at the end of the day, I’m excited to see where some of the newer work is heading
a
yep that isn't as ergonomic (which isn't great) so we'll continue to improve!
p
My gripe with this, David, is that it makes BAML's abstractions seem too low level. The code can get very verbose. DSPy code is crisp and concise without losing that flexibility (nearly everything is customizable)
I want BAML to evolve to a state that makes some of these aspects seem a little higher level, with less boilerplate. It takes a ton of code to get anything useful out of the collector API right now
The good thing about having abstractions that are too low level, is that it's very easy to write higher level abstractions on top of them later on that can help users get more productive. If it were the other way around, it would be a lot harder, and what happened to the LangXXX and LlamaXXX frameworks of old
a
I'll get on this! Definitely would help having a public roadmap that's more detailed
p
So I'm confident that BAML is in a good place
a
just lots of [good] stuff happening internally so bear with us
p
David and I are always willing beta testers and we are neck deep in a bunch of other similar work with DSPy, so please do post your updates! We'll stay on top of things 🫶🏽
a
sweet 🙂
r
How are you working on agents? What features support them? I don’t mean tell me your optimization plan, I want to know what’s coming so I can evaluate if it’s going to work out for me…
Thanks so much!
Yeah, that’s interesting. Altering my current prompt is suicide, but I can alter signatures and few shots productively. I took this to be a sign to focus on editing signature and BAML formatted few shots.
So I can’t find much about Semantic Streaming or Agentic Features. So far as I know, BAML is just a signature template system for LLMs… how does it facilitate agents? I’m not aware of these features or plans. And what does semantic streaming mean? Get this object before that one?
Does that mean
agent = baml.agents.ReAct(prompt=prompt, tools=tools)
or however BAML’s version of DSPy agents would work? Because this is a big feature DSPy has which has nothing to do with optimization.
g
Semantic Streaming is our method for streaming data from LLM calls while not breaking the semantic invariants of your types. For example if you have defined a type for which it’s invalid for a certain field to be partially incomplete, Semantic Streaming allows you to describe that invariant, so that values only reach the client if they satisfy the invariant. More details here: https://docs.boundaryml.com/guide/baml-basics/streaming#semantic-streaming
r
I see, what about agent features? I keep seeing you guys talk about agents like in sessions but I am not aware of BAML helping with agents, just prompts.
Like DSPy has this: https://dspy.ai/learn/programming/tools/#basic-example That is even easier than BAML because they make ReAct magically happen... even though your user experience for prompting is so easy.
What kind of agent features do you currently support and what is coming?
I kind of see some stuff I haven't used here, where you can use functions to set different prompts as tools...
Copy code
from baml_client import b
from baml_client.types import Message, StopTool

messages = [Message(role="assistant", content="How can I help?")]

while True:
  print(messages[-1].content)
  user_reply = input()
  messages.append(Message(role="user", content=user_reply))
  tool = b.ChatAgent(messages, "happy")
  if isinstance(tool, StopTool):
    print("Goodbye!")
    break
  else:
    messages.append(Message(role="assistant", content=tool.response))
What else is there?
How does BAML handling making external API calls in tools? That is what a lot of my tools do. Not clear on how that works through Python without leaving BAML land.
v
I would just give us a bit to share what’s coming up next 🙂
October should be a very exciting month for how to do agents in BAML
And we’ll have some docs on what kinds of ideas we’re going to enable
I suspect most discord messages aren’t going to be detailed enough, but I think our docs will be up soon and that should show what kind of primitives we are thinking about for agents much more clearly
r
Cool
p
Looking forward to the updates!
r
Yeah, sound like good stuff. BAML makes dealing with LLMs joyous… I’m eager to see that experience extended to agents too.
If you could skip prompt optimization... and reflect on signature descriptions... or even field names, based on a description of what the prompt is supposed to do or something... that would be really cool. Because field descriptions are really powerful.