Fix (graph/qronos): Normalize contribution to H and G when buffer is disabled#1440
Merged
Giuseppe5 merged 3 commits intoXilinx:devfrom Feb 3, 2026
Merged
Fix (graph/qronos): Normalize contribution to H and G when buffer is disabled#1440Giuseppe5 merged 3 commits intoXilinx:devfrom
Giuseppe5 merged 3 commits intoXilinx:devfrom
Conversation
pablomlago
requested changes
Jan 20, 2026
Collaborator
pablomlago
left a comment
There was a problem hiding this comment.
Is it possible to avoid having the normalization scattered in multiple places?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reason for this PR
In the method
Qronos().update_batch()(in the filesrc/brevitas/graph/qronos.py), in the case whereself._use_intermediate_bufferisFalse, the contribution from the current samples that is being added to the matricesHorGis not normalized. However, the current ("pre-update") value ofGorHis normalized (multiplied by the number of samples and divided by the number of samples plus the number of "incoming" samples).This is a bug as it causes the contribution from samples from the later updates to weight more on the final
HandGmatrices than the contribution of the earlier samples. However, the order of the samples is not relevant and they should all be equally weighted, as it is done in the case whereself._use_intermediate_bufferisTrueor also inGPTQ(only forHin this case asGis not needed there).Changes Made in this PR
In the file
src/brevitas/graph/qronos.pythe lineself.G += inp_processed.bmm(self.quant_input.transpose(2, 1))insideQronos().update_batch()has been updated so that the incoming contribution is normalized. The new line isThe analogous change was done to normalize the contribution to
self.H.Testing Summary