Skip to content
DeepForgeby svx
All problems
MediumDeep Learningdl-329

AWQ Activation-Aware Scaling

Problem

Apply AWQ activation-aware scaling to a weight matrix. With per-input-channel activation scales act_scales and exponent alpha, scale each column j by s_j = act_scales[j]^alpha: W_scaled[i][j] = W[i][j] * s_j. Return the scaled matrix.

The signature is awq_scaled_weights(W, act_scales, alpha).

Hint

AWQ amplifies salient channels so quantization error lands on less important weights.

Test cases

case 1
in: [[[1,2],[3,4]],[4,1],0.5]
expected: [[2,2],[6,4]]
case 2
in: [[[1,-2]],[9,16],0.5]
expected: [[3,-8]]
case 3
in: [[[1,2]],[2,3],1]
expected: [[2,6]]
case 4
in: [[[1,2]],[2,3],0]
expected: [[1,2]]
Starter codePython
def awq_scaled_weights(W, act_scales, alpha):
    # Your code here
    pass

4 test cases · run your code against them in the editor