mirror of
https://github.com/p-e-w/heretic.git
synced 2026-12-03 18:42:57 +07:00
[GH-ISSUE #248] [RFC] A better automatic batch size mechanism #143
Labels
No labels
bug
enhancement
enhancement
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
p-e-w/heretic#143
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @p-e-w on GitHub (Mar 23, 2026).
Original GitHub issue: https://github.com/p-e-w/heretic/issues/248
As mentioned in #239, I have come to believe that the way I originally implemented automatic batch size determination in Heretic is flawed. There are several problems with the current mechanism:
Here is how I think it should work instead:
get_responses,get_residuals,get_logprobs) has its own associated batch size, initialized to a value like 128.Modelinstance field, so it is remembered for the next invocation.This avoids wasted work, optimizes the batch size separately for different methods, and dynamically adapts to changing memory availability at runtime.
While this discards the "benchmarking" aspect and thus might lead to situations where larger batch sizes are chosen while a smaller batch size could improve overall throughput, I have found those situations to be extremely rare in practice. For almost every (non-CPU) run I have ever seen, you get the highest generation speed by simply choosing the largest batch size that fits into your VRAM constraints.