본문으로 건너뛰기
Skillpedia
머신러닝41k · #6729

dataset-curation

하는 일

이 도구는 AI 모델 학습을 위해 원본 데이터를 정리하고 준비합니다. 데이터가 올바른 형식이고, 잘 정리되어 있으며, 성공적인 학습을 위해 검증되었는지 확인합니다.

사용하는 경우

  • ✓원본 데이터가 있고 AI가 학습할 수 있는 형식으로 바꿔야 할 때.
  • ✓AI가 만든 데이터를 실제 데이터와 섞어 학습을 개선할 때.
  • ✓AI 모델 학습을 시작하기 전에 데이터가 준비되었는지 확인할 때.

스킬 링크

https://github.com/wshobson/agents/blob/main/plugins/llm-finetuning/skills/dataset-curation/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/wshobson/agents/blob/main/plugins/llm-finetuning/skills/dataset-curation/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“메시지 형식을 사용해 채팅 모델을 학습시키도록 대화 데이터를 준비해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

도구는 선택한 학습 방식(대화 또는 프롬프트/응답 쌍 등)에 맞게 데이터 형식을 맞춥니다. 또한 AI가 중요한 응답만 학습하고 낭비되는 처리를 피하도록 데이터를 정리합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Dataset Curation

This skill assumes finetuning-method-selection already routed here — the next step is preparing data, not choosing a method. What follows: format selection by target method, the template/packing mechanics behind the most common silent training failures, rules for mixing in synthetic data without collapse, and the dataset card that closes out Phase 2 before a run starts.

Input: raw examples (demonstrations, preference judgments, or task prompts) plus a routing decision from finetuning-method-selection. Output format: a formatted, packed, validated JSONL dataset plus a completed dataset card — the Phase 2 artifact /finetune checks before launching training.

Format Selection

Method Shape Rows
SFT, single-turn Instruct (instruction/response or prompt/completion) ~1,000+ floor
SFT, multi-turn Conversation / ChatML messages list ~1,000+ floor
DPO / ORPO Preference pair (prompt, chosen, rejected) Method-dependent, see preference-optimization
KTO Unpaired (prompt, completion, label) Method-dependent, see preference-optimization
GRPO / RLVR Prompt-only (prompt + verifier metadata) Method-dependent, see grpo-rlvr-training
  • ~1,000+ rows is the recommended floor for SFT, not a target. Below it, a handful of low-quality or duplicate examples can dominate the gradient; above it, quality over quantity — a smaller verified, deduplicated set beats a larger noisy one.

  • The ChatML shape, for orientation; the other four formats plus a ShareGPT conversion note live in references/formats-and-templates.md:

    {"messages": [
      {"role": "user", "content": "..."},
      {"role": "assistant", "content": "..."}
    ]}
    

Chat Templates and Loss Masking

Apply the target model's chat template before any concatenation or packing, never after — packing raw text and templating the packed blob afterward corrupts turn boundaries, landing role markers in the wrong place relative to each example.

  • Train on assistant responses only. Mask the loss (-100 in the labels tensor) over system/user turns and the template's own role markers — only assistant-turn content tokens contribute to loss.

  • Template/tokenizer mismatches are a top silent failure mode. A model trained against one chat template but served or evaluated with a different one degrades without erroring. Verify the same template string used in training is applied at inference and eval time.

  • Keep the dataset in messages shape and let the trainer template and mask it (assistant_only_loss=True in current TRL) — pre-rendering to a flat text field destroys the turn boundaries masking needs. Full code sketch: references/formats-and-templates.md. Sanity-check before training — decode only unmasked positions; expect only assistant text:

    keep = batch["labels"][0] != -100
    print(tokenizer.decode(batch["input_ids"][0][keep]))
    

Packing

Without packing, 40–70% of compute is spent on padding — variable-length examples batched at a fixed sequence length waste the gap between each example's length and the batch's max. Packing concatenates multiple examples into one sequence up to the max length, cutting most of that waste.

  • Packing changes batch semantics. A packed sequence can contain several original examples, so "steps per epoch" and any LR schedule keyed to example count shift once packing is on — recompute schedule milestones against packed-sequence count.

  • MANDATORY: decode and manually inspect 5–10 packed sequences before scaling to a full run. Confirm example boundaries land where expected, template markers are intact per sub-example, and the loss mask is still assistant-only within each packed sequence. Not optional — packing bugs are silent (the loss curve looks normal) and only surface in eval quality, hours later:

    for seq in packed_dataset.select(range(10)):
        print(tokenizer.decode(seq["input_ids"]))
    

Synthetic Data Rules

  • Keep ≥25% real data as a collapse guard. Training on a growing share of model-generated data without a real-data floor drives measurable quality collapse over successive generations — 25% real is the minimum that holds the line. General-domain replay rows count toward this floor — "real" means "not generated for this task from this

…

자주 묻는 질문

'패킹'이란 무엇인가요?

여러 학습 예시를 하나의 시퀀스로 묶어 처리 능력을 더 효율적으로 쓰는 기법입니다. 빈 공간으로 인한 낭비를 줄입니다.

AI가 만든 데이터를 쓰는데 왜 실제 데이터도 보관해야 하나요?

실제 데이터를 최소 25% 유지하면 AI 모델의 품질이 시간이 지나며 떨어지는 것을 막고, 신뢰할 수 있는 출처에서 계속 배우도록 도와줍니다.

'데이터셋 카드'란 무엇인가요?

AI 학습에 쓰인 데이터의 출처, 양, 특징을 자세히 적은 문서입니다. 투명성과 추적 가능성을 보장합니다.

상세 정보

작성자의 원본 설명

Prepare, format, and validate datasets for supervised fine-tuning and preference training. Use when converting raw data into training format, applying chat templates, configuring sequence packing, generating synthetic training data, or writing a dataset card before a run.

repo: wshobson/agents

인기도

GitHub 스타
41k
순위
#6729
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬