# Examples

> **About this page**
>
> - Kind: Section overview
> - Summary: Start from a complete workflow for a machine-learning job, with its steps, inputs and output, its workflow file and the commands that run it.
> - Last changed: 2026-12-03
> - Page: https://docs.swale.io/examples
> - Index of these docs: https://docs.swale.io/llms.txt
>
> If something on this page is wrong or out of date, please tell the user which sentence and why.

Each example is a complete workflow for a machine-learning job, built from task definitions on [Swale Hub](https://hub.swale.io). 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`](https://github.com/swaleio/examples) repository on GitHub.

## Run an example

New to Swale? [Getting started](https://docs.swale.io/getting-started.md) takes you from a new account to your first run. Every example then runs the same way, as [Run it](https://docs.swale.io/examples/generate-responses.md#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](https://docs.swale.io/examples/generate-responses.md) | Answers every prompt in a dataset with a chat model, as Parquet | vLLM batch |
| [Label a text dataset with an LLM](https://docs.swale.io/examples/label-text.md) | Labels texts with one of a fixed set of labels and measures agreement | vLLM batch |
| [Classify images with a vision-language model](https://docs.swale.io/examples/classify-images.md) | Labels images with a vision-language model and measures agreement | vLLM batch |
| [Detect objects with a vision-language model](https://docs.swale.io/examples/detect-objects.md) | Finds objects as bounding boxes with a vision-language model | vLLM batch |
| [Caption a video](https://docs.swale.io/examples/caption-video.md) | Captions a video frame by frame and summarizes it | vLLM batch |
| [OCR pages with a vision-language model](https://docs.swale.io/examples/ocr-pages.md) | Transcribes a PDF page by page with a vision-language model | vLLM batch |
| [Generate synthetic chain-of-thought data](https://docs.swale.io/examples/synthetic-reasoning-data.md) | Builds a chain-of-thought dataset, judged against references | vLLM batch |
| [Score answers with an LLM as a judge](https://docs.swale.io/examples/llm-as-a-judge.md) | 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](https://docs.swale.io/examples/pdfs-to-markdown.md) | Converts PDFs to a Markdown dataset with Docling, one task per PDF | none |
| [Extract text from scanned images with Tesseract](https://docs.swale.io/examples/scans-to-text.md) | Reads scanned pages with Tesseract, one task per scan | none |
| [Transcribe audio](https://docs.swale.io/examples/transcribe-audio.md) | Transcribes audio or video files with whisper.cpp, one task per file | whisper.cpp |
| [Build a speech dataset](https://docs.swale.io/examples/speech-dataset.md) | Builds a speech-recognition dataset of transcribed clips | whisper.cpp |
| [Profile, filter and re-pack a dataset](https://docs.swale.io/examples/dataset-statistics.md) | Profiles, filters, deduplicates and re-packs a Parquet dataset | none |
| [Embed a dataset](https://docs.swale.io/examples/embed-dataset.md) | Embeds every row with Text Embeddings Inference and parallel clients | TEI |
| [Build a retrieval index](https://docs.swale.io/examples/retrieval-index.md) | Builds a RAG index from PDFs and answers a test query | TEI |
| [Remove semantic duplicates from a dataset](https://docs.swale.io/examples/semantic-deduplication.md) | Drops rows that mean nearly the same | vLLM batch |
| [Extract named entities with GLiNER](https://docs.swale.io/examples/entity-extraction.md) | Extracts named entities of types you name with GLiNER | none |
| [Curate web text with datatrove](https://docs.swale.io/examples/web-text-curation.md) | 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](https://docs.swale.io/examples/fine-tune-evaluate-quantize.md) | Fine-tunes, evaluates, converts to GGUF, quantizes and publishes | TRL SFT, lm-eval |
| [Compare two fine-tunes](https://docs.swale.io/examples/compare-fine-tunes.md) | Fine-tunes twice with different settings and compares scores | TRL SFT, lm-eval |
| [Fine-tune a model then serve it with vLLM](https://docs.swale.io/examples/train-then-serve.md) | Fine-tunes a model and serves it with vLLM in the same run | TRL SFT, vLLM |
| [Align a model with DPO](https://docs.swale.io/examples/dpo-alignment.md) | Aligns a model with DPO and measures its win rate with a judge | TRL DPO, vLLM batch |
| [Align a model with KTO](https://docs.swale.io/examples/kto-alignment.md) | Aligns a model with KTO and measures its win rate with a judge | TRL KTO, vLLM batch |
| [Train a reward model](https://docs.swale.io/examples/reward-model.md) | Trains a reward model and scores held-out preference pairs | TRL reward |
| [Train math reasoning with GRPO](https://docs.swale.io/examples/grpo-math.md) | Trains math reasoning with GRPO and a checked reward | TRL GRPO, lm-eval |
| [Train math reasoning with RLOO](https://docs.swale.io/examples/rloo-math.md) | Trains math reasoning with RLOO and a checked reward | TRL RLOO, lm-eval |
| [Distill a larger model into a smaller one](https://docs.swale.io/examples/distill-model.md) | Distills a larger model into a smaller one | TRL distillation, lm-eval |
| [Fine-tune a vision-language model](https://docs.swale.io/examples/fine-tune-vision-language-model.md) | 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](https://docs.swale.io/examples/merge-models.md) | Merges two fine-tunes with mergekit and scores all three | lm-eval |
| [Quantize a model and pick the best preset](https://docs.swale.io/examples/quantize-and-pick.md) | Quantizes to several presets and keeps the smallest good one | llama.cpp |
| [Score a GGUF model on a CPU](https://docs.swale.io/examples/score-gguf.md) | 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](https://docs.swale.io/examples/text-classification.md) | Fine-tunes an encoder to classify text | training, prediction |
| [Fine-tune an encoder for text regression](https://docs.swale.io/examples/text-regression.md) | Fine-tunes an encoder to predict a number per text | training, prediction |
| [Fine-tune an encoder for token classification](https://docs.swale.io/examples/token-classification.md) | Fine-tunes an encoder to tag named entities | training, tagging |
| [Fine-tune a model for extractive question answering](https://docs.swale.io/examples/extractive-question-answering.md) | Fine-tunes a model to find answers in long documents | training, scoring tokens |
| [Fine-tune a model to write news summaries](https://docs.swale.io/examples/summarization.md) | Fine-tunes a sequence-to-sequence model to summarize | training, generation |
| [Fine-tune a translation model](https://docs.swale.io/examples/translation.md) | Fine-tunes a translation model | training, generation |
| [Fine-tune sentence embeddings for retrieval](https://docs.swale.io/examples/sentence-embeddings.md) | Fine-tunes a sentence-embedding model for retrieval | training, embedding |
| [Train a few-shot classifier with SetFit](https://docs.swale.io/examples/setfit-classifier.md) | Trains a few-shot classifier with SetFit | training, prediction |
| [Fine-tune a vision transformer for image classification](https://docs.swale.io/examples/image-classification.md) | Fine-tunes a vision transformer to classify images | training, prediction |
| [Fine-tune a vision transformer for image regression](https://docs.swale.io/examples/image-regression.md) | Fine-tunes a vision transformer to predict a number per image | training, prediction |
| [Fine-tune an object detection model](https://docs.swale.io/examples/object-detection.md) | Fine-tunes an object detector and scores its mAP | training, detection |
| [Train a gradient-boosted model on tabular data](https://docs.swale.io/examples/tabular-gradient-boosting.md) | Trains gradient-boosted trees on a table | none |
