无法复现smallthinker-4ba0.6b在8elite手机上的性能数据
我按照 https://github.com/SJTU-IPADS/PowerInfer/tree/main/smallthinker 的说明编译了llama-cli,从 https://huggingface.co/PowerInfer/SmallThinker-4BA0.6B-Instruct-GGUF/blob/main/SmallThinker-4B-A0.6B-Instruct.Q4_0.gguf下载了gguf模型文件,但在8elite手机上运行的速度仅为20token/s左右,远达不到表格中80token/s的宣传值。
1|NX789J:/ # llama-cli -m /vendor/bin/SmallThinker-4B-A0.6B-Instruct.Q4_0.gguf -no-cnv --temp 0.6 --top-k 20 --top-p 0.95 --samplers "temperature;top_k;top_p" -p "<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>user\nCalculate the integral of f(x) = sin(x) from 0 to 3pi/4.<|im_end|>\n<|im_start|>assistant" -t 4 -n 256
build: 1590 (d3ebd7c) with Android (11349228, +pgo, +bolt, +lto, -mlgo, based on r487747e) clang version 17.0.2 (https://android.googlesource.com/toolchai
n/llvm-project d9f89f4d16663d5012e5c09495f3b30ece3d2362) for x86_64-unknown-linux-gnu
main: llama backend init
main: load the model and apply lora adapter, if any
llama_model_loader: loaded meta data with 31 key-value pairs and 323 tensors from /vendor/bin/SmallThinker-4B-A0.6B-Instruct.Q4_0.gguf (version GGUF V3 (l
atest))
llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output.
llama_model_loader: - kv 0: general.architecture str = smallthinker
llama_model_loader: - kv 1: general.type str = model
llama_model_loader: - kv 2: general.name str = 4b_v7
llama_model_loader: - kv 3: general.finetune str = 4b_v7
llama_model_loader: - kv 4: general.size_label str = 32x758M
llama_model_loader: - kv 5: smallthinker.block_count u32 = 32
llama_model_loader: - kv 6: smallthinker.context_length u32 = 32768
llama_model_loader: - kv 7: smallthinker.embedding_length u32 = 1536
llama_model_loader: - kv 8: smallthinker.attention.head_count u32 = 12
llama_model_loader: - kv 9: smallthinker.attention.head_count_kv u32 = 2
llama_model_loader: - kv 10: smallthinker.rope.freq_base f32 = 1500000.000000
llama_model_loader: - kv 11: smallthinker.attention.layer_norm_rms_epsilon f32 = 0.000001
llama_model_loader: - kv 12: smallthinker.attention.key_length u32 = 128
llama_model_loader: - kv 13: smallthinker.attention.value_length u32 = 128
llama_model_loader: - kv 14: smallthinker.expert_count u32 = 32
llama_model_loader: - kv 15: smallthinker.expert_used_count u32 = 4
llama_model_loader: - kv 16: smallthinker.expert_feed_forward_length u32 = 768
llama_model_loader: - kv 17: smallthinker.feed_forward_length u32 = 768
llama_model_loader: - kv 18: smallthinker.expert_gating_func u32 = 2
llama_model_loader: - kv 19: tokenizer.ggml.model str = gpt2
llama_model_loader: - kv 20: tokenizer.ggml.pre str = qwen2
llama_model_loader: - kv 21: tokenizer.ggml.tokens arr[str,151936] = ["!", """, "#", "$", "%", "&", "'", ...
llama_model_loader: - kv 22: tokenizer.ggml.token_type arr[i32,151936] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
llama_model_loader: - kv 23: tokenizer.ggml.merges arr[str,151387] = ["? ?", "?? ??", "i n", "? t",...
llama_model_loader: - kv 24: tokenizer.ggml.eos_token_id u32 = 151645
llama_model_loader: - kv 25: tokenizer.ggml.padding_token_id u32 = 151643
llama_model_loader: - kv 26: tokenizer.ggml.bos_token_id u32 = 151643
llama_model_loader: - kv 27: tokenizer.ggml.add_bos_token bool = false
llama_model_loader: - kv 28: tokenizer.chat_template str = {%- if tools %}\n {{- '<|im_start|>...
llama_model_loader: - kv 29: general.quantization_version u32 = 2
llama_model_loader: - kv 30: general.file_type u32 = 2
llama_model_loader: - type f32: 97 tensors
llama_model_loader: - type q4_0: 225 tensors
llama_model_loader: - type q6_K: 1 tensors
print_info: file format = GGUF V3 (latest)
print_info: file type = Q4_0
print_info: file size = 2.30 GiB (4.62 BPW)
load: special tokens cache size = 26
load: token to piece cache size = 0.9311 MB
print_info: arch = smallthinker
print_info: vocab_only = 0
print_info: n_ctx_train = 32768
print_info: n_embd = 1536
print_info: n_layer = 32
print_info: n_head = 12
print_info: n_head_kv = 2
print_info: n_rot = 128
print_info: n_swa = 0
print_info: is_swa_any = 0
print_info: n_embd_head_k = 128
print_info: n_embd_head_v = 128
print_info: n_gqa = 6
print_info: n_embd_k_gqa = 256
print_info: n_embd_v_gqa = 256
print_info: f_norm_eps = 0.0e+00
print_info: f_norm_rms_eps = 1.0e-06
print_info: f_clamp_kqv = 0.0e+00
print_info: f_max_alibi_bias = 0.0e+00
print_info: f_logit_scale = 0.0e+00
print_info: f_attn_scale = 0.0e+00
print_info: n_ff = 768
print_info: n_expert = 32
print_info: n_expert_used = 4
print_info: causal attn = 1
print_info: pooling type = 0
print_info: rope type = 2
print_info: rope scaling = linear
print_info: freq_base_train = 1500000.0
print_info: freq_scale_train = 1
print_info: n_ctx_orig_yarn = 32768
print_info: rope_finetuned = unknown
print_info: ssm_d_conv = 0
print_info: ssm_d_inner = 0
print_info: ssm_d_state = 0
print_info: ssm_dt_rank = 0
print_info: ssm_dt_b_c_rms = 0
print_info: model type = ?B
print_info: model params = 4.27 B
print_info: general.name = 4b_v7
print_info: n_ff_exp = 768
print_info: vocab type = BPE
print_info: n_vocab = 151936
print_info: n_merges = 151387
print_info: BOS token = 151643 '<|endoftext|>'
print_info: EOS token = 151645 '<|im_end|>'
print_info: EOT token = 151645 '<|im_end|>'
print_info: PAD token = 151643 '<|endoftext|>'
print_info: LF token = 198 '?'
print_info: FIM PRE token = 151659 '<|fim_prefix|>'
print_info: FIM SUF token = 151661 '<|fim_suffix|>'
print_info: FIM MID token = 151660 '<|fim_middle|>'
print_info: FIM PAD token = 151662 '<|fim_pad|>'
print_info: FIM REP token = 151663 '<|repo_name|>'
print_info: FIM SEP token = 151664 '<|file_sep|>'
print_info: EOG token = 151643 '<|endoftext|>'
print_info: EOG token = 151645 '<|im_end|>'
print_info: EOG token = 151662 '<|fim_pad|>'
print_info: EOG token = 151663 '<|repo_name|>'
print_info: EOG token = 151664 '<|file_sep|>'
print_info: max token length = 256
load_tensors: loading model tensors, this can take a while... (mmap = true)
load_tensors: CPU_Mapped model buffer size = 2332.39 MiB
load_tensors: CPU_AARCH64 model buffer size = 1390.50 MiB
.........................................................................................
llama_context: constructing llama_context
llama_context: n_seq_max = 1
llama_context: n_ctx = 4096
llama_context: n_ctx_per_seq = 4096
llama_context: n_batch = 2048
llama_context: n_ubatch = 512
llama_context: causal_attn = 1
llama_context: flash_attn = 0
llama_context: freq_base = 1500000.0
llama_context: freq_scale = 1
llama_context: n_ctx_per_seq (4096) < n_ctx_train (32768) -- the full capacity of the model will not be utilized
llama_context: CPU output buffer size = 0.58 MiB
llama_kv_cache_unified: CPU KV buffer size = 128.00 MiB
llama_kv_cache_unified: size = 128.00 MiB ( 4096 cells, 32 layers, 1 seqs), K (f16): 64.00 MiB, V (f16): 64.00 MiB
llama_context: CPU compute buffer size = 299.75 MiB
llama_context: graph nodes = 1800
llama_context: graph splits = 1
common_init_from_params: setting dry_penalty_last_n to ctx_size = 4096
common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
main: llama threadpool init, n_threads = 4
system_info: n_threads = 4 (n_threads_batch = 4) / 8 | CPU : NEON = 1 | ARM_FMA = 1 | MATMUL_INT8 = 1 | DOTPROD = 1 | AARCH64_REPACK = 1 |
sampler seed: 1391967783
sampler params:
repeat_last_n = 64, repeat_penalty = 1.000, frequency_penalty = 0.000, presence_penalty = 0.000
dry_multiplier = 0.000, dry_base = 1.750, dry_allowed_length = 2, dry_penalty_last_n = 4096
top_k = 20, top_p = 0.950, min_p = 0.050, xtc_probability = 0.000, xtc_threshold = 0.100, typical_p = 1.000, top_n_sigma = -1.000, temp = 0.600
mirostat = 0, mirostat_lr = 0.100, mirostat_ent = 5.000
sampler chain: logits -> logit-bias -> temp-ext -> top-k -> top-p -> dist
generate: n_ctx = 4096, n_batch = 2048, n_predict = 256, n_keep = 0
system
You are a helpful assistant.
user
Calculate the integral of f(x) = sin(x) from 0 to 3pi/4.
assistant
To calculate the definite integral of ( f(x) = \sin(x) ) from ( 0 ) to ( \frac{3\pi}{4} ), use the antiderivative of (\sin(x)), which is (-\cos(x
)).
The definite integral is given by:
[
\int_0^{\frac{3\pi}{4}} \sin(x) dx = \left[ -\cos(x) \right]_0^{\frac{3\pi}{4}}
]
Evaluate at the upper limit ( x = \frac{3\pi}{4} ):
[
-\cos\left( \frac{3\pi}{4} \right) = -\left( -\frac{\sqrt{2}}{2} \right) = \frac{\sqrt{2}}{2}
]
Evaluate at the lower limit ( x = 0 ):
[
-\cos(0) = -1
]
Subtract the lower limit result from the upper limit result:
[
\frac{\sqrt{2}}{2} - (-1) = \frac{\sqrt{2}}{2} + 1
]
This can also
llama_perf_sampler_print: sampling time = 152.35 ms / 295 runs ( 0.52 ms per token, 1936.37 tokens per second)
llama_perf_context_print: load time = 3223.75 ms
llama_perf_context_print: prompt eval time = 913.33 ms / 39 tokens ( 23.42 ms per token, 42.70 tokens per second)
llama_perf_context_print: eval time = 13089.69 ms / 255 runs ( 51.33 ms per token, 19.48 tokens per second)
llama_perf_context_print: total time = 14589.56 ms / 294 tokens
Thank you for your interest.
You can try SmallThinker with the latest llama.cpp b6012 (https://github.com/ggml-org/llama.cpp/releases/tag/b6012).
As for the PowerInfer speed reproduction issue, please continue the discussion under the PowerInfer GitHub issue (https://github.com/SJTU-IPADS/PowerInfer/issues/263).
Thank you.