Examples
Each example is a complete workflow for a machine-learning job, built from task definitions on Swale Hub. Its page lists its steps and the task definitions they run, its inputs and output, and the whole workflow file, with the commands that add it to a project and start a run.
The examples come from the swaleio/examples repository on GitHub.
Run an example
New to Swale? Getting started takes you from a new account to your first run. Every example then runs the same way, as Run it on its page shows: add its workflow file to a project, create the secrets it reads, and start a run.
Inference, labeling and evaluation with LLMs
| Example | What it does | GPU steps |
|---|---|---|
| Generate responses over a dataset | Answers every prompt in a dataset with a chat model, as Parquet | vLLM batch |
| Label a text dataset with an LLM | Labels texts with one of a fixed set of labels and measures agreement | vLLM batch |
| Classify images with a vision-language model | Labels images with a vision-language model and measures agreement | vLLM batch |
| Detect objects with a vision-language model | Finds objects as bounding boxes with a vision-language model | vLLM batch |
| Caption a video | Captions a video frame by frame and summarizes it | vLLM batch |
| OCR pages with a vision-language model | Transcribes a PDF page by page with a vision-language model | vLLM batch |
| Generate synthetic chain-of-thought data | Builds a chain-of-thought dataset, judged against references | vLLM batch |
| Score answers with an LLM as a judge | Scores a model's answers from 1 to 10 with a judge model | vLLM batch |
Datasets from documents, images, audio and text
| Example | What it does | GPU steps |
|---|---|---|
| Convert PDFs to a Markdown dataset | Converts PDFs to a Markdown dataset with Docling, one task per PDF | none |
| Extract text from scanned images with Tesseract | Reads scanned pages with Tesseract, one task per scan | none |
| Transcribe audio | Transcribes audio or video files with whisper.cpp, one task per file | whisper.cpp |
| Build a speech dataset | Builds a speech-recognition dataset of transcribed clips | whisper.cpp |
| Profile, filter and re-pack a dataset | Profiles, filters, deduplicates and re-packs a Parquet dataset | none |
| Embed a dataset | Embeds every row with Text Embeddings Inference and parallel clients | TEI |
| Build a retrieval index | Builds a RAG index from PDFs and answers a test query | TEI |
| Remove semantic duplicates from a dataset | Drops rows that mean nearly the same | vLLM batch |
| Extract named entities with GLiNER | Extracts named entities of types you name with GLiNER | none |
| Curate web text with datatrove | Filters and deduplicates web text with datatrove | none |
Training and aligning language models
| Example | What it does | GPU steps |
|---|---|---|
| Fine-tune, evaluate, quantize and publish | Fine-tunes, evaluates, converts to GGUF, quantizes and publishes | TRL SFT, lm-eval |
| Compare two fine-tunes | Fine-tunes twice with different settings and compares scores | TRL SFT, lm-eval |
| Fine-tune a model then serve it with vLLM | Fine-tunes a model and serves it with vLLM in the same run | TRL SFT, vLLM |
| Align a model with DPO | Aligns a model with DPO and measures its win rate with a judge | TRL DPO, vLLM batch |
| Align a model with KTO | Aligns a model with KTO and measures its win rate with a judge | TRL KTO, vLLM batch |
| Train a reward model | Trains a reward model and scores held-out preference pairs | TRL reward |
| Train math reasoning with GRPO | Trains math reasoning with GRPO and a checked reward | TRL GRPO, lm-eval |
| Train math reasoning with RLOO | Trains math reasoning with RLOO and a checked reward | TRL RLOO, lm-eval |
| Distill a larger model into a smaller one | Distills a larger model into a smaller one | TRL distillation, lm-eval |
| Fine-tune a vision-language model | Fine-tunes a vision-language model and compares accuracy | TRL SFT, vLLM batch |
Merging, quantizing and serving
| Example | What it does | GPU steps |
|---|---|---|
| Merge two fine-tunes | Merges two fine-tunes with mergekit and scores all three | lm-eval |
| Quantize a model and pick the best preset | Quantizes to several presets and keeps the smallest good one | llama.cpp |
| Score a GGUF model on a CPU | Scores a GGUF model's math answers on a CPU, with parallel clients | none by default |
Training task-specific models with scripts
| Example | What it does | GPU steps |
|---|---|---|
| Fine-tune an encoder for text classification | Fine-tunes an encoder to classify text | training, prediction |
| Fine-tune an encoder for text regression | Fine-tunes an encoder to predict a number per text | training, prediction |
| Fine-tune an encoder for token classification | Fine-tunes an encoder to tag named entities | training, tagging |
| Fine-tune a model for extractive question answering | Fine-tunes a model to find answers in long documents | training, scoring tokens |
| Fine-tune a model to write news summaries | Fine-tunes a sequence-to-sequence model to summarize | training, generation |
| Fine-tune a translation model | Fine-tunes a translation model | training, generation |
| Fine-tune sentence embeddings for retrieval | Fine-tunes a sentence-embedding model for retrieval | training, embedding |
| Train a few-shot classifier with SetFit | Trains a few-shot classifier with SetFit | training, prediction |
| Fine-tune a vision transformer for image classification | Fine-tunes a vision transformer to classify images | training, prediction |
| Fine-tune a vision transformer for image regression | Fine-tunes a vision transformer to predict a number per image | training, prediction |
| Fine-tune an object detection model | Fine-tunes an object detector and scores its mAP | training, detection |
| Train a gradient-boosted model on tabular data | Trains gradient-boosted trees on a table | none |