{"slug": "castform-now-supports-supervised-finetuning", "title": "Castform now supports supervised finetuning", "summary": "Castform, the AI training platform from Benchmax, has added supervised finetuning (SFT) support, enabling developers to post-train models via next-token prediction on demonstration data. In a demonstration, a Qwen3.5-4B model finetuned on just 3,000 examples from the OpenPII 1M dataset reduced PII leak rate from 40% to 3.4% with 0.998 precision, outperforming an untrained frontier model on a held-out validation set.", "body_md": "today we’re adding supervised finetuning to castform.\n\nour goal’s to give developers everything necessary to post-train models for their tasks. reinforcement learning is all the rage these days (and castform makes it super easy to use), but supervised finetuning remains one of the most compute-efficient ways to teach a model exactly how you want it to behave.\n\nwhile rl learns from a score/reward, sft learns from correct demonstration. specifically, we train the model via next-token prediction to replicate tokens in the demonstration exactly.\n\n## why sft\n\nsft is particularly useful in cases where you have clear expert outputs & ground truths. it’s also much cheaper to run than rl.\n\nsome use-cases:\n\n**classification and structured extraction.** examples include routing, intent classification, field extraction. there is a clear correct answer & you likely have 1000s of labeled samples. finetuning a small model will help you match a much larger one, at a fraction of the cost & latency.**distillation from a larger model.** generate traces from a frontier model on your task, then train a smaller one on them. for simpler tasks, you can match quality and get a model that’s cheaper to serve and fast enough to sit in a hot path.**warm-start for rl.** reinforcement learning needs the model to get to a non-zero score to be able to reinforce useful behaviors. for more complex tasks, base models might not be able to get there. sft on expert traces/ground truths can help move it to the right part of the distribution first, so rl can work its magic.\n\n## how to sft with castform\n\nyou can run an sft job in < 10 lines of code with castform. all you need to do is create an sft dataset. this dataset is basically a list of chat rows, and the model will be trained via next-token prediction to imitate all the messages with the role `assistant`\n\nin a given row.\n\n``` python\nfrom benchmax.sft import SftDataset\nfrom castform.platform import SftTrainingConfig, TrainerClient, upload_sft_assets\n\nrows = [\n    {\n        \"messages\": [\n            {\"role\": \"system\", \"content\": \"Replace personal information with typed placeholders.\"},\n            {\"role\": \"user\", \"content\": \"Contact Jane Doe at jane@example.com.\"},\n            {\"role\": \"assistant\", \"content\": \"Contact [GIVENNAME] [SURNAME] at [EMAIL].\"},\n        ]\n    },\n    # ...\n]\n\ndataset = SftDataset.from_rows(rows)\nassets = upload_sft_assets(dataset=dataset, run_name=\"pii-masking\")\nrun_id = TrainerClient().launch_sft_run(\n    assets=assets,\n    name=\"pii-masking\",\n    config=SftTrainingConfig(),\n)\n```\n\n## example use-case: pii masking\n\na good use-case for sft is pii-masking, where the goal is to train a model to detect all personally identifiable information (emails, ssns, names, etc.) and replace it with a typed placeholder. pii masking has one right answer. every name, email, etc. should be replaced with the placeholder, and the rest of the text should be unchanged. it’s also very easy to collect/synthesize training data for this task.\n\nto demonstrate this use-case, we trained qwen3.5-4b on the [openpii 1m dataset](https://huggingface.co/datasets/ai4privacy/pii-masking-openpii-1m) (ai4privacy / ai suisse sa, cc by 4.0). you can look at the full castform code example [here](https://github.com/castform-ai/benchmax/blob/main/examples/sft/pii_masking/main.py), and [the training run](https://app.castform.com/train/e6571f33-fe3a-47c1-a057-e9ebbb96e649) with castform.\n\nafter only **3,000** training examples, our finetuned 4b model beats an untrained frontier model on a held out validation set. we cut leak rate from 40% to **3.4%**.\n\nleak rate is the share of documents where any pii got through, and f1 is a proxy for measuring catching pii vs over-masking clean text. our precision was **0.998**, so we know it isn’t just redacting everything.\n\nthis is one task on one model, and pii masking is about as clean as supervised targets get. tasks with fuzzier notions of “correct” are where rl starts to earn its cost back.\n\n## your turn\n\nyou can get started with sft today. to setup castform, run `uv tool install -U castform`\n\nand `castform setup`\n\n. you can prompt your way with the coding agent of your choice to get started.", "url": "https://wpnews.pro/news/castform-now-supports-supervised-finetuning", "canonical_source": "https://castform.com/blog/sft-launch/", "published_at": "2026-08-14 17:54:17+00:00", "updated_at": "2026-08-14 18:12:20.387345+00:00", "lang": "en", "topics": ["artificial-intelligence", "machine-learning", "large-language-models", "ai-tools", "developer-tools"], "entities": ["Castform", "Benchmax", "Qwen3.5-4B", "OpenPII 1M", "ai4privacy", "AI Suisse SA"], "alternates": {"html": "https://wpnews.pro/news/castform-now-supports-supervised-finetuning", "markdown": "https://wpnews.pro/news/castform-now-supports-supervised-finetuning.md", "text": "https://wpnews.pro/news/castform-now-supports-supervised-finetuning.txt", "jsonld": "https://wpnews.pro/news/castform-now-supports-supervised-finetuning.jsonld"}}