FastLoadAI is a Go command-line tool that downloads Hugging Face GGUF models
or converts safetensors checkpoints to GGUF, fits them to the machine, and runs
local inference through llama.cpp.
It detects the CPU, RAM, disk and GPU, chooses a quantization that fits, writes
a runtime plan, and opens a streaming chat through llama-server. Everything
runs locally: no prompt or model data leaves the machine.
- Hardware-aware model and quantization selection.
- Real file sizes from the Hugging Face API, including sharded GGUF files.
- Native Go safetensors β GGUF conversion: tokenizer, chat template and weights in one file.
- Parallel shard downloads with an auto-tuned worker pool (up to 16 workers).
- Hardware probing, Hugging Face metadata and doctor checks run concurrently.
- One-command download and chat:
fastloadai run qwen2.5-0.5b. - Automatic optimization profiles:
auto,speed,balanced,memoryandquality. - Adaptive parameter budgeting: reads GGUF metadata and free RAM/VRAM, then keeps a large model inside the machine with mmap streaming instead of crashing.
- Prompt-aware effort tiers (
auto,light,standard,deep) that scale context, KV cache, batches and model routing. - MoE-aware CPU expert offload, GPU expert cache and tensor placement overrides.
- Flash Attention, split K/V cache quantization, unified KV, prompt-cache RAM limits and slot persistence.
- RoPE scaling/YaRN, SWA checkpoints, CPU affinity for hybrid P/E-core CPUs and startup tuning.
- Speculative decoding with ngram lookup or a separate draft model.
- Batch/ubatch, parallel slots, thread-batch, NUMA, GPU split and priority tuning.
- Full-screen chat UI with streaming, scrollback, input history, a welcome panel and a status bar.
/copyfor the terminal clipboard,/savefor a Markdown transcript, and/retryfor regeneration.- Optional file and web tools: sandboxed read/write, DuckDuckGo/Wikipedia search and page fetch.
- Streaming chat with history trimming, retry, context usage and session stats.
- A polished terminal UI with a banner, spinner, colour themes and summaries.
- CPU and NVIDIA GPU detection, Apple Silicon unified memory support.
- Container-aware limits from cgroups, so Docker memory and CPU caps are honoured.
scan,suggest,download,convert,plan,optimize,budget,models,doctor,runandquantize.- JSON output for scripts on
scan,suggestandmodels.
- Go 1.24 or newer to build from source.
- A
llama.cppbuild that providesllama-server. llama-quantizeonly for the optionalquantizecommand.- Git and curl for the one-line installer.
The installer downloads an official CPU build of llama.cpp. For GPU builds,
install llama.cpp yourself and keep llama-server on PATH.
curl -fsSL https://raw.githubusercontent.com/ciao22king/FastLoadAI/main/install.sh | shThe installer clones the repository into ~/.local/share/fastloadai, builds the
Go binary into ~/.local/bin/fastloadai, and installs llama-server,
llama-cli and llama-quantize when they are missing.
Build manually:
git clone https://github.com/ciao22king/FastLoadAI.git
cd FastLoadAI
go build -o fastloadai ./cmd/fastloadai
./fastloadai --helpEvery tagged release publishes Linux tarballs and Debian packages. The
Packages workflow also publishes an unsigned APT repository on GitHub Pages.
The package is submitted to TUR. Once it is accepted:
pkg install tur-repo
pkg install fastloadaiYou can also download the .deb for your architecture from the latest GitHub
release and install it directly:
pkg install ./fastloadai_<version>_aarch64.debUse the x86_64 file on Intel Chromebooks and Android emulators. Or use the
GitHub Pages APT repository:
echo "deb [trusted=yes] https://ciao22king.github.io/FastLoadAI/termux stable main" \
> "$PREFIX/etc/apt/sources.list.d/fastloadai.list"
pkg update
pkg install fastloadaiThe Termux package depends on llama-cpp, which provides llama-server and
llama-quantize.
echo "deb [trusted=yes] https://ciao22king.github.io/FastLoadAI/debian stable main" \
| sudo tee /etc/apt/sources.list.d/fastloadai.list
sudo apt update
sudo apt install fastloadaiThe Debian package contains only the FastLoadAI binary. Install llama.cpp
separately so llama-server is on PATH.
The APT repositories are not GPG-signed, so [trusted=yes] is required. Use
them only if you trust this repository and the GitHub Pages deployment.
go install github.com/ciao22king/FastLoadAI/cmd/fastloadai@latestThe repository is a flake:
nix run github:ciao22king/FastLoadAI
nix build .#fastloadai
nix profile install .#fastloadaiInside a checkout, nix develop provides Go and gopls. The package builds
with CGO_ENABLED=0, so the result is a static binary.
For pkg packages, see Prebuilt packages above. To build the
Termux recipe yourself, copy it into a termux-packages checkout:
cp -a packaging/termux/fastloadai /path/to/termux-packages/packages/
cd /path/to/termux-packages
./build-package.sh fastloadaiFrom a non-Android host, use the Termux Docker wrapper:
./scripts/run-docker.sh ./build-package.sh fastloadaiThe package depends on llama-cpp, which provides llama-server and
llama-quantize. It is limited to 64-bit Termux because llama-cpp does not
support 32-bit Android.
fastloadai scan
fastloadai suggest
fastloadai run qwen2.5-0.5brun downloads the best fitting quantization when the model is not present,
then opens the full-screen chat. Ask a question, or use /help inside the chat.
fastloadai run qwen2.5-0.5b --prompt "Explain GGUF in one sentence." --onceGive the model a sandbox and web access with --tools:
fastloadai run qwen2.5-0.5b --tools --workdir ./sandbox \
--prompt "Create hello.py that prints hello, then search the web for Go 1.24 release notes." --onceThe model can read and write files only under --workdir (default: the
current directory). It cannot run shell commands.
A Hugging Face repository with safetensors weights works without a GGUF file:
fastloadai run Qwen/Qwen2.5-0.5B-Instruct --prompt "The capital of France is" --once
fastloadai run ./qwen-src --no-tuirun downloads the checkpoint, converts it in Go, and starts the same chat.
The conversion is cached next to the model directory.
The full-screen chat is used when both stdin and stdout are terminals. It has a
conversation viewport, a multi-line input box, a status bar and streaming
answers. Use --no-tui to force the plain line-based chat, for example in a
terminal multiplexer that does not support alternate screens.
fastloadai scan
fastloadai scan --json
fastloadai suggest
fastloadai suggest --json
fastloadai download Qwen/Qwen2.5-0.5B-Instruct-GGUF
fastloadai download Qwen/Qwen2.5-0.5B-Instruct-GGUF --dry-run
fastloadai download Qwen/Qwen2.5-0.5B-Instruct-GGUF --prefer quality
fastloadai download Qwen/Qwen2.5-7B-Instruct-GGUF --workers 8
fastloadai download Qwen/Qwen2.5-0.5B-Instruct
fastloadai convert ./qwen-src --output ./qwen2.5-0.5b-bf16.gguf
fastloadai models
fastloadai models --json
fastloadai plan ./model.gguf --output config.json
fastloadai optimize qwen2.5-0.5b --profile speed
fastloadai optimize ./model.gguf --prompt "Explain step by step how TCP works"
fastloadai budget ./model.gguf --prompt "hello"
fastloadai optimize ./model.gguf --profile memory --kv-cache q4_0
fastloadai optimize ./model.gguf --kv-cache-k q8_0 --kv-cache-v f16 --cache-ram 2048
fastloadai optimize ./model.gguf --rope-scaling yarn --rope-scale 2 --yarn-orig-ctx 32768
fastloadai optimize ./model.gguf --swa-checkpoints 8 --checkpoint-min-step 2048
fastloadai optimize ./model.gguf --cpu-range 0-7 --no-repack --no-warmup
fastloadai doctor
fastloadai run
fastloadai run qwen2.5-0.5b
fastloadai run qwen2.5-0.5b --no-tui
fastloadai run qwen2.5-0.5b --tools --workdir ./sandbox
fastloadai run Qwen/Qwen2.5-0.5B-Instruct-GGUF
fastloadai run --auto --prompt "Introduce yourself." --once
fastloadai run --prompt "Explain step by step how TCP works" --once
fastloadai run --low-memory --ctx-size 1024
fastloadai run --ctx-size 8192 --threads 6 --temperature 0.4
fastloadai run qwen2.5-0.5b --profile speed --flash-attn on --kv-cache q8_0
fastloadai run qwen2.5-0.5b --speculative --no-tui
fastloadai run qwen2.5-0.5b --draft-model ./draft.gguf --draft-max 4
fastloadai quantize ./model.gguf ./model-Q4_K_M.gguf --type Q4_K_M
fastloadai --versionscan prints the detected platform, CPU, CPU threads, total and free RAM, free
disk, GPU and the estimated model budget. --json returns the raw object.
suggest ranks catalog models by size and marks the best recommendation for
this machine. It prints the exact run command to copy.
download inspects the GGUF files in a Hugging Face repository, downloads the
best quantization that fits, and writes the runtime config. If the repository
has no GGUF files, it downloads the safetensors checkpoint and converts it to a
self-contained GGUF instead. --prefer balanced
(default) targets a 4-5 bit K-quant, speed targets 4 bit, and quality
targets 8 bit. --file selects an exact file or shard. --workers sets the
parallel download width; 0 (default) auto-tunes it from the CPU count, with a
minimum of 4 and a maximum of 16, never more than the shard count. --dry-run
shows the choice, worker count and memory fit without downloading. Sharded
models are downloaded together and verified against the API size. If nothing
fits, the command refuses unless --force is set.
models lists downloaded GGUF files, grouped by shard, with size,
quantization and fit. --json is available for scripts.
plan writes a runtime config for this machine. Pass a local GGUF path to
include its size and fit. Optimization flags are accepted here too.
optimize inspects a model, detects whether it is a Mixture of Experts model,
and writes the best llama.cpp flags for the chosen profile. It is the explicit
way to inspect or change the runtime plan without starting a server. Use
--json to print the resulting config.
budget is a read-only view of the adaptive planner. It reads the real GGUF
header, measures free RAM/VRAM, and prints how many parameters fit, how many
stay resident, how many stream from mmap, the chosen GPU layers, KV type,
context, batch size and a residency bar. It never starts a server or downloads
a model. Use --json for scripts and --prompt to see the effort tier.
doctor checks Go, RAM, disk, GPU, llama-server, llama-quantize, network
access to Hugging Face, the config file, the model path and the model fit. It
exits non-zero when a required piece is missing.
run resolves a catalog name, Hugging Face repo ID, recorded repo or local GGUF
path. If the model is missing, it downloads the best fit first, then starts
llama-server on 127.0.0.1 and opens the chat. Useful options:
--autopicks a local model first, then a catalog model, using the prompt effort and the memory budget. Light prompts stay on small models; deep prompts may use the largest model that fits.--effort auto|light|standard|deepoverrides the prompt classifier.--adaptive=falsedisables automatic parameter budgeting and keeps the profile values exactly as written.--prefer speed|balanced|qualitycontrols automatic downloads.--promptsends a first message;--onceanswers it and exits.--threads,--ctx-size,--gpu-layersoverride the plan.--temperature,--max-tokensand--systemtune generation.--low-memoryforces a small context and small batches.--profile auto|speed|balanced|memory|qualityselects an optimization plan.--flash-attn,--kv-cache,--kv-cache-k,--kv-cache-v,--speculativeand--draft-modeltune inference.--kv-unified/--no-kv-unified,--cache-ram,--slot-save-pathtune the KV and prompt cache.--rope-scaling,--rope-scale,--yarn-orig-ctx,--swa-checkpointsand--checkpoint-min-stepextend context and checkpointing.--cpu-mask/--cpu-range,--no-repackand--no-warmuptune CPU affinity and startup.--cpu-moe,--n-cpu-moe,--moe-cache-miband--override-tensortune MoE.--batch-size,--ubatch-size,--threads-batch,--paralleland--no-cont-batchingtune batching.--load-mode,--mlock,--no-mmap,--lazy-mode,--no-kv-offloadtune memory.--cache-reuse,--context-shift,--swa-full,--numa,--split-mode,--tensor-split,--priorityand--pollare advanced knobs.--token,--revision,--forceand--workerswork likedownload.--toolsenables sandboxed file read/write, web search and URL fetch.--workdirsets the sandbox root;--max-tool-roundslimits tool iterations (default 4).--no-tuiuses the plain line-based chat instead of the full-screen UI.--no-colordisables ANSI colour for logs and CI.
convert reads a Hugging Face checkpoint directory (config.json,
tokenizer.json, tokenizer_config.json and one or more *.safetensors
shards) and writes one GGUF file with the weights, tokenizer, special tokens
and chat template embedded. --output chooses the destination and --json
prints a machine-readable summary. Supported source types are F32, F16 and
BF16 for Qwen2, Llama and other byte-level BPE models. The conversion
keeps the source precision; it does not quantize. A tied embedding is written
once, so the output stays compact. run and download call the same converter
automatically and cache the result.
quantize runs llama-quantize on an existing GGUF file.
| Key | Action |
|---|---|
Enter |
Send the message |
Ctrl+J |
Insert a newline without sending |
β / β |
Browse input history |
β / β |
Move the cursor |
Home / End |
Jump to the start or end of the line |
PgUp / PgDn |
Scroll the conversation |
Tab |
Complete a slash command |
Ctrl+C |
Cancel while streaming, or exit when idle |
Ctrl+D |
Exit when the input is empty |
| Command | Action |
|---|---|
/help |
Show the command list |
/stats |
Show turns, tokens, speed and elapsed time |
/context |
Show context-window usage with a bar |
/retry |
Regenerate the last answer |
/copy |
Copy the last answer to the terminal clipboard (OSC 52) |
/save |
Save the conversation as a Markdown file |
/tools |
Show whether file and web tools are enabled |
/clear |
Reset the conversation and session stats |
/exit, /quit |
Close the chat and stop the server |
Ctrl+C and Ctrl+D also end the chat. When a session ends, FastLoadAI prints
a compact summary with turns, tokens, speed and time.
History is trimmed by estimated token budget, not by a fixed message count, so
long conversations stay inside the context window. Without --tools, the chat
has no file or shell access; it only sees the conversation.
Tools are opt-in. Start the chat with --tools; without it, the model can only
see the conversation. The file sandbox is the --workdir directory (default
.). Paths containing .., symlinks that escape the root, and .git, .ssh,
.aws or .openhands are rejected. Existing absolute paths are rejected too;
a nonexistent absolute path is reduced to its file name inside the sandbox,
because small models often invent paths such as /home/you/hello.py.
| Tool | Arguments | What it does |
|---|---|---|
write_file |
path, content |
Create or overwrite a file, including parent directories. |
read_file |
path |
Read one UTF-8 text file. |
list_files |
path |
List files under the sandbox, up to 200. |
search_web |
query |
Search DuckDuckGo and Wikipedia, returning titles, URLs and snippets. |
fetch_url |
url |
Fetch a public http/https page and return readable text. |
FastLoadAI sends OpenAI-compatible tool schemas to llama-server and enables
its Jinja chat template. The model answers with native tool_calls; a fenced
tool block is still parsed as a fallback for models without tool support:
```tool
{"name":"write_file","arguments":{"path":"hello.py","content":"print('hello')\n"}}
```
FastLoadAI executes the call, prints a tool βΊ card with the result and sends
the result back to the model. The loop stops after --max-tool-rounds (default 4)
or when the model answers without a tool block. Tool output is treated as
untrusted data: a web page cannot grant itself new permissions.
Private and loopback URLs are blocked by fetch_url; only public pages are
reachable. write_file is limited to 2 MiB, read_file to 256 KiB, and
fetch_url to 12,000 characters of readable text. There is no shell tool.
Each config records the detected hardware and the recommended settings: CPU threads, context size, mmap, model fit, low-memory mode and GPU offload.
The model budget uses currently available RAM, not total RAM, so it adapts to
other applications and to container limits. Hardware probes, Hugging Face
metadata and runtime checks run in parallel, and run reuses one hardware scan
for both download planning and chat setup. CPU threads use every logical CPU
visible to the process, including cgroup limits, capped at 32; override with
--threads. The context starts at 1K-8K
depending on free memory and doubles when the model leaves at least 4 GB of
headroom, capped at 8K. mmap lets llama.cpp map weights and load pages on
demand. The estimate is conservative, not a guarantee against running out of
memory.
The adaptive layer answers one question before llama-server starts: how much
of this model can this machine hold right now, and how much should stay on
disk? It reads the GGUF header directly (tensor shapes, block count, attention
heads, KV heads, expert count and context length), so the answer is based on
the real file, not on its name.
The planner splits the machine into a RAM pool and a VRAM pool, reserves room for the operating system, the KV cache and runtime buffers, and then chooses:
- the number of parameters that fit at the current quantization;
- the active parameter count for MoE models, using the expert ratio;
- how many layers go to the GPU and how many experts stay on the CPU;
- a safe context size, batch size and KV cache type for the effort tier;
- mmap streaming when the model is larger than the budget.
Streaming mode is the safety valve. Instead of forcing all weights into anonymous memory and letting the OOM killer stop the process, FastLoadAI leaves the weights in the mmap page cache and lets the kernel evict pages. The model starts, answers more slowly, and the planner reports the trade-off:
fastloadai budget ./Qwen2.5-32B-Instruct-Q4_K_M.gguf Residency [ββββββββββββββββββββββββββββ] STREAMING
Why:
standard effort: 18.0 GB model does not fit in 9.0 GB RAM+VRAM; mmap streaming
keeps 13.5B of 30.0B params resident, ctx 4096, 0/80 GPU layers.
Effort tiers are deliberately cheap to compute: prompt length, code fences,
question count and a small list of reasoning markers. No tokenizer or model
call is needed. light uses a 2K context, q4_0 KV and small batches;
standard uses 4K and q8_0; deep uses 8K. An explicit --ctx-size,
--gpu-layers, --batch-size or KV flag always wins over the adaptive value.
GPU offload is enabled for NVIDIA GPUs when the model fits 60% of VRAM, and for Apple Silicon unified memory when the model fits the budget. AMD and Intel GPUs run on CPU, which is safe and still works.
FastLoadAI writes one config with all runtime settings. optimize, plan,
download and run share the same flags, and run reuses the profile saved in
the config unless a flag overrides it.
| Profile | Goal | Typical choices |
|---|---|---|
auto |
Pick from the hardware and model fit | balanced, or memory when RAM is tight |
speed |
Fastest short answers | Flash Attention on, F16 KV, large batches, KV reuse, context shift, no warmup |
balanced |
Good default | Flash Attention auto, Q8_0 KV for 8K+ context, KV reuse |
memory |
Smallest RAM/VRAM footprint | Q4_0 KV, 128-token batches, half the batch threads, no KV offload, prompt cache off, no repack |
quality |
Least numerical loss | F16 KV, no speculative decoding, conservative batching |
The optimization layer covers these techniques:
- MoE CPU offload. For Mixture of Experts models, attention and shared
weights stay on the GPU while experts stay in system RAM. FastLoadAI detects
common MoE names (
MoE,Mixtral,Qwen3-30B-A3B,Llama-4-16E,DeepSeek-V3,gpt-oss,OLMoE, and similar) and sets--cpu-moe. Use--n-cpu-moe Nto keep only the first N layers' experts on the CPU, or--override-tensorfor an exact llama.cpp placement rule. - MoE expert cache.
--moe-cache-mibkeeps the hottest experts in VRAM for decode.--moe-cache-cpu-sharelets the CPU compute a share of cache misses instead of uploading them. This is the-cmoe/--moe-cache-mibpath from llama.cpp's MoE cache documentation. - Flash Attention.
--flash-attn on|off|autoselects the fused attention kernel. It is on forspeedandmemory, and automatic forbalancedandquality. - KV cache quantization.
--kv-cachesets both--cache-type-kand--cache-type-v. Use--kv-cache-kand--kv-cache-vindependently, for example--kv-cache-k q8_0 --kv-cache-v f16to save memory on keys while keeping values at full precision. Common values aref16,bf16,q8_0,q5_1,q4_0andiq4_nl; support depends on the llama.cpp build. - KV buffer and prompt cache.
--kv-unifiedshares one KV buffer across slots (-kvu), while--no-kv-unifiedkeeps one buffer per slot.--cache-ramlimits the in-RAM prompt cache in MiB (-1unlimited,0disabled); the memory profile and--low-memorydisable it.--slot-save-pathpersists slot KV state between sessions. - Context extension.
--rope-scaling none|linear|yarn,--rope-scale Nand--yarn-orig-ctx Nextend the context beyond the GGUF training size.--swa-checkpoints Nsets context/SWA checkpoints per slot, and--checkpoint-min-step Nsets their minimum spacing (0= no minimum). - CPU affinity and startup. On hybrid Intel CPUs (and Apple Silicon for
reporting), FastLoadAI detects performance and efficiency cores. The
speed,balancedandqualityprofiles pin llama.cpp to the performance cores with--cpu-maskand cap batch threads to their count. Override with--cpu-maskor--cpu-range.--no-repackdisables runtime weight repacking when RAM is tight;--no-warmupskips the empty startup run and is automatic in thespeedprofile and with--once. Use--repackor--warmupto force the opposite when a saved config disabled them. - Speculative decoding.
--speculativeenables ngram lookup decoding with no draft model.--draft-modelloads a smaller draft GGUF and enablesdraft-simple.--spec-typeselects any llama.cpp type, includingdraft-eagle3,draft-mtp,ngram-simpleandngram-map-k.--draft-max,--draft-min,--draft-p-minand--draft-gpu-layerstune the draft. - Batching and slots.
--batch-size,--ubatch-size,--paralleland--no-cont-batchingmap directly to llama.cpp. The memory profile uses small batches; speed and balanced use large ones. - Thread tuning. Decode threads use physical/logical CPU limits from the
hardware scan.
--threads-batchsets prompt-processing threads separately. - Load and memory mode.
--load-mode auto|none|mmap|mlock|mmap+mlock|diocontrols weight loading.--no-mmapis an alias for--load-mode none;--mlockis an alias for--load-mode mmap+mlock.--lazy-modeenables on-demand tensor reads, and--no-kv-offloadkeeps the KV cache on the CPU. - KV reuse and long chats.
--cache-reuse Nreuses matching prompt chunks through KV shifting.--context-shiftkeeps generation going when the context fills.--swa-fulluses the full-size sliding-window cache. - Multi-GPU and NUMA.
--split-mode none|layer|row|tensor,--tensor-split 3,1and--numa distribute|isolate|numactlexpose llama.cpp placement controls. - Scheduling.
--prioritymaps to--prio;--pollmaps to--poll.--no-op-offloaddisables host tensor operation offload when a backend has a bug with it.
Only flags that differ from llama.cpp defaults are written to the command line.
For example, F16 KV cache and --flash-attn auto are omitted, while
--flash-attn on, --cache-type-k q8_0, --kv-unified, --cache-ram 0,
--cpu-moe and --spec-type ngram-simple are passed. Explicit 0 values for
--cache-ram, --swa-checkpoints and --checkpoint-min-step are preserved.
The image is CPU-only and supports linux/amd64 and linux/arm64.
docker build -t fastloadai .
docker volume create fastloadai-data
docker run --rm -it -v fastloadai-data:/data fastloadai run qwen2.5-0.5bThe /data volume keeps models and fastloadai-config.json between runs. Add
-e HF_TOKEN=... for gated repositories. --memory=4g limits the container;
FastLoadAI reads the cgroup limit and chooses settings that fit. Use
run --low-memory on very small limits.
Pre-download without starting the chat:
docker run --rm -v fastloadai-data:/data fastloadai download Qwen/Qwen2.5-0.5B-Instruct-GGUFThe same workflow is available with Compose:
docker compose build
docker compose run --rm fastloadai run qwen2.5-0.5bFastLoadAI generates separate runtime configs and never modifies model files.
convert performs a native Go safetensors β GGUF conversion, and run and
download use it automatically when no GGUF is present. quantize wraps
llama-quantize for further compression. MoE models work when the installed llama.cpp build supports
the architecture; FastLoadAI adds the MoE placement flags but cannot add kernel
support that the build does not have. Optimization flags are forwarded to
llama-server, so an older build may reject a newer flag. Check
llama-server --help or disable the flag with an explicit profile.
GPU detection covers NVIDIA through nvidia-smi and Apple Silicon through
Metal. Other GPUs are treated as CPU-only.
The Go build was tested end to end on a 4-vCPU, 15.6 GB CPU-only container with
the official llama.cpp b12613 build:
| Model | Quant | Context | Verified result |
|---|---|---|---|
| Qwen2.5-0.5B-Instruct | Q4_K_M | 8192 | ~4-5 tok/s (short reply) |
Qwen2.5-0.5B-Instruct, speed profile |
Q4_K_M | 8192 | Flash Attention + KV reuse |
Qwen2.5-0.5B-Instruct, balanced profile |
Q4_K_M | 8192 | Q8_0 KV cache |
Qwen2.5-0.5B-Instruct, memory profile |
Q4_K_M | 4096 | Q4_0 KV cache, 128-token batches, prompt cache off, no repack |
| Qwen2.5-0.5B-Instruct, ngram speculative | Q4_K_M | 8192 | --spec-type ngram-simple |
| Qwen2.5-0.5B-Instruct, draft model | Q4_K_M | 8192 | same file as draft, draft-simple |
| Qwen2.5-0.5B-Instruct, split KV | Q4_K_M | 8192 | K q8_0, V f16, unified KV, 2 GiB prompt cache |
| Qwen2.5-0.5B-Instruct, per-slot KV | Q4_K_M | 8192 | --parallel 2, --no-kv-unified, 512 MiB prompt cache |
| Qwen2.5-0.5B-Instruct, RoPE/SWA | Q4_K_M | 8192 | --rope-scaling yarn --rope-scale 2, SWA checkpoints 8/2048 |
| Qwen2.5-0.5B-Instruct, startup flags | Q4_K_M | 8192 | --no-repack, --no-warmup, --cpu-range 0-3 |
Qwen2.5-0.5B-Instruct, run --auto --prompt hello |
Q4_K_M | 2048 | light effort, q4_0 KV, real reply |
| Qwen2.5-0.5B-Instruct safetensors β GGUF | BF16 | 2048 | 290 tensors, 494M params, real reply |
| Sparse 30B GGUF header, 18 GB file | Q4_K_M | 4096 | streaming plan on a 9 GB budget, no OOM |
The adaptive parser was checked against the real Qwen2.5-0.5B GGUF header (630M parameters, 24 layers, 14 heads, 2 KV heads) and against a sparse 30B GGUF header to exercise the streaming path without downloading 18 GB.
The safetensors converter was checked against the official llama.cpp
convert_hf_to_gguf.py output for the same Qwen2.5-0.5B-Instruct checkpoint:
all 290 shared tensors matched byte for byte. The native file loaded in
llama-server and answered prompts; a synthetic Qwen2 checkpoint covers the
converter, tokenizer, BF16 norm conversion, tied embeddings, shard loading and
cache path in unit tests.
Speeds are short-generation estimates and vary with prompt length, threads and
CPU. The optimization runs above were verified with the real Qwen2.5-0.5B GGUF
and the official llama.cpp b12613 build. MoE detection and placement are
covered by unit tests; the test container had no large MoE GGUF to load.
go test ./...
go vet ./...
go build ./cmd/fastloadaiThe module layout:
cmd/fastloadai/ CLI commands
internal/adaptive/ GGUF metadata, effort tiers and parameter budgeting
internal/catalog/ built-in model catalog and ranking
internal/chat/ streaming chat loop and history trimming
internal/config/ config file read and write
internal/hardware/ CPU, RAM, disk, GPU and cgroup detection
internal/hf/ Hugging Face API, GGUF selection and downloads
internal/safetensors/ safetensors reader and native GGUF writer
internal/llama/ llama-server command, process and readiness
internal/model/ shared data types
internal/optimization/ profiles, MoE detection and llama.cpp flag selection
internal/tui/ terminal UI, colour, tables, spinner and stats