ladderlore
  • S3 や IAM などのサービス名を入力してください。

概念 · AIF-C01 の発展

Data for fine-tuning, continued pre-training and distillation

JSONL formats for fine-tuning, continued pre-training and distillation, and how to split and store them.

このレッスンはまだ翻訳されていないため、英語で表示しています。

AI Practitionerで学んだこと

  • Fine-tuning data should be curated, labeled and representative.
  • Quality counts more than size.
  • Data governance covers what you may use.
AI Practitionerのレッスンを読む
  • Fine-tuning

    Data
    Labeled prompt and answer
    Format
    JSONL prompt, completion
  • Fine-tuning, chat models

    Data
    Conversations
    Format
    JSONL messages by role
  • Continued pre-training

    Data
    Unlabeled domain text
    Format
    JSONL input text
  • Distillation

    Data
    Prompts or logs
    Format
    JSONL or invocation logs
Four goals and the data each needs.
Collect
Clean
Format
Split
S3
  1. 1Collect data you may use.
  2. 2Remove duplicates, empty records and errors.
  3. 3Write each record as a JSON line in the right format.
  4. 4Hold out a validation set, then upload to S3.
From raw data to files in S3.

流れ

  1. 1Collect data you may use.
  2. 2Remove duplicates, empty records and errors.
  3. 3Write each record as a JSON line in the right format.
  4. 4Hold out a validation set, then upload to S3.

From raw data to files in S3.

概要

Bedrock customization reads JSON Lines files in S3: one JSON object per line. Fine-tuning for text models uses prompt and completion pairs, for example {"prompt": "...", "completion": "..."}. Some models, such as Amazon Nova, use a conversation format: a messages list with system, user and assistant turns, as in the Converse API. Continued pre-training uses unlabeled text, one record per line with an input field, to teach a model a domain: it needs lots of raw domain text rather than labeled pairs. Check the data format page for the exact fields of the model you use.

概要

Distillation trains a small student model from a large teacher. You supply prompts only, or use the invocation logs that Bedrock stored in S3 for the teacher model. With prompts only, Bedrock generates the teacher responses. If your invocation logs already hold responses from the same teacher model, Bedrock reuses them and skips regeneration. If the logged model is different, the logged responses are not used. You need at least 100 prompts and at most 15,000. Bedrock then fine-tunes the student on the responses. Turn on model invocation logging first, and filter the logs by metadata to pick the prompts you want.

概要

Quality rules apply to all of them. Remove duplicates, empty or broken records and wrong answers. Keep the style and length of the data like real use. Hold out a validation set from the same source as training, and a separate test set for evaluation. Store files in S3 in the same Region, and give the Bedrock service role read access to the training prefix and write access to the output prefix.

覚えること

  • JSONL: one JSON object per line, in S3.
  • Fine-tuning: prompt and completion pairs, or a messages conversation for some models.
  • Continued pre-training: unlabeled domain text, an input field per line.
  • Distillation: prompts only, or invocation logs from the teacher model.

覚えること

  • Clean, deduplicate and hold out a validation set.
  • The Bedrock service role needs S3 read and write access.

試験では

  • “Teach a model the vocabulary of a field using unlabeled documents” points to continued pre-training.
  • “Build a smaller, cheaper model from a large model’s answers” points to distillation, with invocation logs or prompts.
  • “Labeled question and answer pairs for a task” points to fine-tuning with prompt and completion data.