SFT FoundryPipeline Studio Live data preparation · browser-local

Supervised fine-tuning · explained end to end

Prepare examples for supervised fine-tuning—without hiding the machinery.

Upload a dataset in the browser, inspect the prepared result, then explore how a real run would apply completion-only masking, NF4 QLoRA, evaluation gates, and adapter deployment.

4 formatsCSV · XLSX · JSON · JSONL
2 task modesInstruction · structured output
Inspectable exportJSONL + preparation report
example_flow.preview deterministic
01
Raw recordtext + label
02
Chat templatesystem → user → assistant
03
Loss labels-100 · -100 · target tokens
04
Potential training outputadapter + measured metrics
Nothing uploadedSynthetic row only
GoalTeach a repeatable behavior

Format, task execution, style, or domain decision patterns.

FrozenBase-model weights

Stored in memory-efficient 4-bit NF4 during QLoRA training.

TrainableSmall LoRA adapters

Low-rank matrices learn the task-specific update.

Promoted only ifHeld-out evaluation passes

Lower training loss alone is never enough.

Live dataset lab

Upload a file. Prepare an inspectable SFT dataset.

Run ingestion, schema mapping, validation, deduplication, deterministic splitting and prompt formatting in your browser. Your file is never sent to a server.

Private by design

Processing happens locally in this browser tab. Closing the tab clears the working data.

No server upload
01
Input

Choose a dataset

Your prepared result appears here

Upload a file or load the sample, map its columns, then run validation.

  1. Schema and row checks
  2. Deterministic row split
  3. Messages + split metadata export

One record · eight transformations

Inspect the complete SFT journey

Select a stage. The same synthetic record stays in view so you can see exactly what changes, why it changes, and what can go wrong.

Stage 01 · Data contract Configured

01

Ingest semi-structured data

Load CSV, Excel, JSON, or JSONL. Map one or more text columns, optional metadata, labels, and an optional response column through configuration—not hard-coded schema assumptions.

Why it matters

The same pipeline can support social posts, support tickets, or evaluation logs by changing column mappings in one YAML file.

Common failure

Missing columns or silent type coercion. The implementation validates required columns and stops with an explicit error.

Synthetic input rowrow.json
Goes inCSV / XLSX / JSON / JSONL
Comes outValidated DataFrame

The most important training detail

The prompt gives context. The completion carries the loss.

Completion-only masking prevents the model from being rewarded for copying system and user text. Only the intended assistant response contributes to cross-entropy loss.

Context · ignored Completion · learned Boundary token
labels[token] = -100 for prompt · labels[token] = token_id for assistant completion CrossEntropyLoss ignores −100
01

Find the assistant marker

ChatML uses <|im_start|>assistant; Llama 3 uses its assistant header token sequence.

02

Mask every earlier token

System instructions, user context and padding become label -100.

03

Verify before training

Render one example and inspect labels. A wrong boundary can train on the prompt—or hide the answer.

Illustrative QLoRA profile

Memory-efficient by design

This reference profile pairs Qwen2.5-7B-Instruct with 4-bit NF4 and LoRA adapters. It explains a configuration; it is not a launched or benchmarked run.

TokensChatML sequence · max 2,048
TrainableLoRA adapters · BF16 computer 16 · α 32 · dropout 0.05
FrozenQwen2.5-7B-Instruct · NF4double quantization · SDPA attention
OutputTask-specific completion
ProfileDefault structured-output SFT
config.yaml
Micro batch4
Effective batch · one device16
Learning rate2e−4
ScheduleCosine · 3% warmup
Adapter targets
q_projk_projv_projo_projgate_projup_projdown_proj

Interactive controls preview configuration relationships only. They do not launch training or estimate memory, quality, time, or cost.

Reference architecture

Six responsibilities. One reproducibility contract.

A production implementation can separate configuration, data preparation, model loading, training, evaluation, and inference while versioning them together.

00config.yaml

Model, data contract, LoRA, training, generation and evaluation settings.

01dataset.py

Load, clean, split, template, tokenize and diagnose length distribution.

02model.py

Tokenizer, quantization, gradient checkpointing and PEFT adapters.

03trainer.py

SFTTrainer, completion-only labels, logging, checkpoints and safety callbacks.

04train.py

Seed, orchestrate, train, evaluate and save every artifact.

05inference.py

Generate, score, benchmark, merge adapters and export.

Promotion gate

Measure behavior, not just loss

A real evaluation run should calculate held-out generation metrics and add domain rubrics, safety regression tests, and direct base-versus-adapter comparison before promotion.

{ }
Structure

Exact match & schema validity

Did the output parse, follow the requested keys, and preserve required value types?

Aa
Task quality

Accuracy · macro / micro F1

For single-label structured outputs, compare predicted and target labels on unseen rows.

PPL
Language modeling

Perplexity

Useful for trend diagnosis, but lower perplexity does not prove factuality or safety.

ms
Operations

Average generation latency

Measure in the actual serving environment with the chosen quantization and batch shape.

Measured run status

No benchmark result has been fabricated for this demo.

The browser demo passed interaction and synthetic data-flow checks. No model training or benchmark run was executed.

Awaiting real run

Deployment outputs

Choose the artifact that fits the serving model

Adapters can stay separate for flexibility, or be merged into a compatible base model for a simpler serving artifact. Either route must preserve tokenizer and template identity.

Option A

Adapter-only

Small artifact. Load the licensed base model and task adapter together.

  • Flexible versioning
  • Multiple tasks per base
  • Requires PEFT-aware serving
Option B

Merged checkpoint

Combine LoRA deltas with a compatible higher-precision base checkpoint.

  • Simpler single-model serving
  • Larger artifact
  • Less adapter flexibility
Version together

Export manifest

base checkpointadapter weightstokenizerchat templategeneration configevaluation report

What a real project requires

Training starts after the governance work

A clean implementation cannot compensate for ambiguous labels, unauthorized data, weak evaluation, or an unowned production decision.

01

Data rights & privacy

Document license, consent, retention and sensitive-data removal.

02

Label contract

Define edge cases, reviewer agreement and the exact output schema.

03

Leakage-safe split

Group related sources before splitting; keep a final untouched test set.

04

Base-model license

Confirm intended use, redistribution and deployment obligations.

05

Evaluation ownership

Set pass/fail thresholds with domain and safety reviewers.

06

Monitoring & rollback

Version artifacts, observe regressions and retain a tested rollback path.

Plain-language answers

What clients usually ask

What does supervised fine-tuning actually change?

In this QLoRA setup, the quantized base weights remain frozen. Training updates small LoRA matrices attached to selected attention and MLP projections.

Can SFT teach the model new facts?

It can influence outputs, but SFT is strongest for stable behavior, format and task patterns. Frequently changing facts belong in retrieval or tools, not model weights.

Why not train on the full prompt?

The system and user turns provide context. Completion-only masking focuses the gradient on the response the model should learn, reducing waste and prompt memorization.

Does a lower evaluation loss mean the model is ready?

No. Loss is one diagnostic. Promotion also needs task metrics, format validity, human review, safety regressions, latency checks and base-model comparison.

What does the live dataset demo actually run?

It really parses, maps, validates, deduplicates, splits and formats your local file, then creates downloadable JSONL and diagnostics. It does not allocate GPU compute or claim that a model was fine-tuned.