Trace-to-Preference

v0.26.0 turns traffic logs into DPO / KTO training data. Point soup data from-traces at LangChain, OpenAI, or Soup-serve logs. Soup extracts preference signals — thumbs, regenerations, user edits — and writes clean pairs.

Ingest a log

bash
soup data from-traces \
  --logs chat_logs.jsonl \
  --format langchain \
  --signal thumbs_up \
  --output prefs.jsonl

Flags

FlagMeaning
--logsJSONL trace file (or a directory for the soup-serve format)
--formatlangchain · openai · soup-serve
--signalthumbs_up · regenerations · user_edit
--output / -oDestination JSONL (default prefs.jsonl)
--judgeKeep only pairs an LLM judge agrees with
--judge-provideropenai · server · ollama
--judge-modelModel id for the judge
--judge-api-baseJudge endpoint, validated against the SSRF guard: plain HTTP only for loopback, HTTPS for anything else, and since v0.75.2 never an IP address in a private, link-local or reserved range (see what v0.75.2 refuses)
--min-confidenceJudge-confidence floor, default 0.7

Signals

  • thumbs_up — a prompt with both a thumbs-up and a thumbs-down response becomes a pair: the thumbed-up output is chosen, the thumbed-down one rejected. A prompt with only thumbs-up feedback yields no pair
  • regenerations — if the user hit regenerate, the later response is preferred
  • user_edit — if the user rewrote the response, the edit becomes chosen

Review before training

bash
soup data review prefs.jsonl --sample 10

Previews the first N pairs in the file, in file order (--sample / -s, 1 to 100, default 10), each with its prompt, chosen and rejected text cut to 400 characters. It is not a random sample, so it will not show you problems that only occur later in the file. Use it as a sanity check before burning a GPU on junk data.

Train on them

DPO or KTO — the output format of from-traces matches both:

yaml
task: dpo
data:
  train: prefs.jsonl
  format: dpo

Safety

  • Logs never execute model code — parsers only read JSON.
  • Traces may contain PII or secrets; Soup warns on ingest and leaves scrubbing to you before sharing pairs externally.
  • Output JSONL can be validated with the same soup data validate pipeline as any other dataset.

See also

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.