SAPLLM · 2026
Replacing a GPT pipeline with models we own.
A three-hop external GPT chain was slow, expensive, and sent customer data outside our walls. I replaced it with two small fine-tuned models that run on one GPU.
- Company
- SAP
- Team
- Research & Innovation
- Role
- Software Developer
- Timeline
- Jan 2026 – Present
- 11s
- p95 latency
- 10×
- cheaper inference
- 98%
- classification accuracy
- 3×
- throughput on the same GPU
Three GPT calls, one slow answer.
Change records were classified by chaining three calls to an external GPT model. Each hop waited on the last, errors compounded, and p95 latency sat around 90 seconds.
Worse, every call sent customer configuration data to a third party. For sovereignty-sensitive customers that was a hard blocker.
Two small models that each do one job.
I split the work into single-task adapters on one open-weight base model, and moved normalization into deterministic code. Toggle between the old and new pipeline, click any step, or press Run to watch a request go through at relative speed.
Extract adapterQLoRA · R1 14B~4.1s
A single-task QLoRA adapter on DeepSeek-R1 14B. Chain-of-thought is cut at the stop token once a valid answer appears.
Click any step for details · Run plays a request at relative speed
The data was the unlock, not the model.
Distilling from a bigger teacher hit a ceiling below human accuracy. The teacher's labels were confidently wrong in ways the student copied.
- Benchmarked four basesDeepSeek-R1, Qwen 2.5, Gemma and Phi-2 on accuracy and inference footprint. R1 won on reasoning quality.
- A 4,000-row gold setHuman-labeled examples replaced teacher labels and lifted held-out accuracy to 98%.
- ORPO over DPODPO caused catastrophic forgetting in post-launch tuning. ORPO, done in training, didn't.
Where the 79 seconds went.
Drag the playhead, or press Replay, to compare both pipelines at the same moment in time.
Serving it on one smaller GPU.
vLLM with PagedAttention cut KV-cache waste by about 60% and tripled sustained throughput, so both adapters fit on one instance instead of scaling out. Hover the highlighted lines.
1from vllm import LLM, SamplingParams2from vllm.lora.request import LoRARequest34llm = LLM(model="deepseek-r1-14b",5enable_lora=True, max_loras=2,6gpu_memory_utilization=0.92)78extract = LoRARequest("extract", 1, EXTRACT_PATH)9classify = LoRARequest("classify", 2, CLASSIFY_PATH)1011params = SamplingParams(max_tokens=budget(record),12stop=["</answer>"])
Shipping it like software.
Models are only useful if you can roll them forward and back safely.
- GitOps deploysDocker, ArgoCD and KServe on SAP BTP, with S3 model versioning and database-backed lineage.
- 10+ model versionsReproducible rollouts, each traceable to its data and config.
- A feedback loopEvery tool call, output and human decision is stored, which feeds the next round of tuning.
More from SAP.
Other things I built here, in short.
Agents over MCP, and a knowledge graph to ground them
1.5 days→5 min- cross-system update
- −92%
- developer query time
FastMCP tool-calling agents now make a cross-system update that used to take a day and a half. Entity-level locking keeps concurrent writes safe, and 5-hop OAuth means every write traces back to a verified user.
A knowledge-graph RAG service (RDF and SPARQL) answers questions for 5,000+ developers, served over MCP with PKCE auth and OpenTelemetry tracing.
- FastMCP
- RDF / SPARQL
- OAuth + PKCE
- OpenTelemetry
Training on agent runs too long to fit
65%→80.8%- agent pass rate
16K→63K- longest sample trained
A long-context SFT pipeline for Gemma-4-12B, built from real software-engineering agent runs that were 50K–100K+ tokens long.
Two levers fit them under budget: compaction, with Kimi summarizing what no longer fits, and sequence parallelism across eight B200s. CAP-Bench can now evaluate the hosted model.
- Gemma-4-12B
- Kimi
- SageMaker
- LiteLLM
- OpenHands