Skip to main content
The Train tab turns a praisonai-train fine-tune into a form, a live loss chart, and a run history — all against your local engine.
The Train tab is a desktop wrapper around the praisonai-train llm CLI. The engine writes a config.yaml, spawns python -m praisonai_train llm --config <run_dir>/config.yaml as its own process group, and reports on it live.

Quick Start

1

Open the Train tab

Click Train in the sidebar. The app remembers your last-picked view, so it reopens where you left off. The one exception is a launch where the engine still needs setup or has failed — the app forces Chat while the wizard/banner is on screen, and returns to your saved view the moment the engine is healthy, in the same session (PraisonAI #4471, #4623).
2

Pick a model and dataset

Defaults are unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit on yahma/alpaca-cleaned. Leave them as-is for your first run.
3

Click Start training

The button becomes Training…. A live card shows the loss chart, step / total, current loss, and elapsed time; the log auto-follows.
4

Close the lid — come back

Reopen the app; the Train tab reattaches to the running job and repopulates step, loss, elapsed, and log from history.

How It Works

The engine runs one job at a time and keeps its progress in a replayable ring buffer, so closing the window never loses a run. The engine parses two line shapes from the trainer’s output: a step / total tqdm bar and the {'loss': ..., 'learning_rate': ..., 'epoch': ...} dict trl prints each logging step. Everything else is shown verbatim in the log pane.
The full log is persisted to <PRAISONAI_DESKTOP_HOME>/runs/<run_id>/train.log (UTF-8, errors="replace", flushed per line so it is readable while the run is live), and the config is written next to it as config.yaml (JSON if PyYAML is missing). See Data & Privacy for where PRAISONAI_DESKTOP_HOME points.

Reconnect & resync

Opening the tab after a gap replays from your cursor; a long run that overflowed the ring buffer tells you so rather than silently skipping output.

Adopting a run after restart

On restart the engine reads each runs/<id>/run.json and only adopts a run it can prove is still its own — a live pid is not enough because pids are recycled. The fingerprint is recorded at spawn while the child is certainly still ours; reading it at adoption time would fingerprint whoever holds the pid then, which is the case being guarded against.

Choosing a method

method picks the trainer. sft works with the default dataset; the rest need differently-shaped data, named in the per-method hint under the dropdown.
grpo is rejected before any download with a 400 — it needs reward_funcs this form does not collect. Run it from the command line instead.

Configuration

The form posts a config object to /train/start. Basic fields are always visible; LoRA and quantization live in the Advanced panel.
Before writing config.yaml, the engine pins these so a desktop run stays local:
Publishing is opt-in from the CLI — see Train → Publishing.
From PraisonAI #4879 the explicit ollama_save: false / huggingface_save: false lines are optional for vision configs too — omitting the keys entirely also skips publishing. Before #4879 that held only for LLM configs; the vision trainer defaulted those flags to ON. See Vision Fine-Tuning.

Environment variables

Point the app at a matched CUDA/torch environment without touching the engine’s venv:
Launch the app after exporting it, and the engine spawns the trainer from that venv.

Common Patterns

Open Train, keep the defaults, click Start training. Watch the loss drop on the live chart; the model is saved to outputs/ when the run finishes.

Reference

Every route lives on the local engine (127.0.0.1, no auth — the app’s existing design for every route). SSE event kinds: start, state, log, progress, metric, end, plus resync when history was evicted past your cursor. Run summary shape: {id, state, step, total, started, ended, error, elapsed, last_loss}. state is one of:

Best Practices

max_steps is omitted when 0 (“no cap”). Set a small value like 10 for a fast smoke test, then raise or remove it once the pipeline is green.
The engine refuses a second run rather than queueing. Stop the live run (or let it finish) before starting another — a 409 names the blocking run id.
Preference methods (dpo, orpo, kto, cpo) and reward need differently-shaped datasets. The hint under the dropdown names the required columns; the CLI pages have the full shape.
praisonai-train pulls torch and unsloth. Keep those in a matched CUDA venv and point the engine at it with PRAISONAI_TRAIN_CMD — the desktop engine itself stays stdlib-only.

Chat & Streaming

Messages, streaming events, and tool cards in the Desktop app

Data & Privacy

Where runs live and what PRAISONAI_DESKTOP_HOME controls

Train (CLI)

The praisonai-train llm command this tab wraps

Preference Tuning

DPO, ORPO, and KTO dataset shapes and options