hadilenya/AI-Trainer-Studio
🇬🇧 English | 🇹🇷 Türkçe Code & Programming Q&A — SFT Dataset A curated instruction-tuning dataset of 47,190 high-quality programming question-answer pairs, collected from StackOverflow and GitHub, cleaned through a multi-stage quality pipeline, and formatted in Alpaca style for supervised fine-tuning (SFT) of large language models. Dataset Summary Property Value Records 47,190 Format Alpaca (instruction / output / system)… See the full description on the dataset page: https://huggingface.co/datasets/hadilenya/AI-Trainer-Studio.
<p align="center"> <a href="#code--programming-qa--sft-dataset">🇬🇧 English</a> | <a href="#kod--programlama-soru-cevap--sft-veri-seti">🇹🇷 Türkçe</a> </p>
Code & Programming Q&A — SFT Dataset
A curated instruction-tuning dataset of 47,190 high-quality programming question-answer pairs, collected from StackOverflow and GitHub, cleaned through a multi-stage quality pipeline, and formatted in Alpaca style for supervised fine-tuning (SFT) of large language models.
Dataset Summary
Supported Tasks
- Supervised Fine-Tuning (SFT): Direct use with TRL
SFTTrainer, Unsloth, LLaMA-Factory, or Axolotl — no preprocessing required. - Instruction Following: Model learns to answer technical questions with explanation and code examples.
- Code Generation: 65%+ of records contain at least one code block in the output.
Data Collection
Sources
Data was collected using a custom async pipeline with the official StackOverflow API v2.3 and GitHub REST API v3.
StackOverflow Collection Rules
- Only questions with at least one accepted or upvoted answer were collected.
question_score + answer_scoreused as raw quality signal.- Questions tagged with target technology domains (SQL, Python, JavaScript, PHP, Shell, DevOps, TypeScript, System Design, WordPress).
- Collected answers: accepted answer preferred; fallback to highest-voted answer.
- API quota managed with exponential back-off on rate limits.
GitHub Collection Rules
- Issues and discussions with substantive responses only.
- Comment pagination handled to capture full thread context (100+ comment issues).
- Dismissal patterns filtered out ("please provide a repro", "closing as duplicate", etc.).
Processing Pipeline
Every raw record passes through a 4-stage pipeline before entering the dataset:
Raw API Response
│
▼
┌────────────────────────────────────┐
│ Stage 1: clean() │
│ • Whitespace normalization │
│ • Empty block removal │
│ • Within-record code dedup │ ← same code block repeated → keep first
└──────────────┬─────────────────────┘
│
▼
┌────────────────────────────────────┐
│ Stage 2: dedup() │
│ • SHA-256 hash of all content │
│ • Cross-record exact dedup │
└──────────────┬─────────────────────┘
│
▼
┌────────────────────────────────────┐
│ Stage 3: quality() │
│ • Fusion scoring (0–10) │
│ • signal_score (SO votes) │
│ • length_score (content size) │
│ • code_score (has code block) │
│ • Records < 5.0 dropped │
└──────────────┬─────────────────────┘
│
▼
┌────────────────────────────────────┐
│ Stage 4: Indexer filters │
│ • Link-only answers filtered │
│ • GitHub dismissal filtered │
│ • Content dedup (SHA-1 Q+A) │
└──────────────┬─────────────────────┘
│
▼
dataset.jsonlQuality Scoring Formula
Scores are on a 0–10 scale, computed as a weighted fusion:
When source signal exists (SO votes, GH reactions):
score = (0.6 × signal_score + 0.3 × length_score + 0.1 × code_score) × 10When no source signal (file sources):
score = (0.7 × length_score + 0.3 × code_score) × 10Where:
signal_score = min(1.0, log1p(raw_votes) / log1p(1000))— 1000 votes → 1.0, 100 votes → 0.67length_score = min(1.0, total_chars / 500)— 500+ chars → full scorecode_score = 1.0 if code present else 0.3
Only records with quality_score >= 5.0 are exported to this dataset.
Dataset Structure
Data Fields
Example Record
{
"id": "so_53927460",
"instruction": "How do I merge two dictionaries in a single expression in Python?\n\nI want to merge two dictionaries into a new dictionary. If both dicts have the same key, the second dict's value should take precedence.",
"output": "In Python 3.9+, you can use the merge operator:\n\n```python\nz = x | y\n```\n\nFor older Python versions:\n\n```python\nz = {**x, **y}\n```\n\nThis creates a new dictionary. Values from `y` overwrite values from `x` when keys overlap.",
"system": "",
"technology": "python",
"quality_score": 9.87,
"source": "stackoverflow",
"meta": {
"tier": "medium",
"total_tokens": 312
}
}Tier Distribution
The meta.tier field classifies records by approximate token length, designed for hardware-aware SFT sampling:
Technology Distribution
Quality Distribution
Usage
Load with 🤗 Datasets
from datasets import load_dataset
ds = load_dataset("hadilenya/AI-Trainer-Studio", split="train")
print(ds[0])SFT with TRL
from datasets import load_dataset
from trl import SFTTrainer, SFTConfig
ds = load_dataset("hadilenya/AI-Trainer-Studio", split="train")
def formatting_func(example):
return f"### Instruction:\n{example['instruction']}\n\n### Response:\n{example['output']}"
trainer = SFTTrainer(
model=model,
train_dataset=ds,
formatting_func=formatting_func,
args=SFTConfig(max_seq_length=2048, ...),
)
trainer.train()Mistral / Llama-3 Chat Format
def to_mistral(example):
return f"<s>[INST] {example['instruction']} [/INST] {example['output']}</s>"
def to_llama3(example):
return (
f"<|begin_of_text|>"
f"<|start_header_id|>user<|end_header_id|>\n{example['instruction']}<|eot_id|>"
f"<|start_header_id|>assistant<|end_header_id|>\n{example['output']}<|eot_id|>"
)Hardware-Aware Sampling (with meta.tier)
# RTX 2060 (6GB) — VRAM-safe sampling
short = ds.filter(lambda x: x["meta"]["tier"] == "short")
medium = ds.filter(lambda x: x["meta"]["tier"] == "medium")
deep = ds.filter(lambda x: x["meta"]["tier"] == "deep_reasoning")
# Ratio: short 60% · medium 35% · deep 5%
from datasets import concatenate_datasets
n = 8000
sampled = concatenate_datasets([
short.shuffle(seed=42).select(range(min(int(n*0.60), len(short)))),
medium.shuffle(seed=42).select(range(min(int(n*0.35), len(medium)))),
deep.shuffle(seed=42).select(range(min(int(n*0.05), len(deep)))),
])Filter by Technology
python_ds = ds.filter(lambda x: x["technology"] == "python")
sql_ds = ds.filter(lambda x: x["technology"] == "sql")Filter by Quality
# High quality only (≥ 7.0 — 69.4% of dataset)
high_quality = ds.filter(lambda x: x["quality_score"] >= 7.0)Data Splits
This dataset is released as a single train split. For training, we recommend creating your own train/validation/test split:
split = ds.train_test_split(test_size=0.08, seed=42)
train_ds = split["train"]
eval_ds = split["test"]Limitations & Considerations
- Language: All records are in English. Not suitable for multilingual fine-tuning without translation.
- Source bias: 99.8% StackOverflow — answers reflect Stack Overflow community norms (concise, code-first).
- Time range: Data collected in 2026. May not reflect very recent library versions or deprecations.
- Domain scope: Focused on web development, scripting, databases, and DevOps. Not suitable for domain-specific fine-tuning in medicine, law, finance, etc.
- Code correctness: Code blocks are sourced from community answers. While high-vote answers are generally correct, no automated code execution or test verification was performed.
- GitHub records (0.2%): Very small fraction — 70 records from GitHub Issues. Treat as supplementary.
License
This dataset is released under the Creative Commons Attribution 4.0 (CC BY 4.0) license.
StackOverflow content is licensed under CC BY-SA 4.0. Attribution is preserved via the id field (e.g., so_12345678 links to https://stackoverflow.com/q/12345678).
Citation
If you use this dataset in your research or project, please cite:
@dataset{code_qa_sft_2026,
title = {Code \& Programming Q\&A — SFT Dataset},
author = {Muharrem},
year = {2026},
publisher = {HuggingFace},
url = {https://huggingface.co/datasets/hadilenya/AI-Trainer-Studio}
}Changelog
Kod & Programlama Soru-Cevap — SFT Veri Seti
<p align="right"><a href="#code--programming-qa--sft-dataset">⬆️ Back to English</a></p>
StackOverflow ve GitHub'dan derlenen, çok aşamalı bir kalite boru hattından geçirilmiş 47.190 yüksek kaliteli programlama soru-cevap çiftinden oluşan, büyük dil modellerinin ince ayarı (SFT) için Alpaca formatında hazırlanmış bir veri setidir.
Özet
Veri Toplama
Kaynaklar
Veriler, özel bir asenkron pipeline ile StackOverflow API v2.3 ve GitHub REST API v3 üzerinden toplanmıştır.
StackOverflow Toplama Kuralları
- Yalnızca kabul edilmiş veya yüksek oy almış en az bir cevabı olan sorular alındı.
soru_oyu + cevap_oyutoplamı ham kalite sinyali olarak kullanıldı.- Hedef teknoloji etiketleri: SQL, Python, JavaScript, PHP, Shell, DevOps, TypeScript, Sistem Tasarımı, WordPress.
- Önce kabul edilmiş cevap; yoksa en yüksek oylanan cevap.
- Rate limit aşımlarında üstel geri çekilme (exponential back-off) ile kota yönetimi.
GitHub Toplama Kuralları
- Yalnızca gerçek içerik barındıran yanıtlı issue ve tartışmalar.
- 100+ yorum içeren issue'larda sayfalama ile tam içerik çekildi.
- "Lütfen repro ekleyin", "duplicate olarak kapatılıyor" gibi reddedici kalıplar otomatik filtrelendi.
İşleme Boru Hattı
Her ham kayıt veri setine girmeden önce 4 aşamalı bir pipeline'dan geçer:
Ham API Yanıtı
│
▼
┌────────────────────────────────────┐
│ Aşama 1: clean() │
│ • Boşluk normalleştirme │
│ • Boş blok temizleme │
│ • Kayıt içi kod bloğu dedup │ ← aynı blok tekrar ediyorsa ilki korunur
└──────────────┬─────────────────────┘
│
▼
┌────────────────────────────────────┐
│ Aşama 2: dedup() │
│ • SHA-256 içerik hash'i │
│ • Kayıtlar arası tam eşleşme │
└──────────────┬─────────────────────┘
│
▼
┌────────────────────────────────────┐
│ Aşama 3: quality() │
│ • Füzyon skoru (0–10) │
│ • signal_score (SO oyu) │
│ • length_score (içerik uzunl.) │
│ • code_score (kod bloğu var?) │
│ • 5,0 altı kayıtlar elenir │
└──────────────┬─────────────────────┘
│
▼
┌────────────────────────────────────┐
│ Aşama 4: İndeksleyici filtresl.│
│ • Sadece link olan cevap elenir│
│ • GitHub reddedici yorum elenir│
│ • İçerik dedup (SHA-1 S+C) │
└──────────────┬─────────────────────┘
│
▼
dataset.jsonlKalite Skoru Formülü (0–10)
Kaynak sinyali varsa (SO oyu, GH reaksiyonu):
skor = (0,6 × sinyal_skoru + 0,3 × uzunluk_skoru + 0,1 × kod_skoru) × 10Kaynak sinyali yoksa:
skor = (0,7 × uzunluk_skoru + 0,3 × kod_skoru) × 10sinyal_skoru = min(1,0, log1p(ham_oy) / log1p(1000))— 1000 oy → 1,0 · 100 oy → 0,67uzunluk_skoru = min(1,0, toplam_karakter / 500)— 500+ karakter → tam puankod_skoru = 1,0 (kod varsa) | 0,3 (kod yoksa)
Yalnızca kalite_skoru >= 5,0 olan kayıtlar dışa aktarılır.
Veri Seti Yapısı
Alanlar
Kademe (Tier) Dağılımı
meta.tier alanı, donanıma göre akıllı örnekleme için kayıtları uzunluklarına göre sınıflandırır:
Kalite Dağılımı
Teknoloji Dağılımı
Kullanım
🤗 Datasets ile Yükleme
from datasets import load_dataset
ds = load_dataset("hadilenya/AI-Trainer-Studio", split="train")
print(ds[0])TRL ile SFT Eğitimi
from datasets import load_dataset
from trl import SFTTrainer, SFTConfig
ds = load_dataset("hadilenya/AI-Trainer-Studio", split="train")
def formatting_func(example):
return f"### Instruction:\n{example['instruction']}\n\n### Response:\n{example['output']}"
trainer = SFTTrainer(
model=model,
train_dataset=ds,
formatting_func=formatting_func,
args=SFTConfig(max_seq_length=2048, ...),
)
trainer.train()Donanıma Göre Örnekleme (meta.tier ile)
# RTX 2060 (6 GB VRAM) — güvenli örnekleme
short = ds.filter(lambda x: x["meta"]["tier"] == "short")
medium = ds.filter(lambda x: x["meta"]["tier"] == "medium")
deep = ds.filter(lambda x: x["meta"]["tier"] == "deep_reasoning")
# Oran: short %60 · medium %35 · deep %5
from datasets import concatenate_datasets
n = 8000
sampled = concatenate_datasets([
short.shuffle(seed=42).select(range(min(int(n*0.60), len(short)))),
medium.shuffle(seed=42).select(range(min(int(n*0.35), len(medium)))),
deep.shuffle(seed=42).select(range(min(int(n*0.05), len(deep)))),
])Teknoloji veya Kaliteye Göre Filtreleme
python_ds = ds.filter(lambda x: x["technology"] == "python")
yuksek_kal = ds.filter(lambda x: x["quality_score"] >= 7.0)Kısıtlamalar
- Dil: Tüm kayıtlar İngilizce'dir. Çok dilli ince ayar için çeviri gerekir.
- Kaynak yanlılığı: %99,8 StackOverflow — cevaplar SO topluluğu normlarını yansıtır (özlü, kod öncelikli).
- Zaman aralığı: Veriler 2026 yılında toplandı. Çok yeni kütüphane sürümleri veya kullanımdan kalkmış API'lar yansıtılmayabilir.
- Kapsam: Web geliştirme, betik yazımı, veritabanları ve DevOps odaklıdır. Tıp, hukuk, finans gibi uzmanlık alanları için uygun değildir.
- Kod doğruluğu: Kod blokları topluluk cevaplarından alınmıştır. Yüksek oylu cevaplar genellikle doğru olsa da otomatik kod çalıştırma veya test doğrulaması yapılmamıştır.
Lisans
Bu veri seti Creative Commons Attribution 4.0 (CC BY 4.0) lisansı altında yayımlanmıştır.
StackOverflow içeriği CC BY-SA 4.0 kapsamındadır. Atıf, id alanı aracılığıyla korunmaktadır (örn. so_12345678 → https://stackoverflow.com/q/12345678).
