Skip to content

Data Augmentation

soup data augment expands a JSONL dataset with LLM-driven rewrites. Added in v0.25.0.

Usage

bash
# Rephrase each example 3x
soup data augment \
  --input data.jsonl \
  --output augmented.jsonl \
  --strategy rephrase \
  --count 3

# Translate to other languages
soup data augment --input data.jsonl --strategy translate --lang ru,zh,es

# Rewrite in multiple styles
soup data augment --input data.jsonl --strategy style --styles formal,casual,technical

Strategies

StrategyPurpose
rephrasePreserve meaning, diversify wording
translateAdd examples in other languages for multilingual fine-tuning
styleRewrite in formal / casual / technical / etc. tones

Providers

Augmentation uses the judge providers: ollama, anthropic, vllm. Select with --provider. The call needs httpx, which a core install does not include: pip install "soup-cli[generate]" (without it the command exits 2).

bash
soup data augment \
  --input data.jsonl \
  --strategy rephrase \
  --count 2 \
  --provider ollama \
  --dedup

Flags

FlagMeaning
--input, -iThe source JSONL (required)
--output, -oWhere to write; default augmented.jsonl. Since v0.77.1 it must not be --input: an --output that is the same file, default name included, is refused with exit 2 (#2261)
--strategy, -srephrase (default) / translate / style
--provider, -pollama (default), anthropic or vllm
--countAugmentation multiplier for rephrase (default 2, 1 to 10). translate and style ignore it and write one variant per language or style
--langTarget languages for translate, comma-separated: at most 10 entries of 32 characters each
--stylesStyle list for style, comma-separated: at most 10 entries of 32 characters each
--modelModel id to ask the provider for
--base-urlProvider endpoint for ollama or vllm. An Ollama server must be on localhost; a remote vLLM server must use HTTPS, and since v0.75.2 its host may not be a private, link-local or reserved IP address (name it by hostname). A host written only as numbers that is not a valid IPv4 address (10.0.0.256, 4294967296) is refused too (v0.76.0). anthropic needs ANTHROPIC_API_KEY instead
--requests-per-minuteAccepted, 1 to 600 (default 60), and not applied at v0.78.1: soup data augment does not pace its provider calls (soup data generate does)
--dedupDeduplicate augmented + original data

When the provider fails (v0.76.0)

A call that fails (a transport error, a non-200 status, a malformed reply) or returns an empty or whitespace-only reply never becomes a row: that variant is dropped, and a row is never written with an empty or unrewritten field. The summary reports N of M provider calls failed for --provider <name> (<endpoint>); first error: .... When no call produced a usable row the command prints No usable rows produced and exits 1 without writing an output file. A partial outage keeps the rows that succeeded and prints a yellow warning line with the failure count.

Warning:

Re-run this. Through v0.75.2 soup data augment built its provider so that a connection error, an HTTP 404, 429 or 500, or a malformed reply came back as empty text. A rephrase, translate or style pass over a provider that was down or rate-limiting wrote rows whose rewritten field was "" next to the originals, and the command exited 0. Open an augmented file made that way and look for empty fields. soup distill-prompt had the same defect from the other side: it dropped every failed row and wrote an empty file with Rows: 0, also with exit 0.

Safety

  • Input/output paths are resolved and constrained to the current working directory.
  • Since v0.77.1 the output may not be the input file under any spelling (./x, sub/../x, the absolute path, a case variant on a case-insensitive file system, a hard link). It is checked before the data is read and ends with exit 2 and --output 'augmented.jsonl' is the same file as --input 'augmented.jsonl'; choose a different --output. An input that is itself named augmented.jsonl is refused under the default output. Through v0.77.0 such a run replaced the input and exited 0 (#2261).
  • Each output row keeps the fields of its input row; only string values are rewritten.
  • --count is capped at 10 to prevent accidental 1000× blow-ups.
  • Nothing paces the provider calls at v0.78.1: --requests-per-minute is read and not used. Use the provider's own limits.

Soup is free and Apache-2.0. If it saved you a training run, starring the repo costs nothing and helps most. You can also fund the GPU time behind the work a 4 GB laptop cannot reach.