Skip to content

Prompt Versioning ve A/B Testing

Üretimdeki promptları yazılım kodu gibi yönetmek. Sürüm kontrolü, A/B testleri, performans ölçümü.

Şükrü Yusuf KAYA
9 min read
Advanced
Prompt Versioning ve A/B Testing

Promptlar = Kod gibi yönetilmeli#

LLM'i ürüne entegre ettikten sonra promptlar yaşayan birer kod parçası olur. Hata, iyileştirme, geriye uyum — yazılım disiplini gerekir.
5 alışkanlık:
  1. Version control — git'e koy
  2. Semantic versioning — v1.0.0, v1.1.0
  3. A/B testing — yeni versiyonu trafiğin %10'una ver
  4. Metrics — kalite, hata oranı, kullanıcı memnuniyeti
  5. Rollback plan — kötüye giderse hızlı geri al
yaml
# prompts/customer-support.yaml
metadata:
name: customer_support_bot
version: "1.4.2"
author: "yusuf@sukruyusufkaya.com"
changelog:
"1.0.0": Initial release (2026-01-15)
"1.1.0": Added "be more concise" instruction (2026-02-03)
"1.2.0": Added prompt injection defense (2026-02-15)
"1.3.0": Switched to JSON output (2026-03-01)
"1.4.0": Added Turkish-specific tone guidance (2026-04-10)
"1.4.1": Fixed: model was being overly formal (2026-04-12)
"1.4.2": Tweak: pasif/aktif voice balance (2026-04-22)
 
system_prompt: |
Sen bir teknik destek asistanısın.
...
 
variables:
- name: customer_tier
type: enum
values: [free, plus, pro, enterprise]
description: Müşterinin abonelik seviyesi
 
- name: history
type: array
description: Önceki sohbet geçmişi (son 5 mesaj)
 
response_format:
type: json_schema
schema_path: ./schemas/support_response.json
 
evaluation:
test_cases: ./tests/customer_support.jsonl
metrics:
- accuracy
- tone_match
- safety_violations
thresholds:
accuracy: ">= 0.92"
tone_match: ">= 4.0/5"
safety_violations: "== 0"
Üretim promptu için YAML formatı — versiyon, değişkenler, test referansları.
💡 A/B Test Stratejisi
Yeni prompt versiyonunu trafiğin %10'una ver, %90'ına eski. 7 gün sonra metrikler karşılaştır: response quality (1-5), task completion %, user satisfaction (👍/👎). Yenisi en az %3 iyiyse geçiş yap; eşit ise tut; kötüyse rollback.
javascript
// Basit A/B router
async function getPromptVersion(userId) {
// Hash-based deterministic routing — aynı kullanıcı hep aynı versiyona düşer
const hash = simpleHash(userId);
const bucket = hash % 100;
 
if (bucket < 10) {
return "v2.0.0-beta"; // %10 trafik
} else {
return "v1.4.2"; // %90 trafik
}
}
 
async function answerCustomer(userId, question) {
const version = await getPromptVersion(userId);
const prompt = await loadPrompt(version);
const response = await callLLM(prompt, question);
 
// Telemetri kaydet
await logTelemetry({
userId,
promptVersion: version,
questionLength: question.length,
responseLength: response.length,
timestamp: Date.now(),
});
 
return response;
}
Hash-tabanlı A/B routing — deterministik, sticky.
  • Latency (ms) — yanıt süresi
  • Token cost ($) — adımına başına maliyet
  • Format compliance (%) — schema'ya uyum oranı
  • Length adherence — istenen uzunlukta mı
  • Hallucination flags — bilinen gerçeklerle çelişki

Bu derste neler öğrendik?#

✓ Promptlar = kod gibi yönetilmeli (git, semver, changelog) ✓ A/B testing trafik bölme + metrik karşılaştırma ✓ 3 metrik kategorisi: otomatik, insan, kullanıcı ✓ Rollback planı her zaman hazır
Modül 4 tamamlandı 🎉 — Sıradaki: Modül 5 (Yazma ve İçerik Üretimi).

Yorumlar & Soru-Cevap

(0)
Yorum yazmak için giriş yap.
Yorumlar yükleniyor...

Related Content

Connected pillar topics

Pillar topics this article maps to