ComfyUI Node
Llama.cpp N-gram Speculative Preset
Configures optional model-free n-gram speculative decoding for the normal Llama.cpp Generate node. It does not use a draft GGUF or the Experimental native DFlash/DSpark API.
Llama.cpp N-gram Speculative Preset
- ngram speculative
◄speculative_modeoff►
◄ngram_size3►
◄num_pred_tokens10►
◄ngram_modek►
◄ngram_min_hits2►
◄ngram_max_entries_per_key8►
◄ngram_sync_check_tokens16►
CategoryOllama/llama_cpp/legacy
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| speculative_mode | COMBO | off | off preserves normal generation. ngram predicts candidates from repeated token patterns already in the current context. |
| ngram_size | INT | 31–8 | Number of verified context tokens used as each lookup key. |
| num_pred_tokens | INT | 101–32 | Maximum candidate tokens proposed per draft call. |
| ngram_mode | COMBO | k | k stores historical positions and uses less memory. k4v caches continuations for cheaper lookup and should use a memory cap. |
| ngram_min_hits | INT | 21–16 | Minimum historical matches required before proposing tokens. |
| ngram_max_entries_per_key | INT | 80–1024 | Maximum stored entries per key. 0 passes None for no explicit cap; a cap is recommended for k4v. |
| ngram_sync_check_tokens | INT | 161–256 | Trailing tokens checked when synchronizing the incremental history index. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| ngram speculative | OLLAMA_IMAGE_LIST_LLAMA_CPP_NGRAM_SPECULATIVE | — |