What happened?
When running:
.\llama-cli -m gemma-2-2b-it-Q4_K_M.gguf --threads 16 -ngl 27 --mlock --port 11484 --host 0.0.0.0 --top_k 40 --repeat_penalty 1.1 --min_p 0.05 --top_p 0.95 --prompt-cache-all -cb -np 4 --batch-size 512 -cnv
The output is blazing fast. When I sent "write a story" these are my speed stats:
llama_print_timings: load time = 1027.95 ms
llama_print_timings: sample time = 683.92 ms / 618 runs ( 1.11 ms per token, 903.62 tokens per second)
llama_print_timings: prompt eval time = 3678.86 ms / 12 tokens ( 306.57 ms per token, 3.26 tokens per second)
llama_print_timings: eval time = 4744.65 ms / 617 runs ( 7.69 ms per token, 130.04 tokens per second)
llama_print_timings: total time = 15385.66 ms / 629 tokens
When I try the same with llama server:
.\llama-server -m gemma-2-2b-it-Q4_K_M.gguf --threads 16 -ngl 27 --mlock --port 11484 --host 0.0.0.0 --top_k 40 --repeat_penalty 1.1 --min_p 0.05 --top_p 0.95 --prompt-cache-all -cb -np 4 --batch-size 512 -cnv
It takes 2-3 seconds before responding to my same "write a story" prompt on localhost. So while it does write fast, it generated at about 103 t/s (a good amount slower than CLI), and it takes a very long time (for my use-case) to start writing.
If the prompt is extremely similar (up to about 1-3 tokens difference at the end) to my last prompt the next generation will start quick, otherwise, it takes 2-3 seconds, even if the prompt is very short. Only extremely short prompts like "hi" or "yo" respond instantly.
Not quite sure why I'm getting such amazing performance with llama-cli but much worse performance when I use it in server mode.
Name and Version
.\llama-cli --version
version: 3578 (1f67436)
built with MSVC 19.29.30154.0 for x64
What operating system are you seeing the problem on?
Windows 11
Relevant log output
For the server:
> .\llama-server -m gemma-2-2b-it-Q4_K_M.gguf --threads 16 -ngl 27 --mlock --port 11484 --top_k 40 --repeat_penalty 1.1 --min_p 0.05 --top_p 0.95 --prompt-cache-all -cb -np 4
--batch-size 512 -cnv
INFO [ main] build info | tid="11744" timestamp=1723514860 build=3578 commit="1f67436c"
INFO [ main] system info | tid="11744" timestamp=1723514860 n_threads=16 n_threads_batch=-1 total_threads=16 system_info="AVX = 1 | AVX_VNNI = 0 | AVX2 = 1 | AVX512 = 0 | AVX512_VBMI = 0 | AVX512_VNNI = 0 | AVX512_BF16 = 0 | FMA = 1 | NEON = 0 | SVE = 0 | ARM_FMA = 0 | F16C = 1 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 1 | SSE3 = 1 | SSSE3 = 1 | VSX = 0 | MATMUL_INT8 = 0 | LLAMAFILE = 1 | "
llama_model_loader: loaded meta data with 39 key-value pairs and 288 tensors from gemma-2-2b-it-Q4_K_M.gguf (version GGUF V3 (latest))
llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output.
llama_model_loader: - kv 0: general.architecture str = gemma2
llama_model_loader: - kv 1: general.type str = model
llama_model_loader: - kv 2: general.name str = Gemma 2 2b It
llama_model_loader: - kv 3: general.finetune str = it
llama_model_loader: - kv 4: general.basename str = gemma-2
llama_model_loader: - kv 5: general.size_label str = 2B
llama_model_loader: - kv 6: general.license str = gemma
llama_model_loader: - kv 7: general.tags arr[str,2] = ["conversational", "text-generation"]
llama_model_loader: - kv 8: gemma2.context_length u32 = 8192
llama_model_loader: - kv 9: gemma2.embedding_length u32 = 2304
llama_model_loader: - kv 10: gemma2.block_count u32 = 26
llama_model_loader: - kv 11: gemma2.feed_forward_length u32 = 9216
llama_model_loader: - kv 12: gemma2.attention.head_count u32 = 8
llama_model_loader: - kv 13: gemma2.attention.head_count_kv u32 = 4
llama_model_loader: - kv 14: gemma2.attention.layer_norm_rms_epsilon f32 = 0.000001
llama_model_loader: - kv 15: gemma2.attention.key_length u32 = 256
llama_model_loader: - kv 16: gemma2.attention.value_length u32 = 256
llama_model_loader: - kv 17: general.file_type u32 = 15
llama_model_loader: - kv 18: gemma2.attn_logit_softcapping f32 = 50.000000
llama_model_loader: - kv 19: gemma2.final_logit_softcapping f32 = 30.000000
llama_model_loader: - kv 20: gemma2.attention.sliding_window u32 = 4096
llama_model_loader: - kv 21: tokenizer.ggml.model str = llama
llama_model_loader: - kv 22: tokenizer.ggml.pre str = default
llama_model_loader: - kv 23: tokenizer.ggml.tokens arr[str,256000] = ["<pad>", "<eos>", "<bos>", "<unk>", ...
llama_model_loader: - kv 24: tokenizer.ggml.scores arr[f32,256000] = [-1000.000000, -1000.000000, -1000.00...
llama_model_loader: - kv 25: tokenizer.ggml.token_type arr[i32,256000] = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, ...
llama_model_loader: - kv 26: tokenizer.ggml.bos_token_id u32 = 2
llama_model_loader: - kv 27: tokenizer.ggml.eos_token_id u32 = 1
llama_model_loader: - kv 28: tokenizer.ggml.unknown_token_id u32 = 3
llama_model_loader: - kv 29: tokenizer.ggml.padding_token_id u32 = 0
llama_model_loader: - kv 30: tokenizer.ggml.add_bos_token bool = true
llama_model_loader: - kv 31: tokenizer.ggml.add_eos_token bool = false
llama_model_loader: - kv 32: tokenizer.chat_template str = {{ bos_token }}{% if messages[0]['rol...
llama_model_loader: - kv 33: tokenizer.ggml.add_space_prefix bool = false
llama_model_loader: - kv 34: general.quantization_version u32 = 2
llama_model_loader: - kv 35: quantize.imatrix.file str = /models_out/gemma-2-2b-it-GGUF/gemma-...
llama_model_loader: - kv 36: quantize.imatrix.dataset str = /training_dir/calibration_datav3.txt
llama_model_loader: - kv 37: quantize.imatrix.entries_count i32 = 182
llama_model_loader: - kv 38: quantize.imatrix.chunks_count i32 = 128
llama_model_loader: - type f32: 105 tensors
llama_model_loader: - type q4_K: 156 tensors
llama_model_loader: - type q6_K: 27 tensors
llm_load_vocab: special tokens cache size = 249
llm_load_vocab: token to piece cache size = 1.6014 MB
llm_load_print_meta: format = GGUF V3 (latest)
llm_load_print_meta: arch = gemma2
llm_load_print_meta: vocab type = SPM
llm_load_print_meta: n_vocab = 256000
llm_load_print_meta: n_merges = 0
llm_load_print_meta: vocab_only = 0
llm_load_print_meta: n_ctx_train = 8192
llm_load_print_meta: n_embd = 2304
llm_load_print_meta: n_layer = 26
llm_load_print_meta: n_head = 8
llm_load_print_meta: n_head_kv = 4
llm_load_print_meta: n_rot = 256
llm_load_print_meta: n_swa = 4096
llm_load_print_meta: n_embd_head_k = 256
llm_load_print_meta: n_embd_head_v = 256
llm_load_print_meta: n_gqa = 2
llm_load_print_meta: n_embd_k_gqa = 1024
llm_load_print_meta: n_embd_v_gqa = 1024
llm_load_print_meta: f_norm_eps = 0.0e+00
llm_load_print_meta: f_norm_rms_eps = 1.0e-06
llm_load_print_meta: f_clamp_kqv = 0.0e+00
llm_load_print_meta: f_max_alibi_bias = 0.0e+00
llm_load_print_meta: f_logit_scale = 0.0e+00
llm_load_print_meta: n_ff = 9216
llm_load_print_meta: n_expert = 0
llm_load_print_meta: n_expert_used = 0
llm_load_print_meta: causal attn = 1
llm_load_print_meta: pooling type = 0
llm_load_print_meta: rope type = 2
llm_load_print_meta: rope scaling = linear
llm_load_print_meta: freq_base_train = 10000.0
llm_load_print_meta: freq_scale_train = 1
llm_load_print_meta: n_ctx_orig_yarn = 8192
llm_load_print_meta: rope_finetuned = unknown
llm_load_print_meta: ssm_d_conv = 0
llm_load_print_meta: ssm_d_inner = 0
llm_load_print_meta: ssm_d_state = 0
llm_load_print_meta: ssm_dt_rank = 0
llm_load_print_meta: model type = 2B
llm_load_print_meta: model ftype = Q4_K - Medium
llm_load_print_meta: model params = 2.61 B
llm_load_print_meta: model size = 1.59 GiB (5.21 BPW)
llm_load_print_meta: general.name = Gemma 2 2b It
llm_load_print_meta: BOS token = 2 '<bos>'
llm_load_print_meta: EOS token = 1 '<eos>'
llm_load_print_meta: UNK token = 3 '<unk>'
llm_load_print_meta: PAD token = 0 '<pad>'
llm_load_print_meta: LF token = 227 '<0x0A>'
llm_load_print_meta: EOT token = 107 '<end_of_turn>'
llm_load_print_meta: max token length = 48
ggml_cuda_init: GGML_CUDA_FORCE_MMQ: no
ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no
ggml_cuda_init: found 1 CUDA devices:
Device 0: NVIDIA GeForce RTX 3060 Ti, compute capability 8.6, VMM: yes
llm_load_tensors: ggml ctx size = 0.26 MiB
llm_load_tensors: offloading 26 repeating layers to GPU
llm_load_tensors: offloading non-repeating layers to GPU
llm_load_tensors: offloaded 27/27 layers to GPU
llm_load_tensors: CPU buffer size = 461.43 MiB
llm_load_tensors: CUDA0 buffer size = 1623.70 MiB
..........................................................
llama_new_context_with_model: n_ctx = 8192
llama_new_context_with_model: n_batch = 512
llama_new_context_with_model: n_ubatch = 512
llama_new_context_with_model: flash_attn = 0
llama_new_context_with_model: freq_base = 10000.0
llama_new_context_with_model: freq_scale = 1
llama_kv_cache_init: CUDA0 KV buffer size = 832.00 MiB
llama_new_context_with_model: KV self size = 832.00 MiB, K (f16): 416.00 MiB, V (f16): 416.00 MiB
llama_new_context_with_model: CUDA_Host output buffer size = 4.88 MiB
llama_new_context_with_model: CUDA0 compute buffer size = 504.50 MiB
llama_new_context_with_model: CUDA_Host compute buffer size = 36.51 MiB
llama_new_context_with_model: graph nodes = 1050
llama_new_context_with_model: graph splits = 2
INFO [ init] initializing slots | tid="11744" timestamp=1723514861 n_slots=4
INFO [ init] new slot | tid="11744" timestamp=1723514861 id_slot=0 n_ctx_slot=2048
INFO [ init] new slot | tid="11744" timestamp=1723514861 id_slot=1 n_ctx_slot=2048
INFO [ init] new slot | tid="11744" timestamp=1723514861 id_slot=2 n_ctx_slot=2048
INFO [ init] new slot | tid="11744" timestamp=1723514861 id_slot=3 n_ctx_slot=2048
INFO [ main] model loaded | tid="11744" timestamp=1723514861
INFO [ main] chat template | tid="11744" timestamp=1723514861 chat_example="<start_of_turn>user\nYou are a helpful assistant\n\nHello<end_of_turn>\n<start_of_turn>model\nHi there<end_of_turn>\n<start_of_turn>user\nHow are you?<end_of_turn>\n<start_of_turn>model\n" built_in=true
INFO [ main] HTTP server listening | tid="11744" timestamp=1723514861 hostname="127.0.0.1" port="11484" n_threads_http="15"
INFO [ update_slots] all slots are idle | tid="11744" timestamp=1723514861
INFO [ launch_slot_with_task] slot is processing task | tid="11744" timestamp=1723514873 id_slot=0 id_task=0
INFO [ update_slots] kv cache rm [p0, end) | tid="11744" timestamp=1723514873 id_slot=0 id_task=0 p0=0
INFO [ print_timings] prompt eval time = 222.95 ms / 12 tokens ( 18.58 ms per token, 53.82 tokens per second) | tid="11744" timestamp=1723514879 id_slot=0 id_task=0 t_prompt_processing=222.948 n_prompt_tokens_processed=12 t_token=18.579 n_tokens_second=53.82421012971635
INFO [ print_timings] generation eval time = 6485.43 ms / 660 runs ( 9.83 ms per token, 101.77 tokens per second) | tid="11744" timestamp=1723514879 id_slot=0 id_task=0 t_token_generation=6485.426 n_decoded=660 t_token=9.82640303030303 n_tokens_second=101.76663799725723
INFO [ print_timings] total time = 6708.37 ms | tid="11744" timestamp=1723514879 id_slot=0 id_task=0 t_prompt_processing=222.948 t_token_generation=6485.426 t_total=6708.374000000001
INFO [ update_slots] slot released | tid="11744" timestamp=1723514879 id_slot=0 id_task=0 n_ctx=8192 n_past=671 n_system_tokens=0 n_cache_tokens=0 truncated=false
INFO [ update_slots] all slots are idle | tid="11744" timestamp=1723514879
INFO [ log_server_request] request | tid="21256" timestamp=1723514879 remote_addr="127.0.0.1" remote_port=65028 status=200 method="POST" path="/v1/chat/completions" params={}
INFO [ update_slots] all slots are idle | tid="11744" timestamp=1723514879
For the cli:
> .\llama-cli -m gemma-2-2b-it-Q4_K_M.gguf --threads 16 -ngl 27 --mlock --port 11484 --top_k 40 --repeat_penalty 1.1 --min_p 0.05 --top_p 0.95 --prompt-cache-all -cb -np 4 --batch-size 512 -cnv
Log start
main: build = 3578 (1f67436c)
main: built with MSVC 19.29.30154.0 for x64
main: seed = 1723514926
llama_model_loader: loaded meta data with 39 key-value pairs and 288 tensors from gemma-2-2b-it-Q4_K_M.gguf (version GGUF V3 (latest))
llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output.
llama_model_loader: - kv 0: general.architecture str = gemma2
llama_model_loader: - kv 1: general.type str = model
llama_model_loader: - kv 2: general.name str = Gemma 2 2b It
llama_model_loader: - kv 3: general.finetune str = it
llama_model_loader: - kv 4: general.basename str = gemma-2
llama_model_loader: - kv 5: general.size_label str = 2B
llama_model_loader: - kv 6: general.license str = gemma
llama_model_loader: - kv 7: general.tags arr[str,2] = ["conversational", "text-generation"]
llama_model_loader: - kv 8: gemma2.context_length u32 = 8192
llama_model_loader: - kv 9: gemma2.embedding_length u32 = 2304
llama_model_loader: - kv 10: gemma2.block_count u32 = 26
llama_model_loader: - kv 11: gemma2.feed_forward_length u32 = 9216
llama_model_loader: - kv 12: gemma2.attention.head_count u32 = 8
llama_model_loader: - kv 13: gemma2.attention.head_count_kv u32 = 4
llama_model_loader: - kv 14: gemma2.attention.layer_norm_rms_epsilon f32 = 0.000001
llama_model_loader: - kv 15: gemma2.attention.key_length u32 = 256
llama_model_loader: - kv 16: gemma2.attention.value_length u32 = 256
llama_model_loader: - kv 17: general.file_type u32 = 15
llama_model_loader: - kv 18: gemma2.attn_logit_softcapping f32 = 50.000000
llama_model_loader: - kv 19: gemma2.final_logit_softcapping f32 = 30.000000
llama_model_loader: - kv 20: gemma2.attention.sliding_window u32 = 4096
llama_model_loader: - kv 21: tokenizer.ggml.model str = llama
llama_model_loader: - kv 22: tokenizer.ggml.pre str = default
llama_model_loader: - kv 23: tokenizer.ggml.tokens arr[str,256000] = ["<pad>", "<eos>", "<bos>", "<unk>", ...
llama_model_loader: - kv 24: tokenizer.ggml.scores arr[f32,256000] = [-1000.000000, -1000.000000, -1000.00...
llama_model_loader: - kv 25: tokenizer.ggml.token_type arr[i32,256000] = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, ...
llama_model_loader: - kv 26: tokenizer.ggml.bos_token_id u32 = 2
llama_model_loader: - kv 27: tokenizer.ggml.eos_token_id u32 = 1
llama_model_loader: - kv 28: tokenizer.ggml.unknown_token_id u32 = 3
llama_model_loader: - kv 29: tokenizer.ggml.padding_token_id u32 = 0
llama_model_loader: - kv 30: tokenizer.ggml.add_bos_token bool = true
llama_model_loader: - kv 31: tokenizer.ggml.add_eos_token bool = false
llama_model_loader: - kv 32: tokenizer.chat_template str = {{ bos_token }}{% if messages[0]['rol...
llama_model_loader: - kv 33: tokenizer.ggml.add_space_prefix bool = false
llama_model_loader: - kv 34: general.quantization_version u32 = 2
llama_model_loader: - kv 35: quantize.imatrix.file str = /models_out/gemma-2-2b-it-GGUF/gemma-...
llama_model_loader: - kv 36: quantize.imatrix.dataset str = /training_dir/calibration_datav3.txt
llama_model_loader: - kv 37: quantize.imatrix.entries_count i32 = 182
llama_model_loader: - kv 38: quantize.imatrix.chunks_count i32 = 128
llama_model_loader: - type f32: 105 tensors
llama_model_loader: - type q4_K: 156 tensors
llama_model_loader: - type q6_K: 27 tensors
llm_load_vocab: special tokens cache size = 249
llm_load_vocab: token to piece cache size = 1.6014 MB
llm_load_print_meta: format = GGUF V3 (latest)
llm_load_print_meta: arch = gemma2
llm_load_print_meta: vocab type = SPM
llm_load_print_meta: n_vocab = 256000
llm_load_print_meta: n_merges = 0
llm_load_print_meta: vocab_only = 0
llm_load_print_meta: n_ctx_train = 8192
llm_load_print_meta: n_embd = 2304
llm_load_print_meta: n_layer = 26
llm_load_print_meta: n_head = 8
llm_load_print_meta: n_head_kv = 4
llm_load_print_meta: n_rot = 256
llm_load_print_meta: n_swa = 4096
llm_load_print_meta: n_embd_head_k = 256
llm_load_print_meta: n_embd_head_v = 256
llm_load_print_meta: n_gqa = 2
llm_load_print_meta: n_embd_k_gqa = 1024
llm_load_print_meta: n_embd_v_gqa = 1024
llm_load_print_meta: f_norm_eps = 0.0e+00
llm_load_print_meta: f_norm_rms_eps = 1.0e-06
llm_load_print_meta: f_clamp_kqv = 0.0e+00
llm_load_print_meta: f_max_alibi_bias = 0.0e+00
llm_load_print_meta: f_logit_scale = 0.0e+00
llm_load_print_meta: n_ff = 9216
llm_load_print_meta: n_expert = 0
llm_load_print_meta: n_expert_used = 0
llm_load_print_meta: causal attn = 1
llm_load_print_meta: pooling type = 0
llm_load_print_meta: rope type = 2
llm_load_print_meta: rope scaling = linear
llm_load_print_meta: freq_base_train = 10000.0
llm_load_print_meta: freq_scale_train = 1
llm_load_print_meta: n_ctx_orig_yarn = 8192
llm_load_print_meta: rope_finetuned = unknown
llm_load_print_meta: ssm_d_conv = 0
llm_load_print_meta: ssm_d_inner = 0
llm_load_print_meta: ssm_d_state = 0
llm_load_print_meta: ssm_dt_rank = 0
llm_load_print_meta: model type = 2B
llm_load_print_meta: model ftype = Q4_K - Medium
llm_load_print_meta: model params = 2.61 B
llm_load_print_meta: model size = 1.59 GiB (5.21 BPW)
llm_load_print_meta: general.name = Gemma 2 2b It
llm_load_print_meta: BOS token = 2 '<bos>'
llm_load_print_meta: EOS token = 1 '<eos>'
llm_load_print_meta: UNK token = 3 '<unk>'
llm_load_print_meta: PAD token = 0 '<pad>'
llm_load_print_meta: LF token = 227 '<0x0A>'
llm_load_print_meta: EOT token = 107 '<end_of_turn>'
llm_load_print_meta: max token length = 48
ggml_cuda_init: GGML_CUDA_FORCE_MMQ: no
ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no
ggml_cuda_init: found 1 CUDA devices:
Device 0: NVIDIA GeForce RTX 3060 Ti, compute capability 8.6, VMM: yes
llm_load_tensors: ggml ctx size = 0.26 MiB
llm_load_tensors: offloading 26 repeating layers to GPU
llm_load_tensors: offloading non-repeating layers to GPU
llm_load_tensors: offloaded 27/27 layers to GPU
llm_load_tensors: CPU buffer size = 461.43 MiB
llm_load_tensors: CUDA0 buffer size = 1623.70 MiB
..........................................................
llama_new_context_with_model: n_ctx = 8192
llama_new_context_with_model: n_batch = 512
llama_new_context_with_model: n_ubatch = 512
llama_new_context_with_model: flash_attn = 0
llama_new_context_with_model: freq_base = 10000.0
llama_new_context_with_model: freq_scale = 1
llama_kv_cache_init: CUDA0 KV buffer size = 832.00 MiB
llama_new_context_with_model: KV self size = 832.00 MiB, K (f16): 416.00 MiB, V (f16): 416.00 MiB
llama_new_context_with_model: CUDA_Host output buffer size = 3.91 MiB
llama_new_context_with_model: CUDA0 compute buffer size = 504.50 MiB
llama_new_context_with_model: CUDA_Host compute buffer size = 36.51 MiB
llama_new_context_with_model: graph nodes = 1050
llama_new_context_with_model: graph splits = 2
main: chat template example: <start_of_turn>user
You are a helpful assistant
Hello<end_of_turn>
<start_of_turn>model
Hi there<end_of_turn>
<start_of_turn>user
How are you?<end_of_turn>
<start_of_turn>model
system_info: n_threads = 16 / 16 | AVX = 1 | AVX_VNNI = 0 | AVX2 = 1 | AVX512 = 0 | AVX512_VBMI = 0 | AVX512_VNNI = 0 | AVX512_BF16 = 0 | FMA = 1 | NEON = 0 | SVE = 0 | ARM_FMA = 0 | F16C = 1 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 1 | SSE3 = 1 | SSSE3 = 1 | VSX = 0 | MATMUL_INT8 = 0 | LLAMAFILE = 1 |
main: interactive mode on.
sampling:
repeat_last_n = 64, repeat_penalty = 1.100, frequency_penalty = 0.000, presence_penalty = 0.000
top_k = 40, tfs_z = 1.000, top_p = 0.950, min_p = 0.050, typical_p = 1.000, temp = 0.800
mirostat = 0, mirostat_lr = 0.100, mirostat_ent = 5.000
sampling order:
CFG -> Penalties -> top_k -> tfs_z -> typical_p -> top_p -> min_p -> temperature
generate: n_ctx = 8192, n_batch = 512, n_predict = -1, n_keep = 1
== Running in interactive mode. ==
- Press Ctrl+C to interject at any time.
- Press Return to return control to the AI.
- To return control without starting a new line, end your input with '/'.
- If you want to submit another line, end your input with '\'.
> write a story
The old lighthouse keeper, Elias Thorne, squinted at the swirling grey sky. He'd seen countless storms in his seventy years, but this one felt different. The wind shrieked like a banshee, and waves crashed against the rocks with a ferocious fury. His heart echoed the rhythm of the storm, a deep, unsettling thump.
He climbed to the lantern room, the familiar creak of the wooden stairs a familiar comfort in his old bones. As he lit the giant lamp, a single beam sliced through the swirling darkness, illuminating the churning sea below. A flicker on the horizon caught his eye – a ship, tossed like a toy by the storm's relentless waves.
Elias watched with increasing concern. The ship was small, barely a shadow in the storm's grasp. He remembered the story his grandfather told him - a legend of the Sea Serpent, a creature so vast it could swallow ships whole. The whispers had always been dismissed as folklore, but now…
The fog seemed to thicken, swirling into something like a living entity. Elias saw shapes shifting within it – dark wings, sharp teeth, scales glinting with an unnatural light. Fear gripped him, constricting his chest like a vise. But then, he saw the ship. Its sails were ripped to shreds, its bow broken against a monstrous wave. It was going down.
Elias felt a surge of duty, a primal instinct that had been dormant for years. The legend whispered of the Sea Serpent's vulnerability to the lighthouse beam – the light would pierce through the fog and deter it. He grabbed his oilskin coat, its worn fabric familiar against his calloused hands, and rushed to the top of the lighthouse tower.
With a heavy heart, he switched on the powerful lamp, the giant beam piercing through the swirling mist. A deafening roar echoed across the waves as the Sea Serpent lunged towards him, its eyes blazing with rage. The light seemed to illuminate something within the creature – a flicker of fear in its depths. The monster faltered, momentarily caught between fury and terror.
Elias watched, his heart hammering against his ribs, as the Sea Serpent slowly turned away from the lighthouse, retreating back into the swirling fog. He could barely hear it anymore, only the sound of the waves crashing on the rocks below.
A few moments later, a lone boat appeared, battered but afloat. Elias rushed down the stairs and watched in relief as the survivors scrambled onto the shore. They looked at him with gratitude, eyes wide with awe.
He knew he wasn't a hero. He was just Elias Thorne, a keeper of the light. But tonight, he had faced something ancient and monstrous, and lived to tell the tale. The legend might be real after all. The Sea Serpent wouldn't be back for a while – at least not until he lit that lighthouse once more.
>
llama_print_timings: load time = 1034.62 ms
llama_print_timings: sample time = 665.55 ms / 591 runs ( 1.13 ms per token, 887.99 tokens per second)
llama_print_timings: prompt eval time = 2607.47 ms / 12 tokens ( 217.29 ms per token, 4.60 tokens per second)
llama_print_timings: eval time = 4569.65 ms / 590 runs ( 7.75 ms per token, 129.11 tokens per second)
llama_print_timings: total time = 8817.04 ms / 602 tokens
What happened?
When running:
.\llama-cli -m gemma-2-2b-it-Q4_K_M.gguf --threads 16 -ngl 27 --mlock --port 11484 --host 0.0.0.0 --top_k 40 --repeat_penalty 1.1 --min_p 0.05 --top_p 0.95 --prompt-cache-all -cb -np 4 --batch-size 512 -cnv
The output is blazing fast. When I sent "write a story" these are my speed stats:
llama_print_timings: load time = 1027.95 ms
llama_print_timings: sample time = 683.92 ms / 618 runs ( 1.11 ms per token, 903.62 tokens per second)
llama_print_timings: prompt eval time = 3678.86 ms / 12 tokens ( 306.57 ms per token, 3.26 tokens per second)
llama_print_timings: eval time = 4744.65 ms / 617 runs ( 7.69 ms per token, 130.04 tokens per second)
llama_print_timings: total time = 15385.66 ms / 629 tokens
When I try the same with llama server:
.\llama-server -m gemma-2-2b-it-Q4_K_M.gguf --threads 16 -ngl 27 --mlock --port 11484 --host 0.0.0.0 --top_k 40 --repeat_penalty 1.1 --min_p 0.05 --top_p 0.95 --prompt-cache-all -cb -np 4 --batch-size 512 -cnv
It takes 2-3 seconds before responding to my same "write a story" prompt on localhost. So while it does write fast, it generated at about 103 t/s (a good amount slower than CLI), and it takes a very long time (for my use-case) to start writing.
If the prompt is extremely similar (up to about 1-3 tokens difference at the end) to my last prompt the next generation will start quick, otherwise, it takes 2-3 seconds, even if the prompt is very short. Only extremely short prompts like "hi" or "yo" respond instantly.
Not quite sure why I'm getting such amazing performance with llama-cli but much worse performance when I use it in server mode.
Name and Version
What operating system are you seeing the problem on?
Windows 11
Relevant log output