Backends¶
The backend decides where trials run. It's a dial: start on local, and move to
devbox or cluster when you need real models, your own data, or GPUs. The manifest,
the lockfile, and the commands are the same on every backend.
flowchart LR
L["⚡ local<br/><sub>in-process · offline<br/>deterministic</sub>"] --> D["💻 devbox<br/><sub>Python worker on this machine<br/>real LLMs · your traces</sub>"] --> C["☁️ cluster<br/><sub>Flyte / Union tasks<br/>GPUs · caching · lineage</sub>"]
| Backend | Where trials run | Use it for |
|---|---|---|
local (default) |
In process, on the Rust reference harness | Trying hlock out, CI, deterministic tests |
devbox |
A Python worker on this machine | Real LLM calls, loading your traces, flyte local |
cluster |
A Python worker that lifts each stage to a Flyte/Union task | GPUs for fine-tuning, fan-out, durable caching, team-shared results |
Choosing a backend¶
Set a default in the manifest:
Override it for one command with --backend:
Check what's configured with hlock backend status:
$ hlock backend status
backend local (from harness.toml)
HL_PYTHON python3 (default)
HL_LLM_BASE_URL unset: offline reference LLM
flyte config ~/.flyte/config.yaml
local¶
Everything runs in process on the deterministic reference provider and harness. It
needs no setup, no network, and no keys, and the same manifest always produces the
same lock. Use it to learn hlock, to test manifests, and in CI.
devbox¶
The Rust core hands each work item to the Python worker over a
versioned JSON contract. The worker
runs on this machine, in the interpreter named by HL_PYTHON.
-
Point
HL_PYTHONat an interpreter that hashlockinstalled: -
To call a real model, point the worker at any OpenAI-compatible endpoint, such as vLLM, SGLang, Ollama, or a hosted API:
export HL_LLM_BASE_URL=http://localhost:8000/v1 export HL_LLM_MODEL=qwen-32b export HL_LLM_API_KEY=... # if the endpoint needs oneWithout
HL_LLM_BASE_URL, the worker uses the deterministic offline reference LLM, so the pipeline still runs end to end. -
Install the libraries for the stages you'll use:
Stage Install Loading traces (CSV, JSONL, Parquet) polarsorpandasLoRA fine-tuning ( --depth ft)torch,peft,trl -
Run it:
cluster¶
Same worker, but it lifts each stage to a real Flyte 2 task on a Flyte or Union cluster:
- CPU images for data loading, prompt search, grading, and LLM trials
- a GPU image with an accelerator request for LoRA fine-tuning
cache="auto", so re-runs reuse finished trials- datasets and adapters offloaded through
flyte.io - run ids and budget recorded as provenance in the lock
Setup:
- Install the Flyte extra:
pip install "hlock[flyte]" - Configure access to your cluster in
~/.flyte/config.yaml. With Union, runflyte create configand log in. -
Run it:
If the Flyte SDK isn't importable, the worker runs each stage in process and reports that it did, rather than failing.
Environment variables¶
See the environment variable reference for every HL_*
variable and its default.