AIAI EngineerJun 2, 2026· 12:40

What Lies Beneath the API — Benjamin Cowen, Modal

In this episode, Ben Cowen from Modal argues that as AI products mature, fine-tuning becomes essential, citing cases like Intercom beating their frontier API at 1/10th the cost. He identifies three signals it's time to fine-tune: paying more for the API than customers pay you, evaluative plateaus, and latency requirements that shared endpoints can't meet. Cowen explains that supervised fine-tuning now fits in 300 lines of Python and that reinforcement learning rollouts can scale to 50,000 sandboxes using serverless platforms like Modal. He contends that frontier labs aim to win at everything, while businesses need to win at their specific logic, making fine-tuning a natural destination. The episode provides practical guidance on when and how to make the leap, emphasizing that building an agent harness and collecting eval data already sets the stage for training.

Transcript

Intro0:00

Ben Cowen0:16

Yeah, so good afternoon, and thanks for coming to this session. I know there's a lot to choose from. My name is Ben Cowen. I'm a forward-deployed machine learning engineer at Modal, and I want to talk about an interesting pattern that we've been seeing in AI application development.

I'll give you the punchline now. It's about as companies mature and their products mature and specialize, we're seeing more and more turn to fine-tuning to get increased performance, better costs, and so forth. So this brings up an interesting question of when does your application step over the line into a custom domain?

When is fine-tuning worth it?

So if you're not familiar with Modal, we're a general-purpose serverless compute platform. We provide sort of basic building blocks, like serverless functions and hardened sandboxes for code execution. And so as an FDE on a general-purpose platform, I've had the opportunity to work with sort of an extremely wide range of AI applications.

So from physics simulations to quantum chemistry, and of course, voice processing, LLMs, and agents. A really interesting one that's been really blowing up is large-scale reinforcement learning. And so we've started to think about some of these customers as where are they on the model spectrum.

So on one side of the spectrum is the frontier API. And the frontier APIs, I think everyone here would agree, has unlocked a completely new era of accelerated growth. People can build basically anything exceptionally fast. They're amazing. But you can't customize it at all beyond prompt engineering.

Frontier API1:51

Ben Cowen2:17

And so you might, I mean, I love the whole caveman mode thing. If you tell your LLM to speak like a caveman, you can reduce your tokens by like a lot. But that's not going to scale if your startup 100x or 1,000xes,right?

Another kind of interesting thing we see is when startups win large enterprise contracts with very specific latency or throughput requirements. There's very little ability to customize for those things, let alone if you have a custom metric that encapsulates your business logic.

Fine-Tuning2:57

Ben Cowen2:57

OK, so to get this model differentiation, a lot of companies turn to fine-tuning. And what that has meant traditionally is this huge jump to the other end of the spectrum,right? Training has a very different scaling and compute characteristic to most production workloads.

So if you want to train and serve a production workload, in the past you have to get a big cluster. Now you have to isolate those resources from your production resources. You're going to need infrastructure engineers, or your AI engineers are going to be working on infrastructure, maybe even your scientists.

So with this kind of extremely customized, powerful option, you also have this massive responsibility for the entire stack.

And so you might have a guess who I would recommend for this, but there's sort of a middle ground that's emerging. There's a new type of cloud provider that makes this a lot easier. And

we're building this to address this problem that we're seeing,right? So leader after leader in the space are announcing or publishing that they've fine-tuned and gotten incredible results. OK, so Intercom is beating their frontier API at 1/5th the cost.

Industry Wins4:05

Ben Cowen4:28

Pinterest says orders of magnitude. I wish I knew the exact amount. But I think one of our customers, Decagon, has summed this up really well, which is that basically the frontier labs probably don't have the exact same goal as you,right?

They want their models to win on everything possible. And we want our models to win at our business logic,right? You want to be the best at what you provide your customer.

Easier Now4:59

Ben Cowen4:59

And so, yeah, I'm happy to announce that it's actually a lot easier than you might think to train a model. There's some incredible open-source libraries out there now that make this extremely accessible. They give you full control over the algorithm,right?

So you get to kind of reach across the spectrum to doing it yourself at the algorithm level without having to also manage the cluster and so forth. And the most important thing is that this retains the fast iteration cycles of the frontier end of the spectrum.

So that's basically our entire mission, is to give you algorithm control and fast iteration.

Signals5:47

Ben Cowen5:47

So this is my hot take that it's just a matter of time until your product steps into being domain-specific,right? So in some sense, if you have a differentiated product, it is custom,right? So

when exactly you cross that line, that's a decision you have to make. But it's something we'd love to talk to you about. So I have here a few signals that might indicate that you're getting close to that time.

So if you've moved to caveman mode and you're still paying more for your API than your customers are paying you, that might be a signal that your economics aren't scaling,right? And that you could probably benefit from a customized inference endpoint.

Same for latency and throughput,right? So if you are plateauing on your evals, that's a signal that you might get something out of fine-tuning a model. There's a decades-old adage in training that if you have garbage data, it's garbage in, garbage out.

So if you haven't been collecting data and you don't have mature evals, it's probably not time to train. You need to collect the data. That said, this is one of the main takeaways that I'd love for everyone here to walk out with, is that if you have built a product, you probably have at least touched all the things you need to train if you haven't already done it.

OK, if you've built an agent harness, then you have what you need to have a new model learn through reinforcement learning how to provide your service,right? So if you're evaluating your products and collecting that data on what's working and what's not, then you have training data to train your model.

Data Ready7:25

Ben Cowen7:48

And with the advent of serverless compute platforms and these open-source libraries, I don't know, a lot of us when we started training models, we were taping the gradient by hand and implementing the linear algebra. You don't have to do that anymore unless you have a freaky model, which if you do, I'd love to talk to you about it.

But yeah, you don't need the infrastructure experts and so forth. So this is an exciting time. I knew the video wouldn't play. Anyway, so the next couple of slides are just some snippets of code. I don't expect, yeah, you can't even really read it.

But I just want to kind of illustrate what it looks like to set up a training algorithm today. It's not a gigantic mono repo with thousands of lines of code. You can do supervised fine-tuning in 300 lines of Python.

300 Lines8:32

Ben Cowen8:49

OK, so once you have your data curated, once you have an account on Modal or some other serverless platform, you can get started really fast. And this code is on our examples repository.

Scale Training9:04

Ben Cowen9:04

The thing in this video, it's just showing how we can scale containers really fast. And so just to bridge these concepts a little bit, people usually associate serverless with inference. But with training, it can be really, really handy too for doing something like hyperparameter tuning,right?

You don't have to, every minute on your cluster isn't sacred anymore. You can fan out to a bunch of containers, get them on demand. As soon as it's not promising, kill it. And it's kind of almost like a meta-evolutionary algorithm at that point.

RL Rollouts9:47

Ben Cowen9:47

So it's an exciting time to be doing that. And the same goes for reinforcement learning. A lot of us who got our graduate degrees in machine learning in the last 10 years didn't do reinforcement learning,right? This is relatively, I mean, it's actually really old.

But the stuff we're using today is kind of new. But they have these libraries too. You can do it in 300 lines of code. And something interesting about Modal in particular is we have sort of unified APIs for sandboxes and GPU containers or clusters.

So what this means, in a nutshell, when you're training a model with RL, it needs to sort of practice a lot. And so this is massively, embarrassingly parallel kind of evaluation thing called a rollout. And so we have one of the most amazing things in the last quarter has been customers scaling up to 50,000, 100,000 sandboxes just to do RL.

And you can do it too. The code is open source. And then I'd be remiss not to mention what comes after the training. You have to serve the model,right? And this is what the frontier API is doing under the hood.

Serving10:50

Ben Cowen11:08

Well, I don't know if they use VLLM. But my point is that you can do it too. And it's actually not that much code. VLLM, SGLang, Trident Inference Server, or a custom inference workflow with just Python on Modal or other serverless platforms, you can auto-scale all of this stuff to match your traffic as it's coming in.

So yeah, so just to kind of sum everything up, what I'm saying here, I'm not saying go train your modelright now. I'm saying it's not something that is like, oh, I'll do that in 10 years. You might want to train your model in one year,right?

Conclusion11:34

Ben Cowen11:51

You might want to do it in six months. So start thinking about when am I going to know, OK, it's time to train my model? And how can I prepare for that moment by collecting data, developing your evals?

And yeah, I'd love to come by our booth. We're at kind of the end over on that side. I'd love to talk to you more about this. Or you can reach out. I have my email here. That's it.