Skip to content

Command-line tools

A release ships five binaries. This page shows what each prints for --help, captured from the binaries by website/scripts/capture-cli.mjs. The guides explain them in context: inference quickstart, compile and benchmark, benchmarking, kernel cache and Python.

Runs a GGUF model: on a prompt, as a REPL, or as a server with --listen. The options shown are the ones this site covers.

usage: phobos-cli --gguf FILE [OPTIONS] [PROMPT]
With a PROMPT: print the model's answer. Without one: start a REPL, which
answers each line on its own. A model whose file carries a chat template is
asked in it; --raw sends the text as typed and prints its continuation.
--gguf is required; there is no default model.
OPTIONS:
--gguf FILE run a GGUF model, dispatching on the architecture the
file declares, with the tokenizer the file carries
--expert-cache SIZE
device memory for a streamed model's expert cache,
2g, 1500m or bytes; default what the resident weights
leave, less a reserve. Ignored without experts
--max-ram SIZE host memory for a streamed model's experts, 10g, 1500m
or bytes, refused when the host has less available;
default all of them when they fit beside a reserve of
a quarter of the host's memory, else what does. The
rest are read from the file as the system pages it.
Ignored without experts
--ctx TOKENS the most tokens of context to serve, a longer prompt
being refused; default what fits on the device after
the weights, up to the trained length. GGUF only
--batch SIZE the most prompt tokens one forward pass covers, or
auto (default): on the GPU, each depth of the context
measures the sizes from 128 to 4096 on the passes a
prompt makes anyway, and the ones that win are kept in
the kernel cache for the next run. GGUF only
-n, --num N generate up to N tokens (default: 200; stops early on an
end-of-turn token or the model's context limit)
-t, --temp T sampling temperature; 0 = greedy/argmax (default: 0)
-k, --top-k K sample only from the K highest-logit tokens (default: 0 = off)
-p, --top-p P nucleus sampling threshold (default: 1.0 = off)
--min-p P keep tokens at least P as likely as the best one
(default: 0.0 = off)
--presence-penalty P
subtract P from the logit of every token generated so far,
the prompt excluded (default: 0.0 = off)
--repetition-penalty P
scale the logit of every token already in the sequence,
prompt included, towards zero by P (default: 1.0 = off)
--seed S PRNG seed for sampling (default: 0)
--show K show the top-K candidates for the first token (default: 5)
--raw send the prompt as typed instead of as a user turn of
the model's chat template, and print its continuation;
for a base model, or text that is already a prompt
--prefill-thinking TEXT
open the answer's think block on TEXT and let the
model reason on from it. When serving, this
applies to every chat request, whatever it asks for.
Ignored with --raw or a model with no chat template
--listen ADDR run an OpenAI compatible HTTP server on ADDR (e.g.
127.0.0.1:8080). The sampling options above become what a
request falls back to for every field it does not send.
Warns when ADDR is not a loopback address and no key is set
--api-key KEY require `Authorization: Bearer KEY` on every route of the
server. Falls back to PHOBOS_API_KEY
--no-tui serve without the dashboard, printing the runtime's lines
instead. Implied when stdout is not a terminal, and the
reason is printed whenever that happens
--tui draw the dashboard even where the terminal was not
recognized as one
--no-prefix-cache
start every request from an empty cache. By default a
finished request's session is kept and the next request
reuses as much of it as the two prompts agree on, which
is most of a chat. Turning it off costs that and gains
the cache's buffers back for a pass to use as scratch,
which is the difference on a card that only just fits
-V, --version print the version and the compiler fingerprint
-h, --help print this message

Compiles a kernel source file to PTX. No GPU is needed. The PTX goes to standard output unless -o names a file. --chip defaults to sm_75, which every supported card runs, and --index-bits to 32, raised to 64 when the module needs it, as the runtime would. Each @autotune name takes its first choice unless --set NAME=VALUE pins it, and --all-variants writes one file per combination left after the pins, named after -o with the settings appended. --check-races runs a host check for shared-memory races on what it compiles and fails on one, pointing at the two source lines involved. Set PHOBOS_PRINT_PHASES=1 to print the IR of each lowering phase. Errors go to standard error laid out as rustc lays them out, with the source highlighted on a terminal; --color overrides the choice, which also follows NO_COLOR, and --error-format json prints one JSON object per error instead.

usage: phobos-compile FILE.ph [--chip CHIP | --capability CC] [--index-bits 32|64] [--set NAME=VALUE]... [--all-variants] [--check-races] [-o OUT.ptx] [--origin MAP.json] [--stdlib FILE | --no-std] [--color auto|always|never] [--error-format human|json]
phobos-compile --render DIAG.json [--color auto|always|never] [--error-format human|json]
--chip CHIP target architecture, sm_75 by default
--capability CC target the newest supported chip a card of
compute capability CC runs, 86 for 8.6
--index-bits 32|64 index width, raised to 64 where the runtime would
--set NAME=VALUE pin an @autotune parameter, which otherwise takes
its first choice; repeatable
--all-variants compile every @autotune variant left after the
pins, one file each, named OUT_NAME-value.ptx
(OUT from -o, else the source's name); prints a
line per file and skips a variant that fails
--check-races run the host race check on each kernel compiled
and fail on a race between warps, a barrier not
every thread reaches or a shared access outside
its buffer
-o, --output OUT.ptx write the PTX here instead of standard output,
and each kernel's launch contract to OUT.json
--origin MAP.json FILE was generated from another language's
source: MAP holds that source and where each
construct of FILE came from, and every error,
race and location is reported there
--render DIAG.json print the errors DIAG holds as this compiler
prints its own, and fail; for a front end's
errors before there is a FILE
--stdlib FILE compile against the functions FILE defines in
place of the standard library
--no-std compile with no standard library: a source calls
only its own functions and the built-ins
--color WHEN color errors: auto (on a terminal, unless
NO_COLOR is set), always or never
--error-format FORMAT human, or json for one object per error

Measures a GGUF model’s prompt processing (pp<N>) and text generation (tg<N>) in tokens per second, as llama-bench does. It needs a GPU.

usage: phobos-bench [OPTIONS]
OPTIONS:
-m, --model FILE the GGUF file to run (default: models/Qwen3.5-0.8B-Q8_0.gguf)
-p, --n-prompt N,... prompt-processing tokens, one pp<N> row each (default: 128)
-n, --n-gen N,... generated tokens, one tg<N> row each (default: 32)
-d, --n-depth N,... positions in the context before each tg row starts,
one set of tg rows per depth (default: 0)
-r, --repetitions N timed repetitions per row (default: 3)
-b, --batch-size N tokens a prompt is handed over in at a time, its logits
read back after each batch (default: 2048)
-ub, --ubatch-size N tokens in one forward pass, at most the batch size
(default: 512, the runtime's untuned one)
--no-warmup skip the warmup pass, which leaves each kernel's first
compile inside the repetition it lands in
--expert-cache SIZE
device memory for a streamed model's expert cache
(2g, 1500m, bytes); default, what the weights leave
--max-ram SIZE host memory for a streamed model's experts, refused
when the host has less available; default all of
them when they fit beside a quarter of the host's
memory, else what does
-h, --help print this message
-p and -n take a comma-separated list, and repeat, so -p 128,512 and
-p 128 -p 512 both ask for the same two rows. -b and -ub take one value;
llama-bench's lists of them, a row per combination, are not supported.
A pp<N> row and the positions a -d row primes are fed the same way.

Fills, lists and clears the compiled-kernel cache. The subcommands are explained on the kernel cache page.

usage: phobos-cache <warm|list|clear|prune> [--chip CHIP]... [--dir CACHE] [--manifest DIR]... [--jobs N] [--force] [--ptxas PATH | --no-ptxas] [KERNEL...]

Prints a kernel source in its Python spelling, which the Python package’s front end reads back to the same module: the way to move a .ph file to Python. No GPU is needed. See From Phobos to Python.

usage: ph2py FILE.ph
ph2py --out DIR PATH...
Prints a Phobos source in its Python spelling, which the `phobos` package's
front end reads back to the same module.
FILE.ph print FILE's Python spelling to standard output
--out DIR PATH... write DIR/<stem>.py for each source, a file or every .ph
in a directory, and print a line for each it cannot spell
-V, --version print the version and the compiler fingerprint
-h, --help print this

All five print the version and the compiler fingerprint with --version.