# My first open-source feature: adding a Together AI fine-tuning provider to DSPy

> Source: <https://dev.to/katherineahn/my-first-open-source-feature-adding-a-together-ai-fine-tuning-provider-to-dspy-3j94>
> Published: 2026-07-23 06:44:59+00:00

Most code that calls an AI model works like a conversation: ask, wait a second, get a reply. Fine-tuning doesn't. You hand off a job and walk away, checking back every few seconds to see if it's finished.

DSPy is a framework for building programs that call language models. Instead of hand-writing and endlessly tweaking prompt strings, you declare what you want in terms of inputs and outputs, and DSPy turns that into the actual prompt. It can even optimize those prompts for you automatically, so getting a better result doesn't mean rewording things by hand.

Here's something I didn't know starting out: DSPy already knows how to talk to almost any AI model, Together AI included. Asking a question and getting an answer back is handled by a shared layer that works for everyone, so no new code is needed there. Fine-tuning (the "hand off a job and walk away" thing from the top) is the exception. Every company does fine-tuning its own way, so DSPy needs a small custom piece, called a Provider, to handle each one. Building the Provider for Together AI is what my PR does.

Why does this matter? Together AI is one of the cheaper, more popular places to fine-tune open-source models like Llama, so a lot of people building with DSPy end up wanting to use it. Before this, they had to step outside the framework: fine-tune on Together by hand, then wire the finished model back into their DSPy program themselves. With the provider in place, fine-tuning becomes a first-class option. You point DSPy at your training data, and it handles the upload, the job, the waiting, and hands back a model you can drop straight into the rest of your pipeline. That is the whole point of a framework, taking a fiddly manual process and making it one clean step, and adding a provider is how that gets extended to one more company.

The Provider does one job from start to finish: take your training examples and hand back a fine-tuned model. Under the hood, that's five steps:

Step 4 is the "walk away and check back" part from the very top. Here's what it actually looks like (I trimmed the logging so it's easy to read):

```
while True:
    status = job.status()        # ask Together how it's going
    if status == "completed":
        break                    # done, move on
    elif status in ("error", "cancelled"):
        raise ValueError(f"Job ended with status: {status}")
    time.sleep(60)               # wait a minute, then ask again
```

That `while True`

loop is the whole idea. There's no single moment the answer arrives, so the code just keeps politely asking "done yet?" until Together says yes.

What I actually took away is that "using an AI model" isn't one thing, it's two. Talking to a model and reshaping a model are separate acts, and they live in separate parts of the code. The everyday "ask a question, get an answer" path already worked, so my whole contribution lived in the other world: the one where you change the model itself.

That split clicked for me through my other major, cognitive science. Prompting a model is like handing someone notes to glance at in the moment. Fine-tuning is like studying until the knowledge is internalized and you don't need the notes anymore. It's the same line psychologists draw between working memory (what you're holding in mind right now) and long-term learning (what's become a permanent part of you). I didn't expect a summer of writing AI infrastructure to keep reminding me of my psych classes, but here we are.

The full provider is open as a pull request to DSPy, currently under review: [https://github.com/stanfordnlp/dspy/pull/9987](https://github.com/stanfordnlp/dspy/pull/9987). It mirrors DSPy's existing `databricks.py`

and the tests are fully mocked, so you can read the whole thing in one sitting.
