Majid Al-RaimiReference sheetالورقة المرجعية

COE 592Lecture 4.1المحاضرة 4.1Referenceالمرجع

Reference sheetالورقة المرجعية

Pruning and sparsity I compressed onto one page: the definitions, formulas and numbers to have in your head before a quiz or exam.محاضرة «التقليم (Pruning) والتناثر (Sparsity) الجزء الأول» مضغوطة في صفحة واحدة: التعريفات والمعادلات والأرقام التي يجب أن تكون حاضرة في ذهنك قبل الاختبار القصير أو الامتحان.

The pruning pipelineمسار التقليم

Pruning removes the synapses and neurons whose removal hurts performance least. It is a pipeline of one formulation and four decisions, split across two lectures. Part 01: Why prune

يحذف التقليم الوصلات (synapses) والعصبونات (neurons) التي يضر حذفها بالأداء أقل ما يمكن. وهو مسار يتكون من صياغة واحدة وأربعة قرارات، موزعة على محاضرتين. الجزء 01: لماذا نقلّم

DecisionالقرارQuestionالسؤالWhere it is taughtأين يُدرَّس
Formulateالصياغة (Formulate)What is pruning and how is it written down?ما التقليم، وكيف يُكتب رياضيًا؟Part 01الجزء 01
Granularityالدرجة الحبيبية (Granularity)In what pattern should weights be removed?بأي نمط تُحذف الأوزان؟Parts 03 and 04الجزآن 03 و04
Criterionالمعيار (Criterion)Which synapses or neurons should go?أي الوصلات أو العصبونات تُحذف؟Parts 05 and 06الجزآن 05 و06
Ratioالنسبة (Ratio)What target sparsity per layer?ما التناثر المستهدف لكل طبقة؟Lecture 04-2المحاضرة 04-2
Fine-tuneالضبط الدقيق (Fine-tune)How is the lost accuracy recovered?كيف تُستعاد الدقة المفقودة؟Part 02 previews it; Lecture 04-2يمهّد له الجزء 02؛ المحاضرة 04-2
Formulate, then four decisionsالصياغة، ثم أربعة قرارات

The memory energy wallجدار طاقة الذاكرة

Horowitz ISSCC 2014, 45 nm at 0.9 V, via Han et al. 2015. Memory access is three orders of magnitude more expensive than arithmetic. Part 01: Why prune

Horowitz ISSCC 2014، بتقنية 45 nm عند 0.9 V، نقلًا عن Han et al. 2015. الوصول إلى الذاكرة أغلى من العمليات الحسابية بثلاث مراتب عشرية. الجزء 01: لماذا نقلّم

Rough energy per 32-bit operationالطاقة التقريبية لكل عملية بطول 32 بت

32-bit int ADDجمع أعداد صحيحة، 32 بت
0.1 pJ
32-bit float ADDجمع أعداد عشرية، 32 بت
0.9 pJ
32-bit register fileملف السجلات (register file)، 32 بت
1 pJ
32-bit int MULTضرب أعداد صحيحة، 32 بت
3.1 pJ
32-bit float MULTضرب أعداد عشرية، 32 بت
3.7 pJ
32-bit SRAM cacheذاكرة SRAM المؤقتة، 32 بت
5 pJ
32-bit DRAM memoryذاكرة DRAM، 32 بت
640 pJ
RatioالنسبةValueالقيمةMeaningالمعنى
DRAM / int MULT640 / 3.1 ≈ 206About two hundred multiplies per fetchنحو مئتي عملية ضرب مقابل كل قراءة واحدة
DRAM / int MAC640 / 3.2 = 200The slide's 200x icon lineسطر أيقونة 200x في الشريحة
DRAM / int ADD640 / 0.1 = 6400Relative to the cheapest operationمقارنة بأرخص عملية
DRAM / SRAM640 / 5 = 128The payoff of fitting the model on chipمكسب احتواء النموذج داخل الشريحة (on chip)
The four ratios to quoteالنسب الأربع التي تُقتبس
EDRAMEint MULT=640 pJ3.1 pJ≈206\frac{E_{\text{DRAM}}}{E_{\text{int MULT}}} = \frac{640\ \text{pJ}}{3.1\ \text{pJ}} \approx 206
One weight fetch buys about two hundred multipliesجلب وزن واحد يكلّف ما يعادل نحو مئتي عملية ضرب

Synapse versus neuron pruningتقليم الوصلات مقابل تقليم العصبونات

Six weights removed as synapses and six removed as a neuron count the same and look completely different to the hardware. A 3 × 4 layer feeding 2 × 3: prune neuron 2 and row 2 (4 weights) plus column 2 of the next layer (2 weights) vanish, leaving dense 2 × 4 and 2 × 2. Part 01: Why prune

ستة أوزان تُحذف كوصلات وستة تُحذف كعصبون واحد لهما العدد نفسه، لكنهما يبدوان مختلفين تمامًا بالنسبة للعتاد. طبقة 3 × 4 تغذي طبقة 2 × 3: قلّم العصبون 2 فيختفي الصف 2 (4 أوزان) والعمود 2 في الطبقة التالية (2 من الأوزان)، فتبقى مصفوفتان كثيفتان 2 × 4 و2 × 2. الجزء 01: لماذا نقلّم

AspectالجانبSynapse pruningتقليم الوصلاتNeuron pruningتقليم العصبونات
UnitالوحدةOne weight w_ijوزن واحد w_ijOne nodeعقدة واحدة
What survivesما يبقىBoth endpoint neuronsالعصبونان على طرفي الوصلةNothing of the nodeلا يبقى شيء من العقدة
Matrix effectالأثر على المصفوفةA zero inside a same-shape matrixصفر داخل مصفوفة بالشكل نفسهRow deleted here, column deleted in the next layerيُحذف صف هنا ويُحذف عمود في الطبقة التالية
ResultالنتيجةSparse, needs indicesمصفوفة متناثرة تحتاج فهارسSmaller dense matricesمصفوفات كثيفة أصغر
Granularity endالطرف على سُلّم الدرجة الحبيبيةFine-grainedدقيق (fine-grained)Coarse-grainedخشن (coarse-grained)
Two units of removalوحدتان للحذف

Pruning as constrained optimizationالتقليم كمسألة تحسين مقيَّدة

arg⁡min⁡W  L(x; W)\underset{\mathbf{W}}{\arg\min}\; L(\mathbf{x};\, \mathbf{W})
Ordinary trainingالتدريب العادي
arg⁡min⁡WP  L(x; WP)s.t.∥WP∥0≤N\underset{\mathbf{W}_P}{\arg\min}\; L(\mathbf{x};\, \mathbf{W}_P) \quad \text{s.t.} \quad \lVert \mathbf{W}_P \rVert_0 \le N
Pruning: the same loss, at most N nonzeros. Write less-or-equal, not the slide bullet's strict less-thanالتقليم: الخسارة نفسها، بحد أقصى N قيمة غير صفرية. اكتب أصغر من أو يساوي، لا أصغر من تمامًا كما في نقطة الشريحة

Every symbolكل رمز

L
The training loss, unchanged from ordinary trainingخسارة التدريب، دون أي تغيير عن التدريب العادي
x
The input data the loss is evaluated onبيانات الإدخال التي تُحسب عليها الخسارة
W
The original dense weightsالأوزان الكثيفة الأصلية
W_P
The pruned weights, the search variableالأوزان المقلَّمة، وهي متغير البحث
||W_P||_0
The count of nonzeros, the L0 pseudo-normعدد القيم غير الصفرية، أي شبه الـ norm من نوع L0 (pseudo-norm)
N
The budget: target number of nonzerosالميزانية: العدد المستهدف من القيم غير الصفرية
sparsity=1−N∣W∣\text{sparsity} = 1 - \frac{N}{|\mathbf{W}|}
AlexNet: 1 - 6.7 / 61 = 0.89, so 89% sparsity and 9x fewer parametersAlexNet: 1 - 6.7 / 61 = 0.89، أي تناثر 89% ومعاملات أقل بـ 9 مرات

The brain prunes too (slide 6, illustrative values)الدماغ يقلّم أيضًا (الشريحة 6، قيم توضيحية)

Newbornحديث الولادة
about 2,500 synapses per neuronنحو 2,500 وصلة (synapse) لكل عصبون
2 to 4 yearsمن سنتين إلى أربع سنوات
peak, about 15,000الذروة، نحو 15,000
Adultالبالغ
about 7,000نحو 7,000
Eliminatedالمحذوف
(15,000 - 7,000) / 15,000 ≈ 53%

Train, prune, retrainتدريب، تقليم، إعادة تدريب

Train the dense network to learn which connections matter, prune every weight below a magnitude threshold, retrain the survivors with the mask fixed. Retraining is the step the paper calls critical. Part 02: Prune, fine-tune, results

درّب الشبكة الكثيفة لتتعلم أي الوصلات مهمة، ثم قلّم كل وزن يقل مقداره عن عتبة (threshold)، ثم أعد تدريب الأوزان الباقية مع تثبيت القناع. إعادة التدريب هي الخطوة التي يصفها البحث بأنها حاسمة. الجزء 02: التقليم والضبط الدقيق والنتائج

k=11−rr=1−1kk = \frac{1}{1 - r} \qquad r = 1 - \frac{1}{k}
Reduction factor k from pruning ratio r (the axis counts what is removed)معامل التخفيض k من نسبة التقليم r (المحور يعدّ ما أُزيل)

Anchor pointsنقاط مرجعية

50% prunedتقليم 50%
2x
67% prunedتقليم 67%
3x
75% prunedتقليم 75%
4x
80% prunedتقليم 80%
5x
87.5% prunedتقليم 87.5%
8x
88.9% prunedتقليم 88.9%
9x
90% prunedتقليم 90%
10x
Pruning ratioنسبة التقليمPrune onlyتقليم فقطPrune + fine-tuneتقليم + ضبط دقيقIterativeتكراري
50% (2x)0% (free lunch)0% (مكسب مجاني)0%not neededغير مطلوب
80% (5x)about -4%نحو -4%0%starting pointنقطة البداية
90% (10x)off the chartخارج المخططabout -1.7%نحو -1.7%about 0%نحو 0%
93% (14x)off the chartخارج المخططabout -4%نحو -4%about -1%نحو -1%
AlexNet top-5 accuracy loss, read from slides 8 to 10خسارة دقة top-5 في AlexNet، مقروءة من الشرائح 8 إلى 10
t=σ⋅zrt = \sigma \cdot z_r
Threshold for a Gaussian layer: z is the inverse-normal for the fraction r inside ±t. Han sets t as a quality parameter times the layer's stdالحد لطبقة غاوسية: z هي معكوس التوزيع الطبيعي للنسبة r داخل ±t. ويحدد Han قيمة t بمعامل جودة مضروب في الانحراف المعياري للطبقة
Prunedالنسبة المقلَّمةzztt
50%0.6740.020
80%1.2820.038
90%1.6450.049
Threshold for sigma = 0.03العتبة عند sigma = 0.03
Dr=DoCirCioD_r = D_o \sqrt{\frac{C_{ir}}{C_{io}}}
Retraining dropout: fc6 kept at 9% with D_o = 0.5 gives 0.5 × 0.3 = 0.15dropout أثناء إعادة التدريب: إبقاء fc6 عند 9% مع D_o = 0.5 يعطي 0.5 × 0.3 = 0.15

Parameters versus MACsالمعاملات مقابل عمليات MAC

NetworkالشبكةBeforeقبلAfterبعدParameter reductionتخفيض المعاملاتMAC reductionتخفيض عمليات MACFC share of paramsحصة FC من المعاملات
AlexNet61 M6.7 M9x3x96.2%
VGG-16138 M10.3 M12x (paper 13x)12x (13x في البحث)5x89.9%
GoogleNet7 M2.0 M3.5x5xabout 14%نحو 14%
ResNet-5026 M7.47 M3.4x6.3xabout 8%نحو 8%
SqueezeNet1 M0.38 M3.2x3.5x0%
Slide 11 plus the FC share that explains itالشريحة 11 مع حصة طبقات FC التي تفسرها
LayersالطبقاتParametersالمعاملاتFLOPsFLOPsKept after pruningالمتبقي بعد التقليم
FC layers (fc6 to fc8)طبقات FC (fc6 إلى fc8)58.6 M (96.2%)117 M (8%)9% to 25%من 9% إلى 25%
Conv layers (conv1 to conv5)طبقات الالتفاف (conv1 إلى conv5)2.3 M (3.8%)1.33 G (92%)35% to 84%من 35% إلى 84%
AlexNet splits into two worldsتنقسم AlexNet إلى عالمين
FLOP%≈Weight%×Act%in\text{FLOP\%} \approx \text{Weight\%} \times \text{Act\%}_{\text{in}}
A MAC survives only if both operands are nonzero. conv2: 0.38 × 0.88 = 33%. fc6: 0.09 × 0.34 = 3%تبقى عملية MAC فقط إذا كان المعاملان غير صفريين. conv2: 0.38 × 0.88 = 33%. fc6: 0.09 × 0.34 = 3%

Sparsity needs hardwareالتناثر يحتاج عتادًا

A dense kernel multiplies zeros like any other value, so fc6 at 9% density still executes all 38 M MACs. Speed needs an engine built for sparse formats or a pattern commodity hardware knows. Part 02: Prune, fine-tune, results

نواة الحساب الكثيفة (dense kernel) تضرب الأصفار مثل أي قيمة أخرى، لذلك تنفذ fc6 بكثافة 9% كل عمليات MAC البالغة 38 M. السرعة تحتاج محركًا مبنيًا لصيغ التناثر، أو نمطًا يعرفه العتاد التجاري. الجزء 02: التقليم والضبط الدقيق والنتائج

SystemالنظامVenueجهة النشرWhat is sparseما المتناثرHeadlineأبرز نتيجة
EIEISCA 2016Pruned FC weights and zero activations, model in SRAMأوزان FC المقلَّمة والتنشيطات الصفرية، والنموذج داخل SRAM189x CPU, 13x GPU, 24000x energy vs CPU189x مقارنة بـ CPU، و13x مقارنة بـ GPU، و24000x في الطاقة مقارنة بـ CPU
ESEFPGA 2017Pruned LSTM weights for speechأوزان LSTM المقلَّمة للتعرف على الكلام43x Core i7, 3x Titan X, 282 GOPS43x مقارنة بـ Core i7، و3x مقارنة بـ Titan X، و282 GOPS
SpArchHPCA 2020Sparse matrix times sparse matrixضرب مصفوفة متناثرة في مصفوفة متناثرة2.8x fewer DRAM accesses, 4x over OuterSPACEقراءات DRAM أقل بمقدار 2.8x، و4x مقارنة بـ OuterSPACE
SpAttenHPCA 2021Tokens and heads of attentionالرموز (tokens) ورؤوس الانتباه (heads)10x less DRAM traffic, 162x over Titan Xpحركة بيانات DRAM أقل بمقدار 10x، و162x مقارنة بـ Titan Xp
A100 Sparse Tensor CoreNVIDIA 2020Any matrix in the 2:4 patternأي مصفوفة بنمط 2:4up to 2x peak, 1.3x to 1.6x measured on BERT-Large layersحتى 2x في الذروة، و1.3x إلى 1.6x مقيسة على طبقات BERT-Large
Slide 13 hardware, headline from each abstractعتاد الشريحة 13، مع أبرز نتيجة من ملخص كل بحث

Granularity: the tradeالدرجة الحبيبية: المقايضة

The unit you delete is the granularity. Small units give more masks to choose from, so higher sparsity at equal accuracy. Large units give a regular survivor that dense hardware runs. Coarse masks are a subset of fine masks, so structured pruning can tie but never beat unstructured at equal accuracy. Part 03: Granularity spectrum

الوحدة التي تحذفها هي الدرجة الحبيبية (granularity). الوحدات الصغيرة تعطي أقنعة أكثر للاختيار منها، وبالتالي تناثرًا أعلى عند الدقة نفسها. الوحدات الكبيرة تعطي بنية باقية منتظمة يشغّلها العتاد الكثيف. الأقنعة الخشنة مجموعة جزئية من الأقنعة الدقيقة، لذلك يمكن للتقليم المهيكل (structured) أن يعادل غير المهيكل (unstructured) لكنه لا يتفوق عليه أبدًا عند الدقة نفسها. الجزء 03: طيف الدرجات الحبيبية

Removing 24 of 64 weights, two waysحذف 24 من 64 وزنًا بطريقتين

Weights removedالأوزان المحذوفة
24 of 64 (37.5%)24 من 64 (37.5%)
Fine-grained masksالأقنعة الدقيقة (fine-grained)
C(64, 24) ≈ 2.5 x 10^17
Row-structured masksالأقنعة المهيكلة على مستوى الصف
C(8, 3) = 56
Survivor, fine-grainedالباقي في التقليم الدقيق
8 x 8 with 24 holes, one index per survivorمصفوفة 8 x 8 فيها 24 فراغًا، مع فهرس واحد لكل وزن باقٍ
Survivor, row-structuredالباقي في التقليم المهيكل على مستوى الصف
5 x 8 dense, no indicesمصفوفة كثيفة 5 x 8 دون فهارس
NetworkالشبكةDensity keptالكثافة المتبقيةFine-grainedدقيق (Fine-grained)Vector-levelمستوى المتجه (Vector-level)Kernel-levelمستوى النواة (Kernel-level)
AlexNet24.8%80.41%79.94%79.20%
VGG-1623.5%90.56%90.48%89.70%
ResNet-5040.0%92.34%92.26%92.07%
Top-5 ImageNet accuracy at equal density (Mao et al. 2017, Table 1)دقة top-5 على ImageNet عند الكثافة نفسها (Mao et al. 2017، الجدول 1)

The convolution weight tensorموتر أوزان الالتفاف

N=co⋅ci⋅kh⋅kwN = c_o \cdot c_i \cdot k_h \cdot k_w
Shape [c_o, c_i, k_h, k_w]; slide 17 has 3 × 2 × 3 × 3 = 54 weights, 3 filters and 6 kernelsالأبعاد [c_o, c_i, k_h, k_w]؛ وفي الشريحة 17 هناك 3 × 2 × 3 × 3 = 54 وزنًا و3 مرشحات و6 أنوية
UnitالوحدةSliceالمقطع من الموترWeightsالأوزانShare of 54الحصة من 54
Single weightوزن واحدW[o, i, r, c]11.9%
Row inside a kernelصف داخل نواةW[o, i, r, :]k_w = 35.6%
Kernelنواة (kernel)W[o, i, :, :]k_h x k_w = 916.7%
Filter (output channel)مرشح (filter، أي قناة إخراج)W[o, :, :, :]c_i x k_h x k_w = 1833.3%
Input channelقناة إدخالW[:, i, :, :]c_o x k_h x k_w = 2750.0%
Units inside the 54-weight tensorالوحدات داخل الموتر ذي الأوزان الأربعة والخمسين
Granularityالدرجة الحبيبيةUnitالوحدةIndex costكلفة الفهرسةRuns efficiently onيعمل بكفاءة على
Fine-grainedدقيق (Fine-grained)Any single weight (0-D)أي وزن منفرد (0-D)One index per survivorفهرس واحد لكل وزن باقٍCustom engines: EIE, SCNNمحركات مخصصة: EIE وSCNN
Pattern-basedنمطي (Pattern-based)Fixed mask inside each kernelقناع ثابت داخل كل نواةOne pattern id per kernelمعرّف نمط واحد لكل نواةPattern-specialised compilers (PatDNN)مترجمات مخصصة للأنماط (PatDNN)
Vector-levelمستوى المتجه (Vector-level)A row of a kernel (1-D)صف من نواة (1-D)One index per surviving rowفهرس واحد لكل صف باقٍ1-D conv primitives (Eyeriss)عمليات التفاف أحادية البعد (Eyeriss)
Kernel-levelمستوى النواة (Kernel-level)A whole k_h x k_w kernel (2-D)نواة كاملة k_h x k_w (2-D)One index per surviving kernelفهرس واحد لكل نواة باقية2-D conv primitives, Winogradعمليات التفاف ثنائية البعد، وWinograd
Channel-levelمستوى القناة (Channel-level)An input channel across all filters (3-D)قناة إدخال عبر كل المرشحات (3-D)None: the tensor shrinksلا شيء: الموتر نفسه يصغرAny dense CPU or GPU libraryأي مكتبة كثيفة على CPU أو GPU
From irregular to regular (Mao et al. 2017)من غير المنتظم إلى المنتظم (Mao et al. 2017)

N:M sparsity and the 2:4 patternتناثر N:M ونمط 2:4

NVIDIA convention: at most N nonzeros in every contiguous M weights. Two zeros in every four is 2:4, exactly 50% sparse, fine-grained inside each group (six possible masks) and rigidly structured across the matrix, so a survivor's address is computed, not looked up. Part 04: Fine, pattern, channel

اصطلاح NVIDIA: على الأكثر N قيمة غير صفرية في كل M أوزان متتالية. صفران في كل أربعة هو 2:4، تناثر 50% بالضبط، دقيق داخل كل مجموعة (ستة أقنعة ممكنة) ومهيكل بصرامة عبر المصفوفة، لذلك يُحسب عنوان الوزن الباقي حسابًا ولا يُبحث عنه في فهرس. الجزء 04: التقليم الدقيق والنمطي وتقليم القنوات

s=1−NMs = 1 - \frac{N}{M}
Sparsity of an N:M pattern under the N-nonzero conventionالتناثر (sparsity) لنمط N:M وفق اصطلاح N قيمة غير صفرية
PatternالنمطN nonzero per M (NVIDIA)N قيم غير صفرية لكل M (NVIDIA)N pruned per M (slide)N قيم مقلَّمة لكل M (الشريحة)
2:450%50%
1:475%25%
2:875%25%
4:850%50%
The slide's wording inverts the conventionصياغة الشريحة تعكس الاصطلاح
ItemالبندFP16FP16INT8INT8
Denseكثيفة1024 bits512 bits
Kept values (half)القيم المحفوظة (النصف)512 bits256 bits
2-bit indicesفهارس من 2 بت64 bits64 bits
Compressed totalالإجمالي بعد الضغط576 bits320 bits
Ratioالنسبة1.78x (43.75% saved)1.78x (توفير 43.75%)1.6x (37.5% saved)1.6x (توفير 37.5%)
Index overhead on kept valuesكلفة الفهارس نسبةً إلى القيم المحفوظة12.5%25%
Compressing an 8 × 8 matrix to 2:4: half the values plus a 2-bit index per survivorضغط مصفوفة 8 × 8 إلى نمط 2:4: نصف القيم مع فهرس من 2 بت لكل قيمة باقية
NetworkالشبكةMetricالمقياسDense FP16FP16 كثيفSparse FP16FP16 متناثر
ResNet-50ImageNet top-1دقة top-1 على ImageNet76.176.2
BERT-LargeSQuAD v1.1 F1مقياس F1 على SQuAD v1.191.991.9
FairSeq TransformerWMT'14 EN-DE BLEUمقياس BLEU على WMT'14 EN-DE28.228.5
MaskRCNN-RN50COCO 2017 bbAPمقياس bbAP على COCO 201737.937.9
Train, magnitude-prune to 2:4, retrain with the same schedule (NVIDIA)تدريب، ثم تقليم بالمقدار إلى 2:4، ثم إعادة تدريب بالجدول الزمني نفسه (NVIDIA)

Fine-grained, 2:4 and channel pruning comparedمقارنة التقليم الدقيق ونمط 2:4 وتقليم القنوات

Granularityالدرجة الحبيبيةCompressionالضغطSpeedupالتسريع
Fine-grainedدقيق (Fine-grained)Largest (AlexNet 9x, VGG-16 13x)الأكبر (AlexNet 9x، VGG-16 13x)None on dense GPU kernels; needs EIE-class hardwareلا تسريع على نوى GPU الكثيفة؛ يحتاج عتادًا من فئة EIE
2:4 patternنمط 2:4Fixed at 50% (about 1.78x storage)ثابت عند 50% (نحو 1.78x في التخزين)Up to 2x matmul on Ampere Sparse Tensor Coresحتى 2x في ضرب المصفوفات على Sparse Tensor Cores في Ampere
Channelالقناة (Channel)Smallest, weak weights survive with the channelالأصغر، فالأوزان الضعيفة تبقى مع قناتهاDirect on any hardware: a smaller dense networkمباشر على أي عتاد: شبكة كثيفة أصغر
Compression versus speedالضغط مقابل السرعة

Pruning the output channels of layer l also removes input columns of layer l+1, so layer l keeps (1 - s_(l-1)) × (1 - s_l) of its weights and the same fraction of its MACs.

تقليم قنوات الإخراج في الطبقة l يحذف أيضًا أعمدة إدخال في الطبقة l+1، لذلك تُبقي الطبقة l النسبة (1 - s_(l-1)) × (1 - s_l) من أوزانها والنسبة نفسها من عمليات MAC.

LayerالطبقةUniform 0.3موحد 0.3Uniform 0.4موحد 0.4Per-layerلكل طبقة
Layer 0الطبقة 00.700.600.50
Layers 1 to 4الطبقات 1 إلى 40.49 each0.49 لكل منها0.36 each0.36 لكل منها0.35, 0.21, 0.24, 0.56
Total keptالإجمالي المتبقي53.2%40.8%37.2%
Five 64-channel conv layers: kept fraction under uniform shrink and the slide's per-layer set 0.5, 0.3, 0.7, 0.2, 0.3خمس طبقات التفاف في كل منها 64 قناة: النسبة المتبقية مع التصغير الموحد ومع النسب الخاصة بكل طبقة في الشريحة 0.5, 0.3, 0.7, 0.2, 0.3
ModelالنموذجMMACsMMACsTop-1Top-1Latencyزمن الاستجابةSpeedupالتسريع
MobileNet 1.0 (full width)MobileNet 1.0 (العرض الكامل)56970.6%123.3 ms1.00x
MobileNet 0.75 (uniform shrink)MobileNet 0.75 (تصغير موحد)32568.4%72.3 ms1.7x
AMC, 50% FLOPs budgetAMC، ميزانية 50% من FLOPs28570.5%68.3 ms1.81x
AMC, 50% latency budgetAMC، ميزانية 50% من زمن الاستجابة27270.2%63.3 ms1.95x
AMC versus uniform width multiplier, MobileNet on a Pixel 1 (AMC Table 4)AMC مقابل مضاعف العرض الموحد، MobileNet على Pixel 1 (AMC، الجدول 4)

Choosing a granularity for a boardاختيار الدرجة الحبيبية حسب اللوحة

Ampere-class NVIDIA GPU (Jetson Orin, A100)وحدة GPU من NVIDIA بمعمارية Ampere (Jetson Orin، A100)
Prune to 2:4: half the weights, about 2x on the matmuls, accuracy held by retraining.قلّم إلى نمط 2:4: نصف الأوزان، ونحو 2x في عمليات ضرب المصفوفات، مع الحفاظ على الدقة بإعادة التدريب.
Phone CPU, microcontroller, dense-only NPUمعالج CPU في هاتف، أو متحكم دقيق، أو NPU لا يدعم إلا الحساب الكثيف
Channel pruning with searched per-layer ratios, AMC style. A smaller dense network is the only sparsity such hardware feels.تقليم القنوات مع نسب لكل طبقة يُبحث عنها على طريقة AMC. الشبكة الكثيفة الأصغر هي النوع الوحيد من التناثر الذي يشعر به هذا العتاد.
Sparse accelerator, or storage is the constraintمسرّع مصمم للتناثر، أو عندما يكون التخزين هو القيد
Fine-grained pruning for the largest compression ratio.التقليم الدقيق للحصول على أعلى نسبة ضغط.

Magnitude criteriaمعايير المقدار

A criterion estimates importance: how much the loss would change if this parameter or group were zeroed. The less important the removed parameters, the better the pruned network. Magnitude uses the absolute value, never the signed weight: -5 outranks 3. Part 05: Magnitude and scaling criteria

المعيار يقدّر الأهمية: كم ستتغير الخسارة لو صُفّر هذا المعامل أو هذه المجموعة. كلما قلت أهمية المعاملات المحذوفة كانت الشبكة المقلَّمة أفضل. معيار المقدار يستخدم القيمة المطلقة، لا الوزن بإشارته: -5 أعلى رتبة من 3. الجزء 05: معايير المقدار والقياس

Importance=∣W∣\text{Importance} = |W|
Element-wise. The removed term is really |w_i| |x_i|, so compare within a layer, never across layersلكل عنصر. الحد المحذوف فعليًا هو |w_i| |x_i|، لذلك قارن داخل الطبقة الواحدة، ولا تقارن بين الطبقات أبدًا
∥W(S)∥p=(∑i∈S∣wi∣p)1/p\big\lVert W^{(S)} \big\rVert_p = \Big(\sum_{i \in S} |w_i|^p\Big)^{1/p}
Lp norm of a structural set S. p = 1 sums absolute values (Li et al.), p = 2 is the Euclidean length (Wen et al. group Lasso)معيار Lp لمجموعة بنيوية S. p = 1 يجمع القيم المطلقة (Li et al.)، وp = 2 هو الطول الإقليدي (group Lasso عند Wen et al.)
CriterionالمعيارRow 0 scoreدرجة الصف 0Row 1 scoreدرجة الصف 1Row prunedالصف المقلَّمPruned matrixالمصفوفة المقلَّمة
Element-wise |w|على مستوى العنصر |w|not a row scoreليست درجة صفnot a row scoreليست درجة صفnone (two smallest elements)لا يوجد (يُحذف أصغر عنصرين)[[3, 0], [0, -5]]
Row-wise L1على مستوى الصف L156row 0الصف 0[[0, 0], [1, -5]]
Row-wise L2على مستوى الصف L2sqrt(13) = 3.61sqrt(26) = 5.10row 0الصف 0[[0, 0], [1, -5]]
[[3, -2], [1, -5]] at 50% sparsity[[3, -2], [1, -5]] عند تناثر 50%
RowالصفL1L1L2L2
[3, 3]6sqrt(18) = 4.24
[0, 5]55
Row keptالصف المحفوظ[3, 3][0, 5]
When the norm changes the answerعندما يغيّر الـ norm الإجابة

Scaling-based pruning and batch norm gammaالتقليم القائم على معاملات القياس وgamma في batch norm

L=∑(x,y)ℓ(f(x,W),y)+λ∑γ∈Γ∣γ∣L = \sum_{(x, y)} \ell\big(f(x, W), y\big) + \lambda \sum_{\gamma \in \Gamma} |\gamma|
Network slimming: an L1 penalty pushes every channel factor toward zero; prune small |gamma| below a global percentileNetwork slimming: عقوبة L1 تدفع كل معامل قناة نحو الصفر؛ ثم قلّم قيم |gamma| الصغيرة دون مئين عام
zo=γ zi−μBσB2+ϵ+βz_o = \gamma \, \frac{z_i - \mu_{\mathcal{B}}}{\sqrt{\sigma^2_{\mathcal{B}} + \epsilon}} + \beta
Batch normalization already supplies one gamma per channel, freebatch normalization توفر أصلًا قيمة gamma واحدة لكل قناة، مجانًا

Network slimming (Liu et al. 2017)تنحيف الشبكة (Network slimming، Liu et al. 2017)

Penaltyالعقوبة
lambda = 1e-4 (VGGNet), 1e-5 (ResNet, DenseNet) on CIFARlambda = 1e-4 لـ VGGNet، و1e-5 لـ ResNet وDenseNet، على CIFAR
Thresholdالعتبة
One global percentile over every gamma in the network; per-layer ratios fall out automaticallyنسبة مئوية (percentile) واحدة عامة على كل قيم gamma في الشبكة؛ وتنتج النسب الخاصة بكل طبقة تلقائيًا
VGGNet CIFAR-10, 70% channels prunedVGGNet على CIFAR-10، مع تقليم 70% من القنوات
error 6.34% to 6.20%, params 20.04 M to 2.30 M, FLOPs 7.97e8 to 3.91e8الخطأ من 6.34% إلى 6.20%، والمعاملات من 20.04 M إلى 2.30 M، وFLOPs من 7.97e8 إلى 3.91e8
Why gammaلماذا gamma
Already there, one per channel, no new parameters; BN fixes the activation scale so gamma alone measures the channelموجود أصلًا، واحد لكل قناة، دون معاملات جديدة؛ وBN يثبّت مقياس التنشيط، فيقيس gamma وحده القناة

Second-order pruning: OBDالتقليم من الرتبة الثانية: OBD

Pruning is a perturbation δW with δw_i = w_i at the pruned position. Price it with a local quadratic model instead of re-running the network. Part 06: Loss, activation and regression criteria

التقليم اضطراب δW فيه δw_i = w_i عند الموضع المقلَّم. قدّر كلفته بنموذج تربيعي محلي بدل إعادة تشغيل الشبكة. الجزء 06: معايير الخسارة والتنشيط والانحدار

δL=∑igi δwi+12∑ihii δwi2+12∑i≠jhij δwi δwj+O ⁣(∥δW∥3)\delta L = \sum_i g_i\,\delta w_i + \frac{1}{2}\sum_i h_{ii}\,\delta w_i^2 + \frac{1}{2}\sum_{i \neq j} h_{ij}\,\delta w_i\,\delta w_j + O\!\left(\lVert \delta W \rVert^3\right)
g_i = ∂L/∂w_i, h_ij = ∂²L/(∂w_i ∂w_j). Full Hessian has n² entries: 6.5 million for 2578 parametersg_i = ∂L/∂w_i، وh_ij = ∂²L/(∂w_i ∂w_j). مصفوفة Hessian الكاملة فيها n² عنصرًا: 6.5 مليون لـ 2578 معاملًا
OBD nameالاسم في OBDSlide wordingصياغة الشريحةTerm removedالحد المحذوف
Quadraticالتربيعية (Quadratic)L is nearly quadraticدالة الخسارة L شبه تربيعيةO(||δW||³)
Extremalالقيمة القصوى (Extremal)Training has convergedالتدريب قد تقاربΣ gᵢ δwᵢ (and makes every hᵢᵢ ≥ 0)Σ gᵢ δwᵢ (ويجعل كل hᵢᵢ ≥ 0)
Diagonalالقطرية (Diagonal)Deletion errors are independentأخطاء الحذف مستقلة عن بعضها½ Σ hᵢⱼ δwᵢ δwⱼ
Three assumptions, three crossingsثلاثة افتراضات، ثلاثة حدود مشطوبة
importancewi=∣δLi∣=12hiiwi2\text{importance}_{w_i} = \lvert \delta L_i \rvert = \frac{1}{2} h_{ii} w_i^2
OBD saliency; delete the smallest first. With every h_ii equal this is magnitude rankingأهمية OBD؛ احذف الأصغر أولًا. وحين تتساوى كل قيم h_ii يصبح هذا ترتيبًا بحسب المقدار
Weightالوزنwᵢwᵢhᵢᵢhᵢᵢ½ hᵢᵢ wᵢ²½ hᵢᵢ wᵢ²MagnitudeالمقدارOBDOBD
A1.50.20.225keepيُحفظpruneيُقلَّم
B1.01.00.5keepيُحفظkeepيُحفظ
C-0.64.00.72keepيُحفظkeepيُحفظ
D0.58.01.0pruneيُقلَّمkeepيُحفظ
E0.22.00.04pruneيُقلَّمpruneيُقلَّم
Prune two of five: magnitude and OBD disagreeقلّم اثنين من خمسة: معيار المقدار و OBD يختلفان

APoZ and Network TrimmingAPoZ وNetwork Trimming

APoZc=∑k=1N∑j=1Mf ⁣(Oc,j(k)=0)N×M\mathrm{APoZ}_c = \frac{\sum_{k=1}^{N}\sum_{j=1}^{M} f\!\left(O_{c,j}(k) = 0\right)}{N \times M}
Zeros divided by batch × H × W. Smaller APoZ means more important; prune the largestالأصفار مقسومة على الدفعة × H × W. كلما صغرت APoZ زادت الأهمية؛ قلّم الأكبر

Slide 40 example: batch 2, three channels, 4 × 4 mapsمثال الشريحة 40: دفعة من 2، وثلاث قنوات، وخرائط 4 × 4

Channel 0القناة 0
5 + 6 = 11 zeros, 11/32 = 34.4%5 + 6 = 11 صفرًا، 11/32 = 34.4%
Channel 1القناة 1
5 + 7 = 12 zeros, 12/32 = 37.5%5 + 7 = 12 صفرًا، 12/32 = 37.5%
Channel 2القناة 2
6 + 8 = 14 zeros, 14/32 = 43.8%, pruned6 + 8 = 14 صفرًا، 14/32 = 43.8%، تُقلَّم
Denominatorالمقام
batch 2 × height 4 × width 4 = 32الدفعة 2 × الارتفاع 4 × العرض 4 = 32
Operating ruleقاعدة التشغيل
Trim neurons more than one standard deviation above the layer mean, about 16% of a layer; retrain from the pre-trim weightsاحذف العصبونات التي يزيد APoZ فيها عن متوسط الطبقة بأكثر من انحراف معياري واحد، أي نحو 16% من الطبقة؛ ثم أعد التدريب انطلاقًا من الأوزان التي كانت قبل الحذف

Mean APoZ on VGG-16 rises with depth: CONV1-1 47.07%, CONV4-3 87.30%, CONV5-3 93.19%, FC6 75.26%; 631 neurons were zero more than 90% of the time. Neuron pruning is coarse-grained weight pruning: a row W[o, :] of a linear layer or a filter W[o, :, :, :] of a conv layer, plus the next layer's matching input column or kernels.

متوسط APoZ في VGG-16 يرتفع مع العمق: CONV1-1 47.07%، وCONV4-3 87.30%، وCONV5-3 93.19%، وFC6 75.26%؛ وكان 631 عصبونًا صفرًا في أكثر من 90% من الوقت. تقليم العصبونات هو تقليم أوزان خشن: صف W[o, :] في طبقة خطية أو مرشح W[o, :, :, :] في طبقة التفاف، إضافة إلى عمود الإدخال أو النوى المقابلة في الطبقة التالية.

Regression-based channel pruningتقليم القنوات القائم على الانحدار

Z=XWT=∑c=0ci−1XcWcTZ = X W^{T} = \sum_{c=0}^{c_i - 1} X_c W_c^{T}
Layer output as a sum of per-input-channel contributions; removing channel c removes one termمخرج الطبقة بوصفه مجموع مساهمات قنوات الإدخال؛ وإزالة القناة c تزيل حدًا واحدًا
arg⁡min⁡W, β ∥Z−∑c=0ci−1βc XcWcT∥F2s.t.∥β∥0≤Nc\underset{W,\,\beta}{\arg\min}\ \Bigl\lVert Z - \sum_{c=0}^{c_i - 1} \beta_c\, X_c W_c^{T} \Bigr\rVert_F^2 \quad \text{s.t.} \quad \lVert \beta \rVert_0 \le N_c
beta has length c_i and switches input channels; N_c is how many survive; Z keeps its b × c_o shapeطول beta هو c_i وهي تشغّل قنوات الإدخال أو توقفها؛ وN_c عدد القنوات الباقية؛ وتحتفظ Z بأبعادها b × c_o
StepالخطوةFixedالثابتSolvedالمحسوبSolverطريقة الحلOutputالمخرج
1WβLASSO (L1-relaxed selection)LASSO (اختيار مُرخّى بـ L1)Which input channels surviveأي قنوات الإدخال تبقى
2βWLeast squares (closed form)المربعات الصغرى (حل مغلق)Weights that best rebuild Zالأوزان التي تعيد بناء Z بأفضل شكل
The L0 constraint is NP-hard, so relax to λ||β||₁ and alternateقيد L0 مسألة NP-hard، لذلك نرخّيه إلى λ||β||₁ ونبدّل بين خطوتين
  • ||W_c||_F = 1 per channel stops shrinking β while inflating W. In practice raise λ until ||β||₀ hits the target, then reconstruct once.القيد ||W_c||_F = 1 لكل قناة يمنع تصغير β مع تضخيم W. عمليًا، ارفع λ حتى يصل ||β||₀ إلى الهدف، ثم أعد البناء مرة واحدة.
  • Results: VGG-16 4x speedup at 1.0% extra top-5 error, ResNet-50 2x at 1.4%; 5000 images × 10 positions; fine-tune 10 epochs.النتائج: VGG-16 بتسريع 4x مع زيادة 1.0% في خطأ top-5، وResNet-50 بتسريع 2x مع زيادة 1.4%؛ باستخدام 5000 صورة × 10 مواضع لكل صورة؛ ثم ضبط دقيق لمدة 10 حقب (epochs).

Criteria comparedمقارنة المعايير

CriterionالمعيارReadsما يقرؤهCostالكلفةGranularityالدرجة الحبيبيةScoreالدرجةPaperالبحث
Magnitudeالمقدار (Magnitude)Weight values onlyقيم الأوزان فقطNoneلا شيءAnyأي درجة|w|, Lp norm of a set|w|، أو Lp norm لمجموعةHan et al. 2015
Scaling factorمعامل القياس (Scaling factor)Trained gamma per channelgamma مدرَّب لكل قناةTraining with L1 penaltyتدريب مع عقوبة L1Channelالقناة|γ|Liu et al. 2017
OBDWeights and hᵢᵢالأوزان وhᵢᵢOne second backward passتمرير خلفي ثانٍ واحدWeightالوزن½ hᵢᵢ wᵢ²LeCun et al. 1989
APoZReLU outputs on validation dataمخرجات ReLU على بيانات التحققOne forward pass over N imagesتمرير أمامي واحد على N صورةNeuron or channelالعصبون أو القناةFraction of zeros (smaller is more important)نسبة الأصفار (الأصغر أهم)Hu et al. 2016
Regressionالانحدار (Regression)Sampled layer inputs and outputsعينات من مدخلات الطبقة ومخرجاتهاLASSO plus least squares per layerLASSO مع المربعات الصغرى لكل طبقةInput channelقناة الإدخالReconstruction error of Zخطأ إعادة بناء ZHe, Zhang, Sun 2017
What each criterion reads, what it costs and what it scoresما يقرؤه كل معيار، وكم يكلّف، وماذا يقيّم

Slide errataأخطاء الشرائح

Answer with the corrected fact, and name the slide version if a question depends on it.

أجب بالمعلومة المصحَّحة، واذكر نسخة الشريحة إن كان السؤال يعتمد عليها.

What the slides get wrongما تخطئ فيه الشرائح

Slide 5الشريحة 5
The bullet writes ||W_p||_0 < N; the figure and the correct form use ≤ N. Lowercase and uppercase P both mean the pruned weights. Inherited from the MIT deck.النقطة تكتب ||W_p||_0 < N؛ أما الشكل والصيغة الصحيحة فيستخدمان ≤ N. الحرف P الصغير والكبير كلاهما يعني الأوزان المقلَّمة. الخطأ موروث من شرائح MIT.
Slide 6الشريحة 6
"Drachman, Neurology 2004" gives the page as the year. The editorial is Neurology 2005, vol. 64(12), pages 2004 to 2005.عبارة «Drachman, Neurology 2004» تضع رقم الصفحة مكان السنة. المقال الافتتاحي منشور في Neurology 2005، المجلد 64(12)، الصفحات من 2004 إلى 2005.
Slides 9, 10الشريحتان 9 و10
Legend reads "Finetuing". Read "Finetuning". The chart is AlexNet top-5 loss with L2 regularization; the paper's L1 curves are omitted.مفتاح المخطط مكتوب «Finetuing»، والصحيح «Finetuning». المخطط يعرض خسارة top-5 لشبكة AlexNet مع تنظيم L2؛ ومنحنيات L1 الموجودة في البحث محذوفة.
Slide 11الشريحة 11
VGG-16 12x on the slide, 13x in the paper abstract (138 / 10.3 = 13.4). SqueezeNet is 1.2 M, not 1 M (1.2 / 0.38 = 3.2x). ResNet-50 is 25.5 M, MAC reduction 6.25x.الشريحة تذكر 12x لـ VGG-16، وملخص البحث يذكر 13x (138 / 10.3 = 13.4). حجم SqueezeNet هو 1.2 M لا 1 M (1.2 / 0.38 = 3.2x). وحجم ResNet-50 هو 25.5 M، وتخفيض عمليات MAC هو 6.25x.
Slide 12الشريحة 12
The 95% soccer caption comes from the MIT deck; the thesis figure shows four 90% examples including a white bird whose caption does not change.تعليق كرة القدم عند 95% مأخوذ من شرائح MIT؛ أما شكل الأطروحة فيعرض أربعة أمثلة عند 90%، منها طائر أبيض لا يتغير تعليقه.
Slide 13الشريحة 13
"1.5X measured BERT speedup" is not in the Ampere whitepaper (which says up to 2x); cuSPARSELt measures 1.3x to 1.6x per BERT-Large layer.عبارة «1.5X measured BERT speedup» غير موجودة في الورقة البيضاء لـ Ampere (التي تذكر حتى 2x)؛ وتقيس cuSPARSELt من 1.3x إلى 1.6x لكل طبقة من BERT-Large.
Slide 20الشريحة 20
Same table as slide 11: VGG-16 12x versus 13x in both NIPS 2015 and thesis Table 3.1. The MIT source names EIE as the custom hardware example; this copy dropped it.الجدول نفسه الموجود في الشريحة 11: 12x لـ VGG-16 مقابل 13x في بحث NIPS 2015 وفي الجدول 3.1 من الأطروحة معًا. مصدر MIT يذكر EIE مثالًا على العتاد المخصص، وهذه النسخة حذفته.
Slide 21الشريحة 21
"N of them is pruned" inverts NVIDIA's convention, where N is the number kept. Only symmetric 2:4 survives the swap; 1:4 is 75% sparse, not 25%.عبارة «N of them is pruned» تعكس اصطلاح NVIDIA، حيث N هو عدد القيم المحفوظة. النمط المتماثل 2:4 وحده يبقى صحيحًا بعد هذا التبديل؛ فنمط 1:4 تناثره 75% لا 25%.
Slide 34الشريحة 34
With δL = L(W) - L(W_P) and W_P = W - δW, the second-order terms should carry a minus sign. The paper defines the change as new minus old, which is what the right-hand side follows.مع δL = L(W) - L(W_P) وW_P = W - δW يجب أن تحمل حدود الرتبة الثانية إشارة سالبة. البحث يعرّف التغير بأنه الجديد ناقص القديم، وهذا ما يتبعه الطرف الأيمن.
Slide 36الشريحة 36
Writes h_ii = ∂²L / (∂w_i ∂w_j). The diagonal entry is ∂²L / ∂w_i².تكتب h_ii = ∂²L / (∂w_i ∂w_j). والعنصر القطري هو ∂²L / ∂w_i².
Slide 37الشريحة 37
"Cited by 7712" is a snapshot. Quote the venue (NIPS 1989) and year, not the count.عبارة «Cited by 7712» لقطة من وقت معين. اذكر مكان النشر (NIPS 1989) والسنة، لا عدد الاستشهادات.
Slides 39, 40الشريحتان 39 و40
Network Trimming is arXiv 1607.03250, dated 12 July 2016, not 2017. Slide 40 reads "the more importance the neuron has"; it should read "the more important the neuron is".بحث Network Trimming منشور على arXiv 1607.03250 بتاريخ 12 يوليو 2016، لا 2017. والشريحة 40 تقول «the more importance the neuron has»، والصحيح «the more important the neuron is».