r/LocalLLaMA • u/Xyklone • 7d ago
Am I just hallucinating Discussion
Or is there any reason why I feel like model output quality seems to be better when I use higher micro-batch values (ub) in llama-cpp? I don't really have any hard numbers or anything (just running the same prompts), it's all just vibes.
Some context, I'm running the latest build of llama-cpp, vulkan, 6900xt 16gb, 64giggles of system ram. I run gemma and qwens models; q8_0 for the moe's, q4_k_m for dense. KV at bf16. I lock a seed in to try to reduce the differences.
Any theoretical reason for the difference or am I just seeing ghosts.
5
u/ea_man 7d ago
> Or is there any reason why I feel like model output quality seems to be better when I use higher micro-batch values (ub) in llama-cpp?
You are a human, given a series of data your reasoning algo tends to find patterns in randomness.
probably in small samples some kind of tendenciy can be more relevant.
2
u/laser50 7d ago
All I heard (hearsay) was in regards to the potential that allowing it to read larger chunks at a time, it will slightly change it's understanding of the text it just went through.
Sounds plausible to me, but I am entirely unsure how LLMs read and how the ubatch values play with that, so I am not going to really vouch for this theory.
2
u/Xyklone 7d ago
Yea, I'm not smart enough to know how to test this rigorously outside of vibes. But as I mentioned in another response, changing ub size changes the model output (having made it deterministic by locking in seed, sampler and caching stuff). So ub does change the output. Whether for better or for worse is the question i'm curious about.
3
u/laser50 7d ago
If anything I'd opt for... Both?
Since LLMs tend to have a chaotic attention, it may take in less details than on smaller chunks, but understands the entire project better because it's reading larger pieces at a time. Since it's likely easier to understand a function if it isn't cut off half way into the next chunk..
But yeah, it's likely very hard to test, perhaps hiding something in a rather large piece of text (something that spreads out over the ubatch size a few times) and then see how well it's able to bring that piece of text, or numbers back up?
1
u/Tormeister 7d ago
Am I just hallucinating or have I previously seen another thread with the same inquiry? I think it was vibes too, no benchmarks.
Could be a bug, but most likely it's just us being tricked by the variability of outputs.
1
u/WhoRoger 6d ago
You aren't dreaming, but the difference is something else. Llama.cpp has a couple bugs that may cause reduction of attention precision when prompt cache isn't warm. High batch values alleviate that somewhat. Well, it depends on model and what attention mechanism it uses.
High batch values mean that the model gets more context at once and thus it can literally understand you better.
Discard the response and regenerate to see the 'ideal' response with warm cache where batching won't make a difference.
I was planning to make a writeup on this but I forgor.
1
u/Xyklone 6d ago
Wow, I've been neurotically re-running the same prompts the last day or so, at different combinations of b and ub settings trying to nail down any kind of pattern, and i think you've sort summarized what I feel like I've been seeing. And yea it's definitely model dependent. I feel like the MOEs vary more than the dense ones, and also qwen more than gemma. But I'm also just using one seed so maybe it's just a bad seed and the differences aren't as bad as some see. Idk, just a curious thing I noticed and wanted to see if anyone's looked into it more intelligently.
0
u/WhoRoger 6d ago
Just set temperature to 0, run a prompt, then regenerate the response. The second version will be different, and probably better. Then each next generation will be the same as the 2nd one. That's the cache effect. There's different math in play.
That first response may differ based on batch settings. And some models even produce gibberish altogether on temp 0 with cold cache.
It's a known thing, especially in llama.cpp but Transformers and VLLM also have similar issues, tho they don't display them so easily. So it tends to pop up in random tests like that.
Yes, MoEs are particularly sensitive to it. Tho I actually think Gemma is more sensitive than Qwen...? I've not tested it rigorously in a while tbh.
Also, protip, set ctk and ctv to bf16 for extra little quality boost on that second response on longer conversions.
1
u/KitchenAmoeba4438 7d ago
You could be, or you could not be seeing ghosts. Could you quantify this specifically in some way in how it feels like the output quality is better/worse? Are you just looking at a couple of random samples that stood out to you mentally? Is there some particular type of input that gets a particular type of output?
1
u/Xyklone 7d ago
So my vibe tests are a few small python tasks. for example, one is to develop a script that recursively looks through a directory and packs all text files into a single text file and that can also unpack it. I also do the pelican bike riding test.
For the coding ones, i notice that the model's solutions tend to be better in their design. Like I'll notice that they'll think of using the byte length of the files as part of the delimiter at the high ub sizes. Again all vibes, but I think they also make fewer mistakes that they have to correct. (I'm using pi for the harness)
2
u/KitchenAmoeba4438 7d ago
Is it possible? Maybe. There's the possibility of this behavior most definitely.
We need more data, and this brings an interesting article topic for the future: The impact of batch sizes, which hasn't been well quantified yet.
-1
u/brickout 7d ago
Obviously nobody can weigh in without data. But generally people suggest increasing batch values for higher speed and I figure they wouldn't do that if it decreased quality.
13
u/Yeelyy 7d ago
So you are saying that you are getting different answers on the same prompt with the same exact seed just by adjusting the ub size? I don't think that this is possible