Skip to content

Developer experience: bundled recipes, safe defaults, Python training API, server batching - #4

Merged
akanyaani merged 1 commit into
mainfrom
dx-improvements
Oct 23, 2026
Merged

akanyaani merged 1 commit into
mainfrom
dx-improvements

Conversation

@akanyaani

Copy link
Copy Markdown
Contributor

Fixes from a first-time-user review: install from pip in an empty folder, then follow the README.

Blockers fixed

  • Recipes now ship in the package. decisionformer train deciformer15k_qwen3 works after a plain pip install; before, configs/recipes/... only existed in a clone. Related commands:
    • decisionformer recipes lists the recipes.
    • decisionformer init NAME copies one to edit.
    • A config can inherit a recipe with base: NAME.
  • The starting recipe learns. The new deciformer15k_qwen3 (Qwen3-0.6B + LoRA) replaces the Qwen3.5 example, which has not learned reliably. The Qwen3.5 recipe is removed until it does; details are in docs/benchmarks.md.
  • predict reads every accepted record shape: requests, single questions and flat rows such as deciformer-15k. It batches requests, and a record it can't answer becomes an error line instead of crashing the run.
  • README install section: it says to install from GitHub until the first PyPI release, since PyPI currently only holds the placeholder.

Friction fixed

  • Safe defaults in code. configs/base.yaml is gone and its values are now the code defaults:
    • Resumable state and evaluation every 500 steps, with resume: auto and max_length 1024.
    • The learning rate follows the fine-tuning mode: 2e-5 full, 2e-4 LoRA/QLoRA, 1e-3 head-only.
    • Resumable state is deleted when a run finishes; it was 1.6 GB for the laptop recipe.
    • Rerunning a finished run warns that it will overwrite it.
  • Python training API. decisionformer.train(...) takes a recipe name, a YAML file or a dict, plus dotted overrides. load_config accepts the same.
  • Logs.
    • The Hub's httpx2 request lines are silenced.
    • The precision is named ("float32", "fp16 autocast with loss scaling").
    • Each step shows step N/total and the time left.
    • Training warns when the training data shares ids, families or identical states with the dev or calibration data.
  • Server.
    • Requests that arrive while the model is busy are answered together, up to --max-batch (default 16); a single request still runs alone.
    • A failing request in a batch fails alone.
    • /docs now shows the request and response schemas.
  • Model names. A local runs/<name>/best answers as <name>, not best.
  • CLI help shows examples and points to the recipes.

Testing

All on the GPU box; nothing was run on a laptop.

  • Full suite with the GPU hidden: 265 passed, 12 skipped. New tests cover recipe names, dict configs, the learning rate by mode, recipes/init, predict with mixed shapes and a bad row, server batching with error isolation, the /docs schema, the leakage warning, train() from Python, and the state cleanup after pause/resume.
  • Pip-user simulation: a fresh venv with CPU torch, the built wheel and an empty folder. recipes, init, data split, train local_smollm2 (3 steps), predict (3 rows plus a bad one), serve, /docs, and 32 requests from 16 concurrent clients all work. The training log has no httpx lines.
  • deciformer15k_qwen3, one epoch on the RTX 2060 SUPER (fp16 fallback): dev accuracy 0.792 → 0.805 → 0.824 at steps 125/250/375, calibrated ECE 0.023, per task 0.75–0.90.
  • Qwen3.5 (bidirectional, QLoRA, last-token readout), 40-step check: the export is the correct Decision 3.0 layout, but the loss spiked and dev accuracy was 0.41 on 128 rows, so no Qwen3.5 recipe ships.

Not in this PR

  • A Colab notebook.
  • Typed Python response objects.
  • A real run on Apple-silicon (MPS) hardware.

… API, server batching

- Recipes ship in the package (src/decisionformer/recipes): train, config
  and adapt accept a recipe name; decisionformer recipes lists them and
  decisionformer init copies one to edit. Configs can inherit a recipe.
- configs/base.yaml is gone: its values are the code defaults (resumable
  state and evaluation every 500 steps, resume auto, max_length 1024); the
  learning rate follows the fine-tuning mode. Resumable state is removed
  when a run finishes, and rerunning a finished run warns first.
- decisionformer.train() takes a recipe name, a YAML file or a dict, with
  dotted overrides; load_config accepts the same.
- New starting recipe deciformer15k_qwen3 (Qwen3-0.6B + LoRA): 0.824 dev
  accuracy on deciformer-15k in one epoch. The Qwen3.5 recipe is removed
  until Qwen3.5 fine-tuning learns reliably (docs/benchmarks.md).
- predict reads every accepted record shape, batches requests and reports
  records it cannot answer as error lines instead of crashing.
- serve batches requests that arrive while the model is busy (--max-batch)
  and documents the request and response schemas at /docs.
- Logs: Hub request lines are silenced, precision is named, and training
  steps show progress and the time left. Training warns about overlap
  between the training data and the evaluation or calibration data.
- Local run exports answer with their run name instead of best/last.
- CLI help shows examples and the recipes; the README installs from
  GitHub until the first PyPI release.
@akanyaani
akanyaani merged commit dc25e3b into main Oct 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant