By Sagar Shankaran, Founder of CallSphere
DPO replaces the entire RLHF pipeline with a one-line classification loss — no reward model, no PPO, no instability. Both OpenAI and Azure now expose DPO endpoints. Here's how to layer it on top of SFT for tool-using agents.
Key takeaways
TL;DR — DPO (Rafailov et al., 2023) compiles human preferences into a single classification loss, so you skip the reward model and PPO loop entirely. In 2026 both OpenAI and Azure Foundry expose DPO as a fine-tuning method. Run SFT first to teach the schema, then DPO to teach taste — chosen vs rejected pairs do the rest.
DPO takes triples of (prompt, chosen_response, rejected_response) and adjusts the policy so the model assigns higher likelihood to chosen than to rejected, with a KL anchor to the SFT base. The math collapses RLHF's reward-model + PPO loop into a single supervised step.
flowchart LR
PROMPT[Prompt] --> SFT[SFT base model]
SFT --> A[Response A]
SFT --> B[Response B]
A & B --> RATER[Human or LLM judge]
RATER --> PAIR[chosen, rejected]
PAIR --> DPO[DPO fine-tune]
DPO --> POLICY[Aligned policy]
For each pair, DPO maximizes log σ(β·(log π(chosen|x) − log π_ref(chosen|x) − log π(rejected|x) + log π_ref(rejected|x))). β controls how far the new policy can drift from the reference (typical 0.1–0.5).
CallSphere runs 37 agents across 6 verticals. The Salon vertical's "rebooking pitch" agent had a problem: SFT made it accurate, but rude. We collected 1,800 preference pairs from senior CSMs labeling (too pushy, just right), ran DPO on top of the SFT'd gpt-4o-mini, and lifted the post-call CSAT by 11 points without touching task accuracy.
For Healthcare we keep DPO out of the post-call analytics path (deterministic-style outputs prefer SFT) and use it on the appointment-conflict resolver instead. OneRoof real-estate uses Anthropic models so DPO is unavailable — we use prompt iteration there. Plans: $149 / $499 / $1,499, 14-day trial, 22% affiliate.
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
# OpenAI DPO via fine_tuning.jobs (2026)
import json, openai
preference_data = [
{"input":{"messages":[{"role":"user","content":"Reschedule my color"}]},
"preferred_output":[{"role":"assistant","content":"Sure — I have Tuesday 2pm or Thursday 11am open. Which works?"}],
"non_preferred_output":[{"role":"assistant","content":"You need to pick a slot from the calendar yourself."}]}
]
with open("dpo.jsonl","w") as f:
for r in preference_data: f.write(json.dumps(r)+"\n")
job = openai.fine_tuning.jobs.create(
training_file=openai.files.create(file=open("dpo.jsonl","rb"),
purpose="fine-tune").id,
model="ft:gpt-4o-mini:cs-salon-rebook-sft", # SFT'd base
method={"type":"dpo","dpo":{"hyperparameters":{"beta":0.1,"n_epochs":2}}},
)
Q: DPO vs RLHF? DPO is simpler, more stable, and matches RLHF on alignment quality for most chat tasks. RLHF still has an edge in pure RL settings with verifiable rewards (math, code).
Q: How many pairs? 500 minimum, 2,000–10,000 ideal. Quality of judges > volume.
Q: Can a smaller model judge? Yes for taste tasks (gpt-4o-mini judging gpt-4o outputs is fine). For factual correctness, use a stronger judge.
Q: Does DPO work on OSS models?
Yes — TRL's DPOTrainer is the reference implementation; works on Llama, Qwen, Mistral.
Q: KTO vs DPO? KTO requires only thumbs up/down, not pairs — useful when you have signals from a thumbs widget rather than side-by-side comparisons.
Direct Preference Optimization (DPO) for AI Agents in 2026 forces a tension most teams underestimate: agent handoff state. A single LLM call is easy. A booking agent that hands a confirmed slot to a billing agent that hands a follow-up to an escalation agent — that's where context loss, hallucinated IDs, and double-bookings live. Solving it well means treating the conversation as a stateful workflow, not a chat.
Still reading? Stop comparing — try CallSphere live.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
Production AI agents live or die on three loops: evals, retries, and handoff state. CallSphere runs 37 agents across 6 verticals, each with its own eval suite — synthetic call transcripts replayed nightly with assertion checks on extracted entities (date, time, party size, insurance, address). Without that loop, prompt regressions ship silently and you only find out when bookings drop.
Structured tools beat free-form text every time. Our 90+ function tools all enforce JSON schemas validated server-side; if the model hallucinates an integer where a string is required, we retry with a corrective system message before falling back to a deterministic path. For long-running flows, we treat agent handoffs as a state machine — booking → confirmation → SMS — so context survives turn boundaries.
The Realtime API vs. async decision usually comes down to "is the user holding the phone right now?" If yes, Realtime; if no (callback queue, after-hours voicemail), async wins on cost-per-conversation, which we track per agent in 115+ database tables spanning all 6 verticals.
What's the right way to scope the proof-of-concept?
Real Estate runs as a 6-container pod (frontend, gateway, ai-worker, voice-server, NATS event bus, Redis) backed by Postgres realestate_voice with row-level security so multi-tenant data never crosses tenants. For a topic like "Direct Preference Optimization (DPO) for AI Agents in 2026", that means you're not starting from scratch — you're configuring an agent template that's already been hardened across thousands of conversations.
How do you handle compliance and data isolation? Day one is integration mapping (scheduler, CRM, messaging) and prompt tuning against your top 20 real call transcripts. Day two through five is shadow-mode running, where the agent transcribes and recommends but a human still answers, so you can compare side-by-side. Go-live is the moment your eval pass-rate clears your internal bar.
When does it make sense to switch from a managed model to a self-hosted one? The honest answer: it scales until your tool catalog gets stale. The agent is only as good as the integrations it can actually call, so the operational discipline is keeping schemas, webhooks, and fallback paths green. The platform handles the rest — observability, retries, multi-region routing — without your team owning the GPU layer.
Want to see how this maps to your stack? Book a live walkthrough at calendly.com/sagar-callsphere/new-meeting, or try the vertical-specific demo at salon.callsphere.tech. 14-day trial, no credit card, pilot live in 3–5 business days.
Written by
Sagar Shankaran· Founder, CallSphere
Sagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
See how AI voice agents work for your industry. Live demo available -- no signup required.
OpenAI's Frontier platform makes model-native orchestration the default. What that means for agent builders, voice/chat buyers, and the build-vs-buy decision.
GPT-Realtime-2 brings GPT-5-class reasoning into voice. What that means for tool-call reliability, structured output, and production agent design.
The 2026 desktop AI agent landscape — ServiceNow Project Arc, Anthropic Claude offerings, OpenAI agents, and Google Mariner. A buyer's map.
A three-way comparison of Gemini Enterprise, Anthropic managed agents and OpenAI Frontier Platform after Cloud Next 2026 — strengths, gaps, buyer fit.
Anthropic's May 2026 push positions Claude as a vertical platform for financial services. The strategic positioning versus OpenAI and Google.
May 2026's biggest agent-architecture shift: planning, tool selection, and self-correction move inside the model. Framework code shrinks. Here is what changes.
© 2026 CallSphere LLC. All rights reserved.