CoolFace
Datasetpublic

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.

sourceHugging Facecc-by-4.0updated 4mo agoView on Hugging Face
0likes74downloads
Dataset Card

<p align="center"> <a href="#code--programming-qa--sft-dataset">🇬🇧 English</a> &nbsp;|&nbsp; <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

PropertyValue
Records47,190
FormatAlpaca (instruction / output / system)
Total tokens~23.0 Million
Avg tokens / record486
Min quality score5.00 / 10
Avg quality score7.71 / 10
High quality (≥ 7.0)31,486 records (66.7%)
Primary languageEnglish
Primary sourceStackOverflow (99.8%)

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

SourceRecords%
StackOverflow (via API)47,11999.8%
GitHub Issues / Discussions710.2%

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_score used 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.jsonl

Quality 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) × 10

When no source signal (file sources):

score = (0.7 × length_score + 0.3 × code_score) × 10

Where:

  • —signal_score = min(1.0, log1p(raw_votes) / log1p(1000)) — 1000 votes → 1.0, 100 votes → 0.67
  • —length_score = min(1.0, total_chars / 500) — 500+ chars → full score
  • —code_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

FieldTypeDescription
idstringUnique record identifier (source-prefixed, e.g. so_12345678)
instructionstringThe question / prompt (from user role)
outputstringThe answer with optional code blocks in markdown
systemstringSystem prompt — always empty string "" in this dataset
technologystringDomain label: python, sql, javascript, php, shell_scripting, devops, typescript, system_design, wordpress
quality_scorefloatQuality score 5.01–10.0
sourcestringData source: stackoverflow or github
meta.tierstringComplexity tier: short, medium, or deep_reasoning
meta.total_tokensintApproximate token count (chars / 4)

Example Record

json
{
  "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:

TierToken RangeRecords%Purpose
short0–256 tokens15,58233.0%Quick Q&A, definitions
medium256–768 tokens24,42151.8%Explained answers with code
deep_reasoning768+ tokens7,18715.2%Complex multi-step solutions

Technology Distribution

TechnologyRecords
SQL8,730
Shell Scripting8,355
Python7,540
PHP6,377
JavaScript6,058
System Design4,429
DevOps3,255
TypeScript1,909
WordPress537

Quality Distribution

Score RangeRecords%
9.0 – 10.08,66618.4%
7.0 – 9.022,82048.4%
5.0 – 7.015,70433.3%

Usage

Load with 🤗 Datasets

python
from datasets import load_dataset

ds = load_dataset("hadilenya/AI-Trainer-Studio", split="train")
print(ds[0])

SFT with TRL

python
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

python
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)

python
# 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
python_ds = ds.filter(lambda x: x["technology"] == "python")
sql_ds    = ds.filter(lambda x: x["technology"] == "sql")

Filter by Quality

python
# 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:

python
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:

bibtex
@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

VersionDateDescription
v1.02026-05-17Initial release — 47,190 records, Alpaca format, meta.tier annotation


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

ÖzellikDeğer
Kayıt sayısı47.190
FormatAlpaca (instruction / output / system)
Toplam token~23,0 Milyon
Ortalama token / kayıt486
Min kalite skoru5,00 / 10
Ort kalite skoru7,71 / 10
Yüksek kalite (≥ 7,0)31.486 kayıt (%66,7)
Ana dilİngilizce
Ana kaynakStackOverflow (%99,8)

Veri Toplama

Kaynaklar

KaynakKayıt%
StackOverflow (resmi API v2.3)47.119%99,8
GitHub Issues / Discussions71%0,2

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_oyu toplamı 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.jsonl

Kalite 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) × 10

Kaynak sinyali yoksa:

skor = (0,7 × uzunluk_skoru + 0,3 × kod_skoru) × 10
  • —sinyal_skoru = min(1,0, log1p(ham_oy) / log1p(1000)) — 1000 oy → 1,0 · 100 oy → 0,67
  • —uzunluk_skoru = min(1,0, toplam_karakter / 500) — 500+ karakter → tam puan
  • —kod_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

AlanTürAçıklama
idstringBenzersiz kayıt kimliği (örn. so_12345678)
instructionstringSoru / prompt (kullanıcı rolünden)
outputstringMarkdown içinde opsiyonel kod bloklarıyla cevap
systemstringSistem prompt'u — bu veri setinde her zaman boş ""
technologystringDomain etiketi: python, sql, javascript, php, shell_scripting, devops, typescript, system_design, wordpress
quality_scorefloatKalite skoru 5,01–10,0
sourcestringKaynak: stackoverflow veya github
meta.tierstringKarmaşıklık kademesi: short, medium, deep_reasoning
meta.total_tokensintYaklaşık token sayısı (karakter / 4)

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:

KademeToken AralığıKayıt%Temsil Ettiği İçerik
short0–256 token15.582%33,0Kısa S&C, tanımlar
medium256–768 token24.421%51,8Kodlu açıklamalı cevaplar
deep_reasoning768+ token7.187%15,2Karmaşık çok adımlı çözümler

Kalite Dağılımı

Skor AralığıKayıt%
9,0 – 10,08.666%18,4
7,0 – 9,022.820%48,4
5,0 – 7,015.704%33,3

Teknoloji Dağılımı

TeknolojiKayıt
SQL8.730
Shell Scripting8.355
Python7.540
PHP6.377
JavaScript6.058
Sistem Tasarımı4.429
DevOps3.255
TypeScript1.909
WordPress537

Kullanım

🤗 Datasets ile Yükleme

python
from datasets import load_dataset

ds = load_dataset("hadilenya/AI-Trainer-Studio", split="train")
print(ds[0])

TRL ile SFT Eğitimi

python
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)

python
# 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
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).


Değişiklik Günlüğü

SürümTarihAçıklama
v1.017 Mayıs 2026İlk yayın — 47.190 kayıt, Alpaca format, meta.tier anotasyonu