Nodes/comfyui-llamacpp-plus/LlamaCPP Preload Model
ComfyUI Node

LlamaCPP Preload Model

Warm the LLM Without Blocking Your Graph

By pointave·Created 8 months ago·Updated 22 days ago· 4
LlamaCPP Preload Model
  • connectivity
  • anything
  • output
◄clear_vramtrue►

So you're running a local LLM next to your diffusion model - a prompt enhancer, a captioner, something that writes structured prompts before the sampler ever fires. The annoying part isn't the output. It's the wait: you hit Queue, and the whole run sits there while llama.cpp makes the OS read a 20 GB GGUF off disk into VRAM. LlamaCPP Preload Model exists to eat that wait somewhere harmless.

This is one node out of the comfyui-llamacpp-plus pack, and its whole job is one line of jargon: start the load now, in the background, and don't block anything.

What it actually does

There's no model loading in this node. The pack never touches a .gguf file itself - everything goes over HTTP to a llama-server you're running separately. Same architecture as Ollama or LM Studio (which serves the identical /v1 API, so it works here), just without a middleman app.

The load is provoked by a throwaway request. The node POSTs a one-token chat completion - a message that literally says Hi, max_tokens: 1 - to your server's /v1/chat/completions. llama.cpp treats any inference request against an unloaded model as "load it first," so that dummy request is what pulls the weights in. It runs on a background daemon thread, so the node returns immediately while the model is still loading.

That request is also why it's a warmup and not a guarantee. The node prints [LlamaCPP] preload started for <model> (background) and gets out of the way. If your LlamaCPP Chat node runs two seconds later, it may still arrive mid-load and pay the remainder.

It's also marked non-idempotent, so it fires fresh on every queue - no cached no-op hiding the load.

The inputs that matter

Three in, one out.

  • connectivity - wired from the pack's LlamaCPP Connectivity node. That's where the server URL lives (default http://127.0.0.1:8081), plus the model name and the keep_alive setting. The tooltip is blunt: "Wire a LlamaCPP Connectivity node here."
  • clear_vram - the one you'll actually think about. Default on. Before firing the load, it runs ComfyUI's unload_all_models() plus a cache empty, which is exactly what the popular easy-use "Clean VRAM Used" node does. The author's own framing: turn it off when the model fits.
  • anything - a passthrough (*), and its tooltip explains the design: "The load fires when this node runs, so wire it where you want the model warm." Wire it mid-chain and it runs at that point in the chain rather than whenever the frontend feels like it.

output is that same value handed straight back - anything in, same type out. Slots into an existing chain without conversion, which is the point.

Install

ComfyUI Manager: search comfyui-llamacpp-plus and install. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/pointave/comfyui-llamacpp-plus

Restart ComfyUI after. The repo's README shows your-username in that clone URL, which is a leftover placeholder - use the real path above.

requirements.txt is two lines, playwright and openai. Manager installs them for you; the Playwright browser download (playwright install chromium, needed for the HTML visualization node) is a separate step and irrelevant to this node. You also need a llama.cpp server running - llama-server -m your-model.gguf --port 8081, matching the URL in your Connectivity node.

One honest aside: LLM nodes are arbitrary Python with network access, the exact shape that's been weaponized once in this ecosystem. This pack is MIT and plain readable code - worth five minutes if you're the cautious type.

Where people get burned

clear_vram on by default is a trap for workflows where the LLM already fits. It evicts all ComfyUI models - including the 20 GB diffusion checkpoint you just spent a minute loading. So the "free VRAM" you make for the LLM gets paid back on the next sampler run, from disk. If your card holds both, turn it off. If it doesn't, leave it on and accept the reload.

"Nothing happened" is the normal experience. No output preview, no progress bar. Check the console for [LlamaCPP] preloaded model <name>; a failure prints [LlamaCPP] preload of <name> failed: ... and is otherwise swallowed, because it's a daemon thread and nothing is waiting on it.

An empty model dropdown means the URL is wrong, not the node. The dropdown is populated by hitting <your url>/v1/models, so if the server isn't up - or you left the default 8081 while your server is on llama.cpp's usual 8080 - the list comes back empty. Start the server first, then refresh.

Wiring it immediately before the Chat node buys you little. The load is async by design; the gain comes from ordering it early, where the wait overlaps with ComfyUI loading its own models.

CategoryLlamaCPP API

Inputs (3)

NameTypeDefaultDescription
connectivityLLAMACPP_CONNECTIVITYWire a LlamaCPP Connectivity node here.
anything*Passthrough. The load fires when this node runs, so wire it where you want the model warm.
clear_vramBOOLEANtrueUnload all ComfyUI models and empty the GPU cache first (like easy-use's Clean VRAM Used), freeing VRAM for the LLM. Turn off when the model fits.

Outputs (1)

NameTypeDescription
output*—