[quantization] Introduce wrappers for Qwen3VLTextDecoderLayer and Qwen3VLTextModel#535
Draft
dayo09 wants to merge 4 commits intoSamsung:mainfrom
Draft
[quantization] Introduce wrappers for Qwen3VLTextDecoderLayer and Qwen3VLTextModel#535dayo09 wants to merge 4 commits intoSamsung:mainfrom
dayo09 wants to merge 4 commits intoSamsung:mainfrom
Conversation
…n3VLTextModel - Add `QuantQwen3VLTextDecoderLayer`: wraps attention, MLP, and layernorm blocks; pre-builds static causal mask and RoPE templates to avoid dynamic ops in forward pass - Add `QuantQwen3VLTextModel`: pre-computes shared causal mask and RoPE once and passes them to every decoder layer, so they are quantized exactly once rather than independently in each layer - Register both wrappers in `_CORE_MODULES` Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
stamalakhov
reviewed
Mar 5, 2026
Comment on lines
+190
to
+191
| self._fq(cos, self.obs_cos), | ||
| self._fq(sin, self.obs_sin), |
Contributor
There was a problem hiding this comment.
@dayo09
Sorry for disturbance. But
will disable dependence on size of
inputs. (It proved to be useful for LLama).It's similar to
self.causal_mask_template[..., :seq_len, :seq_len].to(device) above (Ln127).IMHO.
4829fa4 to
e71a9b1
Compare
dayo09
commented
Mar 11, 2026
| print(f"│ Mean |diff|: {(q_out - fp_out).abs().mean().item():.6f}") | ||
| print(f"│ PEIR : {compute_peir(fp_out, q_out) * 100:.6f} %") | ||
| print("└──────────────────────────────────────────────────────") | ||
| print(plot_two_outputs(fp_out, q_out)) |
Contributor
Author
There was a problem hiding this comment.
┌───────────── Quantization Error Summary ─────────────
│ Mean |diff|: 0.071578
│ PEIR : 9.253764 %
└──────────────────────────────────────────────────────
┌────────────────────────────────────────────┐
5.1┤ • │
3.4┤ • •••• • │
1.7┤ •••••••••• │
0.0┤ •••••••••• │
-1.7┤ • •••••• │
-3.4┤ •••••••• │
-5.1┤ • │
└┬──────────┬──────────┬─────────┬──────────┬┘
-5.1 -2.5 0.0 2.5 5.1
dayo09
commented
Mar 11, 2026
| print(f"│ Mean |diff|: {(q_out - fp_out).abs().mean().item():.6f}") | ||
| print(f"│ PEIR : {compute_peir(fp_out, q_out) * 100:.6f} %") | ||
| print("└──────────────────────────────────────────────────────") | ||
| print(plot_two_outputs(fp_out, q_out)) |
Contributor
Author
There was a problem hiding this comment.
python3 tico/quantization/wrapq/examples/qwen/quantize_text_model.py
┌───────────── Quantization Error Summary ─────────────
│ Mean |diff|: 0.904804
│ PEIR : 351.709125 %
└──────────────────────────────────────────────────────
┌──────────────────────────────────────────┐
28.2┤ │
│ │
│ •• •• • │
4.7┤ ••••• │
│ ••••• │
│ •••• │
-18.7┤ ••• │
│ │
│ │
-42.2┤ │
│ │
│ │
│ │
-65.6┤ │
│ │
│ │
-89.1┤ │
│ │
│ • │
-112.5┤ │
└┬─────────┬──────────┬─────────┬─────────┬┘
-112.5 -77.4 -42.2 -7.0 28.2
Contributor
Author
There was a problem hiding this comment.
There is one big outlier. 😢
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.
Let's add wrappers for upper level qwen3vl layers.
TICO-DCO-1.0-Signed-off-by: Dayoung Lee dayoung.lee@samsung.com