By Sagar Shankaran, Founder of CallSphere
A practical guide to fine-tuning large language models for specialized domains including data preparation, training strategies, evaluation, and when fine-tuning beats prompting.
Key takeaways
Fine-tuning an LLM is expensive, time-consuming, and often unnecessary. Before investing in a fine-tuning pipeline, determine whether your use case genuinely requires it. Fine-tuning makes sense when:
If few-shot prompting with retrieval-augmented generation solves your problem with acceptable quality, that is almost always the better path. Fine-tuning should be a deliberate decision, not a default one.
Modern parameter-efficient fine-tuning methods like LoRA and QLoRA produce strong results with surprisingly small datasets:
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
flowchart LR
DATA[("Curated dataset<br/>instruction or chat")]
CLEAN["Clean and dedupe<br/>PII filter"]
TOK["Tokenize and pack"]
METHOD{"Method"}
LORA["LoRA or QLoRA<br/>adapters only"]
SFT["Full SFT<br/>all params"]
DPO["DPO or RLHF<br/>preference learning"]
EVAL["Held out eval<br/>plus regression suite"]
DEPLOY[("Adapter or<br/>merged model")]
DATA --> CLEAN --> TOK --> METHOD
METHOD --> LORA --> EVAL
METHOD --> SFT --> EVAL
METHOD --> DPO --> EVAL
EVAL --> DEPLOY
style METHOD fill:#4f46e5,stroke:#4338ca,color:#fff
style EVAL fill:#f59e0b,stroke:#d97706,color:#1f2937
style DEPLOY fill:#059669,stroke:#047857,color:#fff
Each example must be high-quality. One hundred expertly crafted examples outperform ten thousand noisy ones. Invest in human review of training data.
{
"messages": [
{"role": "system", "content": "You are a medical coding specialist..."},
{"role": "user", "content": "Assign ICD-10 codes for: Patient presents with..."},
{"role": "assistant", "content": "Primary: M54.5 (Low back pain)\nSecondary: G89.29..."}
]
}
LoRA freezes the original model weights and injects small trainable matrices into attention layers. This reduces trainable parameters by 99 percent while maintaining quality.
Key hyperparameters:
QLoRA combines LoRA with 4-bit quantization of the base model, enabling fine-tuning of 70B+ parameter models on a single 48GB GPU. The quality loss from quantization is negligible for most applications.
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.
from peft import LoraConfig, get_peft_model
from transformers import BitsAndBytesConfig
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_quant_type="nf4"
)
lora_config = LoraConfig(
r=16,
lora_alpha=32,
target_modules=["q_proj", "v_proj", "k_proj", "o_proj"],
lora_dropout=0.05,
task_type="CAUSAL_LM"
)
Fine-tuned models require multi-dimensional evaluation:
OpenAI, Anthropic, Google, and Together AI offer managed fine-tuning APIs. These are appropriate when you want to avoid infrastructure management and your data is not too sensitive to share with the provider. Self-hosted fine-tuning with tools like Axolotl, LLaMA-Factory, or Hugging Face TRL gives full control but requires GPU infrastructure and ML engineering expertise.
Sources: Hugging Face PEFT Documentation | QLoRA Paper | OpenAI Fine-Tuning Guide

Written by
Sagar Shankaran· Founder, CallSphere
LinkedInSagar 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.
When and how to fine-tune embeddings for your domain. The 2026 patterns, the cost-quality tradeoffs, and the open-source tooling.
Mispronouncing 'metformin' destroys caller trust in 30 seconds. Domain adaptation drops Word Error Rate 2–30 points in healthcare and legal. We cover ASR vocabulary biasing, TTS pronunciation lexicons, and acoustic LoRA for voice agents.
Real AI system design interview questions from Google, Meta, OpenAI, and Anthropic. Covers LLM serving, RAG pipelines, recommendation systems, AI agents, and more — with detailed answer frameworks.
Real LLM and RAG interview questions from top AI labs in 2026. Covers fine-tuning vs RAG decisions, production RAG pipelines, evaluation, PEFT methods, positional embeddings, and safety guardrails with expert answers.
Toll fraud and IRSF cost $40B+ globally in 2025. ML-driven SIP fraud detection now hits 98% accuracy, but only if you wire features from CDR, signaling, and per-tenant baselines into a real-time pipeline.
Real machine learning fundamentals interview questions from OpenAI, Google DeepMind, Meta, and xAI in 2026. Covers attention mechanisms, KV cache, distributed training, MoE, speculative decoding, and emerging architectures.
© 2026 CallSphere Inc. All rights reserved.
Made within San Francisco
Watch how CallSphere handles real customer calls, schedules appointments, and processes payments — live.