Drop a folder full of .gguf model files, point luaLLM at it, and start using them immediately. No flag fiddling — sensible defaults work out of the box. Pick a model from the interactive TUI or type a partial name. When you need more speed, the built-in benchmark and recommendation engine will find your optimal settings automatically.
A fast, scriptable command-line tool for managing, running, benchmarking, and optimizing local LLMs. Built in Lua on top of llama.cpp.
Running Models
- Interactive TUI picker with pinned + recent model sections
- Foreground and background (daemon) mode with multi-server support
- Fuzzy model name matching — no need to type exact filenames
- Saved presets (
--preset throughput,--preset cold-start) for optimized launches
Model Management
- Pin models for quick access at the top of the picker
- Freeform markdown notes per model with timestamped entries
- Cached model metadata (context size, quantization, rope settings)
- Multi-part GGUF merging for split model files
- Safetensors-to-GGUF conversion with llama.cpp quant size estimates and a RAM-fit preview
Benchmarking & Optimization
- Automated benchmark sweeps with
llama-bench(configurable runs, warmup, threads) - Side-by-side model comparison with delta/percentage stats and comparability warnings
recommend throughput— sweeps thread counts, KV cache types, and flash attention to find the fastest flagsrecommend cold-start— generates a preset optimized for minimum time-to-first-token
Utilities
--jsonoutput onlist,status,notes,helpfor scripting and tool integration- Configuration diagnostics (
doctor) to validate your setup - Rebuild llama.cpp from source with one command
# 1. Install
brew install lua luarocks # macOS
make install
# 2. Configure (auto-created on first run)
luallm config # shows config file path — edit it to set your models_dir and llama_cpp_path
# 3. Run
luallm # interactive picker
luallm mistral # run by name (fuzzy match)
luallm start mistral # launch as background daemon- Lua 5.3+ and luarocks
- llama.cpp binaries — at minimum
llama-server; alsollama-bench(for benchmarking),llama-gguf-split(for join),llama-cli(optional) - One or more
.ggufmodel files
# macOS
brew install lua luarocks
# Ubuntu / Debian
sudo apt install lua5.4 liblua5.4-dev luarocksmake install # installs Lua deps and symlinks to ~/.local/bin/luallmMake sure ~/.local/bin is in your PATH (it is by default on most systems).
For system-wide installation:
sudo make install PREFIX=/usr/localmake deps # install lua-cjson and luafilesystem via luarocks
chmod +x luallm.lua
mkdir -p ~/.local/bin
ln -sf $(pwd)/luallm.lua ~/.local/bin/luallmNote:
luallm.luamust be symlinked, not copied — it resolvessrc/module imports relative to the script location.
make check # checks that Lua dependencies are installed
luallm doctor # validates config, binaries, and models directoryIf you get "module not found" errors, add this to your shell config (~/.bashrc or ~/.zshrc):
eval $(luarocks path --bin)luallm # interactive picker (pinned + recent models)
luallm <model> # fuzzy-match a model name, run in foreground
luallm run <model> # explicit run command (same as above)
luallm run <model> --preset throughput # run with saved optimized flags
luallm <model> --port 9090 -c 8192 # pass extra llama.cpp flags (override defaults)Model names are fuzzy-matched — mistral matches mistral-7b-instruct-v0.3.Q4_K_M.gguf. If multiple models match, the picker appears.
Run models as background servers that persist after you close the terminal:
luallm start <model> # launch in background, returns immediately
luallm start <model> --port 8081 # run on a specific port
luallm start <model> --preset throughput
luallm status # show running and recently stopped servers
luallm logs <model> # view daemon output
luallm logs <model> --follow # tail logs in real time
luallm stop <model> # stop a server (SIGTERM, then SIGKILL)
luallm stop all # stop everythingMultiple servers can run simultaneously on different ports. State is tracked in ~/.cache/luallm/state.json.
luallm list # list all models (name, size, quantization, last run)
luallm list --json # JSON output for scripting
luallm info <model> # show cached metadata (context size, quant, rope, etc.)
luallm info <model> --kv # show full GGUF key-value pairs
luallm info <model> --raw # show raw captured llama.cpp output
luallm pin <model> # pin a model (appears at top of picker)
luallm unpin <model>
luallm pinned # list pinned models
luallm notes <model> # view notes for a model
luallm notes add <model> "great for coding, fast on 8 threads"
luallm notes edit <model> # open in $EDITOR
luallm notes list # list all models with notes
luallm join # merge multi-part GGUF files (ModelName-00001-of-00003.gguf -> ModelName.gguf)
luallm join llama-405b # merge a specific modelMetadata is captured automatically the first time you run a model and cached locally.
luallm quantize # cached-source picker + completed quants
luallm quantize Qwen/Qwen3-8B # HuggingFace repo ID
luallm quantize https://huggingface.co/Qwen/Qwen3-8B # or model page URL
luallm quantize https://huggingface.co/Qwen/Qwen3-8B/tree/main # Files tab URLs work too
luallm quantize ~/downloads/model-repo # local folder, including multipart weights
luallm quantize owner/model --quant Q4_K_M --ctx 8192
luallm quantize owner/model --quant Q5_K_M --yes # unattended
luallm quantize owner/model --estimate-only # metadata/info preview; no model downloads/conversion
luallm quantize owner/model --quant Q4_K_M,Q6_K # several quants, one conversion
luallm quantize owner/model --cached # no remote version check
luallm quantize owner/model --update # explicitly use current remote revision
luallm quantize owner/model --quant Q6_K --reuse-intermediate /path/to/source-f16.gguf
luallm quantize clear owner/model # choose/confirm revision to clear
luallm quantize --json # cache/history list for scriptsWith a repo URL or local source folder, the command first shows an info panel, completed quants, approximate sizes, and RAM-fit estimates. No model weights are downloaded or converted to display this panel. Choose one or more quant numbers/names, separated by commas. Until an F16 GGUF exists, previews are clearly labeled rough BPW estimates, not llama.cpp predictions. After conversion (or on reuse), sizes come from llama-quantize --dry-run for Q2_K, Q3_K_M, Q4_K_S, Q4_K_M, Q5_K_M, Q6_K, and Q8_0. A recent llama.cpp build with --dry-run support is required.
Before downloading weights, the command checks additional download space, the F16 intermediate, and all selected outputs together. Shared filesystems are accounted for together; separate cache/model filesystems are checked separately. Completed cached files and existing intermediates aren't counted as new allocations. Before F16 exists, disk planning reserves an F16-size bound per selected quant; once it exists, output reserves use llama.cpp's size estimates plus margin. F16 estimates use cached tensor headers or Hub parameter metadata when available, otherwise a conservative source-size bound. Space is rechecked after download and before each quant. These are estimates, not disk reservations; other processes and unusual conversions can still exhaust space. Figures are in GiB and use actual filesystem free space, not Finder's potentially larger purgeable-space figure.
Downloads use the normal HuggingFace cache and existing HF_TOKEN authentication for gated/private repos. HuggingFace /tree/<revision> URLs preserve their branch/tag/commit; --revision <ref> overrides the URL revision (otherwise defaulting to main). On each use, remote commit metadata is compared with the cached revision. A changed revision prompts before using it; declining keeps the cached version. --yes alone never silently switches revisions; use --update to authorize that or --cached to skip the network check entirely. If a version check fails, interactive use offers the cached version. Explicit 40-character commit pins are honored. Subfolder and individual file URLs are not supported. Repository Python is not downloaded or executed.
The preview compares weight size plus estimated runtime overhead against total machine RAM, separately reporting current RAM availability. A model that fits the machine but exceeds currently available memory says free RAM first, not that the machine cannot run it. Estimates using over 80% of total RAM are labeled a tight machine fit (limited OS headroom); only estimates exceeding physical RAM say exceeds total RAM. --ctx controls the estimate only (default 4096, one sequence, F16 KV); it does not save launch settings. KV estimates are only made for recognized conventional attention architectures. Other architectures show runtime fit as unknown and runtime sizes as lower bounds. These are heuristics, not load tests, and do not guarantee GPU VRAM fit, speed, or conversion-time RAM usage. Other running servers reduce current availability; CPU offload may be necessary on discrete-GPU systems.
Completed files are published as <repo-name>.<QUANT>.gguf in models_dir, ready for the normal picker. If a different revision/untracked file already occupies that name, the new filename includes the revision prefix. Existing files are never overwritten, completed quants are skipped, and failed conversions never appear as models. History tracks outputs by source revision, not just by filename.
Cache, retries, and cleanup:
- Bare
quantizediscovers existing language-model safetensors snapshots in the HuggingFace cache (including downloads from before this feature), and shows a numbered picker with revision, F16 readiness, and completed quants. Select a source to make another quant, ord <number>to clear it. The info panel also offersdto clear. No network version check occurs until a source is selected. - Downloaded weights live under
~/.cache/huggingface/hub/by default (honoringHF_HOME/HF_HUB_CACHE). Completed files are reused for retries and different quants of the same revision. Hub may resume partial downloads, depending on transport/version; preflight conservatively budgets incomplete files as full downloads. - F16 intermediates are retained by default in hidden
.luallm-quantize-*directories undermodels_dir, registered only after successful conversion, validated before reuse, and automatically reused for the same revision.--keep-intermediateremains a compatibility no-op. Failed partial conversions restart; failed quantization can reuse its successful F16 conversion. Staged results are removed after successful publication; failures remain available for explicit cleanup. - 30-day reminders appear when using
quantizefor sources not used for 30 days. Merely listing caches doesn't refresh last-used time. Nothing is silently expired or deleted. Registry/history lives in~/.cache/luallm/quantize/state.json(honoringXDG_CACHE_HOME, or configurequantize_cache_dir). These caches normally survive reboot but are disposable; missing cached files are handled without deleting finished models. - Clearing cache (
din the picker/panel, orquantize clear [repo-query]) asks for confirmation. It removes the selected HF revision using HuggingFace's scoped deletion strategy, preserving blobs referenced by other revisions. It warns that other apps may use the shared HF cache. Only precisely recorded luaLLM intermediate/staged files are removed; completed GGUFs, unknown work-directory files, local source folders, borrowed intermediates, other repos, and other revisions are preserved. Output history remains after cleanup. - External intermediates can still be supplied with
--reuse-intermediate <path>. The tensor ranges are validated, and quantized/truncated inputs are rejected. These borrowed inputs are never deleted; the source argument supplies the output name, so choose the matching file yourself. - uv's Python/dependency cache is separate, managed by uv, and is not cleared by quantization.
Set llama_cpp_source_dir to a llama.cpp checkout and install uv (brew install uv on macOS). Both conversion and HuggingFace downloads run through uv run --isolated --no-project, using that checkout's requirements/requirements-convert_hf_to_gguf.txt plus huggingface_hub. uv manages Python and caches the isolated dependency environment; no activation, system pip installs, or shared llama.cpp venv are needed. The first invocation needs network access and may take a while to install PyTorch. Optional configuration:
{
"uv_path": "/opt/homebrew/bin/uv",
"python_version": "3.12",
"llama_quantize_path": "/path/to/llama.cpp/build/bin/llama-quantize"
}uv_path defaults to uv on PATH; python_version defaults to 3.12. The old python_path setting is no longer used. The quantizer is otherwise found beside llama_cpp_path or under the checkout's build/bin/.
luallm bench <model> # run benchmark sweep (5 runs, 1 warmup)
luallm bench <model> --n 10 # 10 measured runs
luallm bench <model> --warmup 2 # 2 warmup runs
luallm bench <model> --threads 8
luallm bench show # view saved results (picker)
luallm bench show <model> # view results for a specific model
luallm bench compare <A> <B> # side-by-side comparison with deltas
luallm bench compare <A> <B> --verbose # include hardware and build details
luallm bench clear # delete all saved benchmark dataPreset Recommendations:
luallm recommend throughput <model> # benchmark sweep across threads, KV cache types, flash attention
# finds the fastest flags and saves them as a preset
luallm recommend cold-start <model> # generates a preset optimized for fast model loading
# (small context, reduced GPU layers, no flash attention)
luallm run <model> --preset throughput # use the saved preset
luallm start <model> --preset cold-startThe throughput profile tests combinations of thread counts, KV cache quantization (q8_0, q4_0), and flash attention, then saves the winner. The cold-start profile generates a static preset tuned for minimum time-to-first-token.
luallm doctor # validate config, check binaries, count models
luallm config # show config file path
luallm rebuild # git pull + rebuild llama.cpp from source
luallm clear-history # reset run history
luallm test # run the test suiteluallm help # overview of all commands
luallm help <command> # detailed help for a specific command
luallm help --json # structured JSON output (for tool integration)On first run, a config file is created at ~/.config/luaLLM/config.json. See config.example.json for a full example.
{
"llama_cpp_path": "/usr/local/bin/llama-server",
"llama_bench_path": "/usr/local/bin/llama-bench",
"llama_cli_path": "/usr/local/bin/llama-cli",
"llama_cpp_source_dir": "/home/user/llama.cpp",
"models_dir": "/home/user/models",
"recent_models_count": 7,
"default_port": 8080,
"default_params": ["-c 4096", "--host 127.0.0.1", "--threads 8"],
"bench": {
"default_n": 5,
"default_warmup": 1,
"default_ctx": 2048,
"default_gen": 256,
"default_batch": 512,
"default_threads": 8
},
"cmake_options": [
"-DGGML_METAL=ON",
"-DGGML_METAL_EMBED_LIBRARY=ON",
"-DGGML_USE_FLASH_ATTENTION=ON",
"-DLLAMA_BUILD_SERVER=ON",
"-DCMAKE_BUILD_TYPE=Release"
],
"model_overrides": {
"codellama": ["-c 16384", "--gpu-layers 35"],
"llama%-3.*70b": ["-c 8192", "--gpu-layers 40", "--threads 16"],
"mistral": ["-c 8192"]
}
}| Key | Required | Description |
|---|---|---|
llama_cpp_path |
Yes | Path to llama-server binary |
models_dir |
Yes | Directory containing .gguf model files |
default_params |
No | Default flags passed to llama-server on every run |
default_port |
No | Default port for llama-server (default: 8080) |
recent_models_count |
No | Number of recent models shown in picker (default: 4) |
llama_bench_path |
No | Path to llama-bench (auto-resolved from llama_cpp_path if not set) |
llama_cli_path |
No | Path to llama-cli |
llama_cpp_source_dir |
No | Path to llama.cpp source for rebuild command |
llama_quantize_path |
No | Explicit llama-quantize binary for quantize (otherwise auto-resolved) |
uv_path |
No | uv executable for isolated Python conversion/download environments (default: uv on PATH) |
python_version |
No | Python version managed by uv for conversion/downloads (default: 3.12) |
quantize_cache_dir |
No | Quantization history/lock directory (default: ~/.cache/luallm/quantize, honoring XDG_CACHE_HOME) |
cmake_options |
No | CMake flags used by rebuild |
bench.default_n |
No | Default number of benchmark runs |
bench.default_warmup |
No | Default warmup runs before measuring |
bench.default_threads |
No | Default thread count for benchmarking |
bench.default_ctx |
No | Default context size for benchmarks |
bench.default_gen |
No | Default generation length for benchmarks |
bench.default_batch |
No | Default batch size for benchmarks |
model_overrides |
No | Pattern-based per-model parameter overrides (see below) |
thinking |
No | Pattern-based per-model reasoning/thinking settings (see below) |
The model_overrides keys are Lua patterns matched against model filenames. Any model whose filename contains the pattern will use those additional flags:
{
"model_overrides": {
"codellama": ["-c 16384"],
"llama%-3": ["--gpu-layers 35"],
"mistral.*7b": ["-c 8192"]
}
}Both codellama-7b-v1.5.gguf and codellama-13b-v2.gguf match "codellama". Note the %- escape — - is a special character in Lua patterns.
If several patterns match, only one applies: an exact model name wins, otherwise the longest pattern (ties broken alphabetically).
You usually don't need to set --temp, --top-k and friends. Most GGUFs carry the model authors' recommended sampling values (general.sampling.*, converted from the repo's generation_config.json), and llama-server applies them automatically. Anything the GGUF doesn't set falls back to llama.cpp's defaults (temp 0.8, top-k 40, top-p 0.95, min-p 0.05).
luallm info <model> shows the values a model will start with and where each comes from. Putting sampling flags in default_params, model_overrides or a preset replaces the model's own values; luaLLM warns at launch when they differ.
For a GGUF without sampling values, luallm hf <url> <model> imports them without needing an AI: it reads generation_config.json from the repo, then from its base models (via the HuggingFace API, so GGUF repos, fine-tunes and merges work), then flags written in the model card. A local LLM is only asked if all of those come up empty. Values the GGUF already has are left out of the preset.
Thinking is controlled by llama-server and the model's own chat template, and each template honours different controls. Use luallm info <model> to see what a model supports. It reads the template straight from the GGUF, so it works even for models you haven't run yet:
Thinking:
On/off: supported via --reasoning on|off (default: on)
Effort: supported via --reasoning-effort (levels: high, xhigh, medium, low), default xhigh
Budget: --reasoning-budget N works for any thinking model
Configure it per model with the thinking map. Keys are Lua patterns like model_overrides. An exact model name wins over patterns, and otherwise the longest matching pattern wins (settings are not merged):
{
"thinking": {
"Qwen3%.8": { "enabled": true, "effort": "low", "budget": 4096 },
"Gemma%-4": { "enabled": true }
}
}| Setting | llama-server flag | Notes |
|---|---|---|
enabled |
--reasoning on|off |
Sets the template's enable_thinking. Some templates default to off (e.g. Gemma 4). |
effort |
--reasoning-effort <level> |
Only does anything if the template reads reasoning_effort. Often just a hint sentence in the system prompt. |
budget |
--reasoning-budget N |
Hard cap on thinking tokens. 0 = no thinking, -1 = unlimited. Works regardless of template. |
budget_message |
--reasoning-budget-message |
Text injected when the budget runs out. |
preserve |
--reasoning-preserve / --no-reasoning-preserve |
Keep reasoning from earlier turns in the prompt. |
At launch luaLLM warns when a setting can't take effect, e.g. an effort the template doesn't accept, or a template that hardcodes enable_thinking. Flags passed on the command line come last, so they override these settings. Settings apply when the server starts, so restart a running server (luallm stop <model>) after changing them.
| Command | Description |
|---|---|
luallm |
Interactive picker (pinned + recent models) |
luallm <model> |
Fuzzy-match and run a model |
luallm run <model> |
Run with optional --preset |
luallm start <model> |
Start as background daemon |
luallm stop <model|all> |
Stop running server(s) |
luallm status |
Show server status |
luallm hf <url> [model] |
Import recommended settings from a HuggingFace page as an hf preset |
luallm logs <model> |
View daemon logs (--follow) |
luallm list |
List all models (--json) |
luallm info <model> |
Show model metadata (--kv, --raw) |
luallm pin/unpin <model> |
Pin or unpin a model |
luallm pinned |
List pinned models |
luallm notes <model> |
View/add/edit model notes |
luallm bench <model> |
Run benchmarks |
luallm bench show/compare |
View or compare benchmark results |
luallm recommend <profile> |
Generate optimized presets |
luallm join |
Merge multi-part GGUF files |
luallm quantize [repo|directory] |
Cached-source picker, size/RAM previews, and safetensors-to-GGUF conversion |
luallm quantize clear [repo] |
Clear a source/intermediate cache revision, preserving finished GGUFs |
luallm doctor |
Run diagnostics |
luallm config |
Show config file path |
luallm rebuild |
Rebuild llama.cpp from source |
luallm clear-history |
Clear run history |
luallm help [command] |
Show help (--json) |
luallm test |
Run test suite |
| Path | Contents |
|---|---|
~/.config/luaLLM/config.json |
Configuration |
~/.config/luaLLM/history.json |
Run history |
~/.config/luaLLM/pins.json |
Pinned models |
~/.config/luaLLM/model_info/ |
Cached model metadata |
~/.config/luaLLM/notes/ |
Per-model markdown notes |
~/.config/luaLLM/bench/ |
Benchmark results |
~/.cache/luallm/state.json |
Server state (running/stopped) |
~/.cache/luallm/logs/ |
Daemon log files |
~/.cache/luallm/pids/ |
Daemon PID files |
~/.cache/luallm/quantize/state.json |
Quant source revisions, cache usage, and completed-output history |