You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m not sure to understand what you mean by it creates a new tensor and it smooths nothing.
In fact, the MLP in Llama does:
FC2(Silu(FC1(x)) * Gate(x))
This code, unless I’m mistaken modifies the weights for both FC1 and Gate (those are lists so the + concatenates the two lists).
The activations are smoothed in the RMSNorm that precedes the MLP. That’s what is recommended in the SmoothQuant paper as far as I know ;)
Do you agree with that?
Thanks, Julien
hi, thanks for your response and you are right. but there is another question, why do this: scales[layer_name_qkv]["x"] = scales[layer_name_q]["x"] / smoother
smoothquant just smooth the weight, but here scales was divided by smoother? pls help to explain how scales used in int8 inference
Those “scales” correspond to the magnitude of the activations (estimated over CNN DailyMail in the calibrate function).
They are needed for SmoothQuant (to compute the smoothed scaling to apply to the activations) and for INT8 KV cache.
If we apply SmoothQuant, we change the magnitude by scaling the activations. So, it’s needed to take that into account and update those tensors. That’s for this reason that the magnitude is divided by “smoother”.
I hope it helps. Let me know if we can close that issue, please.
Those “scales” correspond to the magnitude of the activations (estimated over CNN DailyMail in the calibrate function).
They are needed for SmoothQuant (to compute the smoothed scaling to apply to the activations) and for INT8 KV cache.
If we apply SmoothQuant, we change the magnitude by scaling the activations. So, it’s needed to take that into account and update those tensors. That’s for this reason that the magnitude is divided by “smoother”.
I hope it helps. Let me know if we can close that issue, please.
Thanks, Julien
Hi, I didn't quite get the point of dividing activations scales by the smoother again, as far as I know if you have already divided the LN weight by the smoother, you don't need to divided X(same to divide by scales) again and I see sq original code did not divide the scales again, something like the following:
Those “scales” correspond to the magnitude of the activations (estimated over CNN DailyMail in the calibrate function).
They are needed for SmoothQuant (to compute the smoothed scaling to apply to the activations) and for INT8 KV cache.
If we apply SmoothQuant, we change the magnitude by scaling the activations. So, it’s needed to take that into account and update those tensors. That’s for this reason that the magnitude is divided by “smoother”.
I hope it helps. Let me know if we can close that issue, please.
Thanks, Julien
Hi, I didn't quite get the point of dividing activations scales by the smoother again, as far as I know if you have already divided the LN weight by the smoother, you don't need to divided X(same to divide by scales) again and I see sq original code did not divide the scales again, something like the following:
Those “scales” correspond to the magnitude of the activations (estimated over CNN DailyMail in the calibrate function).
They are needed for SmoothQuant (to compute the smoothed scaling to apply to the activations) and for INT8 KV cache.
If we apply SmoothQuant, we change the magnitude by scaling the activations. So, it’s needed to take that into account and update those tensors. That’s for this reason that the magnitude is divided by “smoother”.
I hope it helps. Let me know if we can close that issue, please.
Thanks, Julien
Hi, I didn't quite get the point of dividing activations scales by the smoother again, as far as I know if you have already divided the LN weight by the smoother, you don't need to divided X(same to divide by scales) again and I see sq original code did not divide the scales again, something like the following:
I get it now.
The values in scales[layer_name_q]["x"] were collected before smooth, so we need to adjust scales[layer_name_q]["x"] by dividing smoother.
Activity
jdemouth-nvidia commentedon Oct 31, 2023
Hi @jackzhou121 ,
I’m not sure to understand what you mean by it creates a new tensor and it smooths nothing.
In fact, the MLP in Llama does:
This code, unless I’m mistaken modifies the weights for both FC1 and Gate (those are lists so the
+concatenates the two lists).The activations are smoothed in the RMSNorm that precedes the MLP. That’s what is recommended in the SmoothQuant paper as far as I know ;)
Do you agree with that?
Thanks,
Julien
jackzhou121 commentedon Oct 31, 2023
hi, thanks for your response and you are right. but there is another question, why do this:
scales[layer_name_qkv]["x"] = scales[layer_name_q]["x"] / smoother
smoothquant just smooth the weight, but here scales was divided by smoother? pls help to explain how scales used in int8 inference
jdemouth-nvidia commentedon Oct 31, 2023
Those “scales” correspond to the magnitude of the activations (estimated over CNN DailyMail in the calibrate function).
They are needed for SmoothQuant (to compute the smoothed scaling to apply to the activations) and for INT8 KV cache.
If we apply SmoothQuant, we change the magnitude by scaling the activations. So, it’s needed to take that into account and update those tensors. That’s for this reason that the magnitude is divided by “smoother”.
I hope it helps. Let me know if we can close that issue, please.
Thanks,
Julien
elinx commentedon Feb 5, 2024
Hi, I didn't quite get the point of dividing activations scales by the smoother again, as far as I know if you have already divided the LN weight by the smoother, you don't need to divided X(same to divide by scales) again and I see sq original code did not divide the scales again, something like the following:
did I miss something?
goldberg2024 commentedon Mar 6, 2024
Same question!
goldberg2024 commentedon Mar 6, 2024
I get it now.
The values in scales[layer_name_q]["x"] were collected before smooth, so we need to adjust scales[layer_name_q]["x"] by dividing smoother.