Skip to content
Announcements13 min read

Potato 2.14: Train Models on Your Own Annotations

Potato 2.14 trains models on a study's labels with 38 trainers, on the Potato machine, a GPU server, or a SLURM cluster, and scores each run on held-out items.

Potato Team

Potato 2.14 trains models on a study's own annotations. Version 2.13.1 had one trainer, sklearn-text, and version 2.14 has 38, for fields that include pathology, sleep research, bioacoustics, fieldwork linguistics, and agent evaluation. A run trains on whatever compute you have, scores the model on items held out from training, and writes the model's predictions back to items as pre-labels that annotators confirm or correct. The release also fixes three local security issues and several bugs that changed agreement figures and exports, so read the upgrade notes before you install.

bash
pip install --upgrade potato-annotation

Training where your compute is

A run executes on a backend, and model_training.backends lists the backends a study can use. Potato 2.14 has four kinds of backend:

  • local. The run trains on the Potato machine and picks CUDA first, then Apple's Metal, then the CPU. sklearn-text needs no GPU at all.
  • ssh. The run starts on a server Potato can reach over SSH, and progress and the model stream back to Potato.
  • slurm. The run goes to a compute node through sbatch on the login node, and progress comes back over shared storage. The login node needs only sbatch, squeue, and scancel.
  • agent. A machine Potato cannot reach runs potato training agent and polls Potato for jobs.

A run started while another run is in progress joins a first-in, first-out queue that survives a server restart. Before a run on an ssh backend, potato training check <backend> config.yaml reports the remote Python, the remote GPUs, and any GPU the installed torch has no kernels for. Train on a GPU Server, SLURM Cluster, or Machine Behind NAT sets up each backend.

Trainers for new fields

The Training page offers each scheme only the trainers that fit the scheme, and the trainer catalogue lists all 38 trainers with install commands.

Science and medicine

  • Pathology and microscopy. cellpose fine-tunes Cellpose on cell outlines. The detection and segmentation trainers cut whole slides and images of 4096 pixels or more into tiles, and microscopy ROIs train the same detectors.
  • 3D medical volumes. volume-unet trains a U-Net on 3D masks and reports Dice on the held-out volumes.
  • Sleep staging and other signals. signal-cnn labels intervals of time-series signals. In epoch mode, signal-cnn classifies each epoch whole, as sleep staging does.
  • Spectra. peak-cnn finds peak positions on NMR, IR, Raman, UV-Vis, and mass spectra.
  • Molecules. rdkit-property predicts answers about molecules.

Science models and Volumes, point clouds, and video describe the data each trainer reads.

Audio, language, documents, and video

  • Speech. whisper-asr fine-tunes Whisper on corrected transcript turns, and diarization trains a speaker model on speaker turns.
  • Bioacoustics. Boxes drawn around calls on a spectrogram train the detection trainers.
  • Linguistics. byt5-gloss segments and glosses words for interlinear glossing. hf-relation trains on dependency trees as well as on links, events, and coreference chains.
  • Documents and maps. layoutlmv3 labels page layouts, and map features drawn on GeoTIFFs train the detection trainers.
  • Video and robotics. video-track tracks objects across frames, and episode-model labels robot episodes.

LLMs and agents

  • Fine-tuning. llm-sft fine-tunes an LLM on free-text answers and llm-dpo on pairwise preferences, with LoRA or QLoRA. QLoRA (lora: {quantize: 4bit} or 8bit) needs a CUDA GPU and works with llm-sft, llm-dpo, vlm-sft, reward-model, and hf-text-classification.
  • Reward models. reward-model fits a Bradley-Terry reward model on pairwise, ranking, and best-worst answers.
  • Agent traces. prm-reward trains a process reward model on step ratings of agent traces.
  • Vision-language models. vlm-sft fine-tunes a vision-language model on captions, grounding boxes, and GUI steps.

Fine-tuning LLMs covers the LoRA settings and the data each trainer expects.

Jev, OpenJev, and Laya decision models

Potato 2.14 adds three trainers for decision models. A decision model returns a probability for each option of a question, and Potato uses a decision model as a labeling engine source or as a labeling model in Solo Mode. decision-calibrate fits a calibration for hosted Jev, OpenJev, laya-serve, or Laya to the study's labels. The default temperature method changes how confident the model is and never changes which option the model picks. laya-finetune fine-tunes Laya, and openjev-finetune fine-tunes OpenJev on a GPU with about 16 GB free. All three trainers work on radio, select, likert, and slider schemes.

Classifiers and taggers

Potato 2.14 has classifiers and taggers for the common scheme types. hf-text-classification, setfit, and sklearn-text classify text, and hf-token-classification tags spans. hf-image-classification classifies images, and torchvision-detect, ultralytics-detect, torchvision-segment, ultralytics-segment, and sam-finetune train on boxes and outlines. hf-audio-tagger tags audio segments.

The ultralytics trainers are AGPL-3.0, and the LayoutLMv3 weights are CC BY-NC-SA 4.0. A run of either asks you to accept the license first. pip install "potato-annotation[train]" installs what the text, image, audio, and LLM trainers need, and the catalogue names the separate installs.

Held-out scores, pre-labels, and the Hugging Face Hub

Every run scores the model's predictions on the val and test items with a metric that fits the answer, such as macro-F1 for labels, mAP50 for boxes, token F1 for spans, word error rate for transcripts, Dice for 3D masks, and MOTA and IDF1 for tracks. An item with a label and no prediction counts as wrong, and a coverage figure reports the share of items that got a prediction. Train-split items never get a pre-label. An item a reviewer marked correct, or pinned with the Catalog's Train on these, always goes to the train split of later runs.

Predictions pre-fill labels and boxes, and in 2.14 also audio segments, pairwise cards, outlines, spans, rankings, best-worst answers, soft labels, glosses, conversation trees, links, chains, and events. A pre-label becomes the annotator's answer only when the annotator edits the pre-label or moves on, and write-back never changes a human label. The model review queue serves pre-labels least-confident first, and the review report names the run behind each pre-label. Model in the Loop covers the review workflow.

A run's page publishes the model to the Hugging Face Hub with a model card that names the trainer, the base model, the schemes, the split sizes, and the held-out score. You type the repository name twice, the repository is private by default, and the token comes from an environment variable on the server. The predictions and the training data stay on the server. The same page keeps a run's split and the split's human labels as a dataset version for comparing later models on the same items.

Models you already run

Five trainers fit nothing and score a model running somewhere else: label-studio-ml for a Label Studio ML backend, openai-vlm-boxes for a vision-language model behind an OpenAI-compatible API, hf-inference for a Hugging Face Inference Endpoint, roboflow, and cvat-nuclio for a CVAT serverless function. The predictions of a bridged model get the same held-out score, write-back, and review as a trained model's predictions. Pre-Labels and Held-Out Scores from a Model You Already Run covers each bridge.

Choosing what to ask next

hf-text-classification and hf-image-classification take an acquisition parameter that writes a score on each prediction, by margin, entropy, BALD, or core-set distance. assignment_strategy: llm_confidence then serves the highest score first. auto_retrain starts a new run after every 25 new annotations by default, and each run rescores the unlabeled items. Active learning compares the training loop with Potato's active_learning block.

Setting up a first run

Model training is for a study with more items than annotators will label, where a model trained on the first labels can propose the rest. A run resolves each item's labels to one answer and splits the items into train, val, and test. The trainer fits a model on the train split in a separate process, and the run scores the model on the val and test items. Write-back then shows the model's predictions to annotators as pre-labels, and the answers annotators save become labels for the next run.

To turn the loop on for a study with a sentiment scheme, add the following block to the study's config:

yaml
model_training:
  enabled: true
  writeback:
    schemas: [sentiment]
    include_unlabeled: true
    min_confidence: 0.6

Annotators see nothing from a run until a scheme is named under writeback.schemas. include_unlabeled: true predicts on the items nobody has labeled, and min_confidence keeps predictions below 0.6 off the page. Restart the server, open /admin/training with the admin key, pick a trainer and a scheme, and click Train now.

The Training page after one sklearn-text run, showing the run form, the Runs table with a held-out score, and the trainer list

Potato's example project in examples/ai-assisted/model-training/ has 160 product reviews and runs sklearn-text, which needs no GPU and nothing beyond a plain install. The model training documentation reports one run there, on 120 labeled reviews, that scored 0.84 macro-F1 on the validation reviews and wrote 80 pre-labels. A new annotator then sees each of the 80 reviews with the model's answer already selected:

A review on the annotation page with the model's answer selected as a pre-label

Train Your First Model walks through the example step by step.

Upgrade notes

Run potato validate config.yaml --strict on each config first. The following changes can alter what a working 2.13 study does:

  • Potato refuses to start when the system temp directory is writable by every user and has no sticky bit, and the package directory is read-only. Set POTATO_GENERATED_TEMPLATES_DIR to a private directory in that case. The security fixes explain the change.
  • The country list stores different values for 11 countries. Answers saved earlier keep the old values, such as Afganistan, Zaire, and Swaziland, so map the old values before comparing with new answers. An old answer does not show as selected when the answer's page is reopened.
  • assignment_strategy: llm_confidence now orders the queue. Items with an acquisition score come first, highest score first. Pre-labels follow, least confident first, then pre-labels with no confidence, then items with no pre-label. Earlier releases accepted the value and assigned items at random.
  • The Runs table on the Training page reports a held-out score. The score column used to show training accuracy, so a score from a 2.13 run is not comparable with a 2.14 held-out score.
  • validate and server start fail on more training settings. Unknown keys under writeback or auto_retrain, split names other than train, val, and test, a missing write-back scheme, an out-of-range min_confidence, and a missing calibration file are now errors.
  • Links, chains, and events appear in exports. span_link, coreference, and event_annotation answers were missing from every export, and an item whose only annotation was a link was left out. CSV and TSV now add <scheme>._links and <scheme>._events columns.
  • install_requires no longer lists joblib, threadpoolctl, six, soupsieve, pytz, python-dateutil, or ujson. No module in Potato imports any of the seven packages. Most of the seven still arrive as dependencies of pandas, scikit-learn, and beautifulsoup4, and code of your own that imports one of the packages should list the package.

Security fixes

Potato 2.14 fixes three security issues that involve other users on the same machine:

  • Generated templates. With a read-only package directory, Potato wrote the templates built at startup to a predictable directory in the system temp dir and reused the directory if the directory already existed. Another user on the machine could therefore plant a template. The directory is now named for the user, created with mode 0700, and used only when the user owns the directory and nobody else can write to the directory. The issue affects 2.13.1 and earlier.
  • Admin API key. Potato logged the generated admin API key in full when {task_dir}/admin_api_key.txt could not be written. The key is never logged now, the file is mode 0600, and an older key file readable by others changes to mode 0600 when Potato reads the file.
  • potato deploy. The project upload and the deploy pull database snapshot now use random, private names in the host's /tmp. On a host whose login is not root, the archive deploy pull downloads was readable by every user on the host, and the archive is now mode 0600 and owned by the login.

Transcripts, import, and export

  • WhisperX. potato transcripts --transcribe uses WhisperX when WhisperX is installed, with word times from forced alignment under --asr-word-timestamps. When WhisperX cannot run, Potato falls back to faster-whisper and logs the reason. A whisper-asr run writes a CTranslate2 copy of the fine-tuned model that --asr-model loads.
  • RTTM import. potato import -f rttm turns a diarization file, or a folder of diarization files, into one item per recording with the speaker turns to correct. --speaker-map renames speakers.
  • segments export. The format writes one JSONL row per audio or video segment and an RTTM file per annotator. Potato now has 72 export formats, up from 71 in 2.13.1.
  • CoNLL-U dependencies. HEAD and DEPREL come from a directed span_link scheme over the exported spans. Both columns were always _ before.
  • Options from a file. A select scheme reads options from a text file inside task_dir, one option per line, with labels: options/languages.txt.
  • Faster start. The server no longer imports pandas at startup, and import potato.flask_server takes 0.42 s on a clean install, down from 0.61 s.

Fixes that affect results

The changelog lists every fix. The fixes below could have changed numbers you reported:

  • A ranking tie written as B,D=A,C was read as one item named D=A, so Kendall's tau and the Spearman footrule left both tied items out.
  • Slider, soft-label, and pairwise-scale pre-labels were saved as the annotator's answer when the page loaded, so an item counted as done before anyone answered. Opening a grounding_eval item saved the item in the same way.
  • multirate with randomize_order shuffled the rating scale and recorded the scale order as the order shown. Potato now shuffles the rows and records the row order.
  • /admin/iaa listed coreference, span links, and events as spans with no score. The report now scores the three types by mean pairwise F1.
  • Merging or splitting a code in the codebook re-pointed no codings, because nothing linked saved annotations to code ids.
  • Snapshot manifests froze null agreement figures, and now record kappa and percent agreement.
  • Model review counted a reject verdict as a miss rather than against the pre-label the verdict took down, and the review report's precision came out wrong. A held-out annotator-item pair also kept the write-back field in the item data when writeback.field differed from pre_annotation.field, and the item data for such a pair now leaves out both fields.

Installing 2.14

Upgrade, validate each config, and install the trainers you need:

bash
pip install --upgrade potato-annotation
potato validate config.yaml --strict
pip install "potato-annotation[train]"

Model Training is the place to start, and What's New lists the rest of the release.