Repository navigation
Description
Name and Version
./build/bin/llama-cli --version
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 3090, compute capability 8.6, VMM: yes
version: 7232 (ae9771d)
built with cc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0 for x86_64-linux-gnu
Operating systems
Linux
GGML backends
CPU
Hardware
i7-4930k + nvidia 3090
Models
rwkv7-world-2.9B
Problem description & steps to reproduce
I added callbacks to wkv_state in src/models/rwkv7-base.cpp after line 103 and 107. I found that while wkv_state is updated from the call to ggml_rwkv_wkv7 and seems to be saved to mctx_cur->get_s_l(il). It doesn't seem to get retrieved in line 103 such that wkv_state is always empty when passing to ggml_rwkv_wkv7.
CUDA_VISIBLE_DEVICES="" ./build/bin/llama-eval-callback -m ~/gguf/rwkv7-2.9B-world-iq4_nl.gguf -p "Hello, my name is" >& cbr
Can this be due to my prompt being too short? I also tried a prompt with about 100 tokens and wkv_state is still empty.
First Bad Commit
No response
Relevant log output
gml_debug: wkv_state_in-0 = (f32) GET_ROWS(cache_s_l0 (reshaped){163840, 1, 1, 1}, (view){1, 1, 1, 1}}) = {163840, 1, 1, 1}
[
[
[ 0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],
],
]
sum = 0.000000
ggml_debug: wkv_state_in-1 = (f32) GET_ROWS(cache_s_l1 (reshaped){163840, 1, 1, 1}, (view){1, 1, 1, 1}}) = {163840, 1, 1, 1}
[
[
[ 0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],
],
]
sum = 0.000000
Activity
ymcki commentedon Dec 18, 2025
Similar phenomenon is also observed in Qwen3Next. They are the only models that use recurrent state. Not sure if this is a bug of recurrent state retrieval/storage or my test condition is not enough to make the models to use recurrent state.
pwilkin commentedon Dec 18, 2025
llama-eval-callbackwill only generate one token. During the first pass, the recurrent state is empty since there's obviously no previous state there. You will only see non-zero tensors there during the autoregressive (generation) pass.ymcki commentedon Dec 18, 2025
Thanks for your reply. It doesn't seem to me there is an option to generate two tokens.,
Then how do people debug this class of models? Would it be desirable to upgrade llama-eval-callback to generate two tokens?
pwilkin commentedon Dec 18, 2025
@ymcki Now that
llama-clihas a new form andllama-completionhas been relegated to mainly debug duty, I think adding callback support there is a bit more likely.Back when I did Qwen3Next and needed to debug multi-token dumps, I just copy-pasted the
ggml_debugfunction with all the supports and set it up as a callback inmain.cpp(nowcompletion.cpp).In fact, I have a PR open (#17914) that I need to finish that extracts the debug function to a common header so it's easier to set up this very sort of callback logic (and I apply it to the mtmd client).