AboutWorkProjectsNotes
PT

say hi

 © 2026

  • SAPSAPSoftware Developer
    • Fine-tuning
      • The problem
      • What I built
      • The data
      • Before → after
      • Serving
      • Shipping
      • More
    • Agents & knowledge graph
    • Long-context training data
  • MiHINMiHINSoftware Engineer

SAPSAPLLM · 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
90s →
11s
p95 latency
10×
cheaper inference
98%
classification accuracy
3×
throughput on the same GPU
01

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.

02

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.

idle
vLLM · one GPUChange recordPreprocessdeterministicExtract adapterQLoRA · R1 14BClassify adapterQLoRA · R1 14BDecisionAccept / rejectHANAORPO tuning

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

03

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.
04

Where the 79 seconds went.

Drag the playhead, or press Replay, to compare both pipelines at the same moment in time.

beforegpt · hop 1
gpt · hop 1
gpt · hop 2
gpt · hop 3
after✓ done
preprocess
extract adapter
classify adapter
12.6s
old finishes at 90.0s · new at 11.0sp95 totals are real. The split between steps is illustrative.
05

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.

serve.py · simplified
1from vllm import LLM, SamplingParams
2from vllm.lora.request import LoRARequest
3
4llm = LLM(model="deepseek-r1-14b",
5 enable_lora=True, max_loras=2,
6 gpu_memory_utilization=0.92)
7
8extract = LoRARequest("extract", 1, EXTRACT_PATH)
9classify = LoRARequest("classify", 2, CLASSIFY_PATH)
10
11params = SamplingParams(max_tokens=budget(record),
12 stop=["</answer>"])

line 4One base model, loaded once.

06

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.
07

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
    Read the story
  • 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
    Read the story
next case studySAP · Letting agents write to systems that matter.