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 |
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 MULT | 640 / 3.1 ≈ 206 | About two hundred multiplies per fetchنحو مئتي عملية ضرب مقابل كل قراءة واحدة |
| DRAM / int MAC | 640 / 3.2 = 200 | The slide's 200x icon lineسطر أيقونة 200x في الشريحة |
| DRAM / int ADD | 640 / 0.1 = 6400 | Relative to the cheapest operationمقارنة بأرخص عملية |
| DRAM / SRAM | 640 / 5 = 128 | The payoff of fitting the model on chipمكسب احتواء النموذج داخل الشريحة (on chip) |
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_ij | One 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) |
Pruning as constrained optimizationالتقليم كمسألة تحسين مقيَّدة
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الميزانية: العدد المستهدف من القيم غير الصفرية
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: التقليم والضبط الدقيق والنتائج
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% |
| Prunedالنسبة المقلَّمة | zz | tt |
|---|---|---|
| 50% | 0.674 | 0.020 |
| 80% | 1.282 | 0.038 |
| 90% | 1.645 | 0.049 |
Parameters versus MACsالمعاملات مقابل عمليات MAC
| Networkالشبكة | Beforeقبل | Afterبعد | Parameter reductionتخفيض المعاملات | MAC reductionتخفيض عمليات MAC | FC share of paramsحصة FC من المعاملات |
|---|---|---|---|---|---|
| AlexNet | 61 M | 6.7 M | 9x | 3x | 96.2% |
| VGG-16 | 138 M | 10.3 M | 12x (paper 13x)12x (13x في البحث) | 5x | 89.9% |
| GoogleNet | 7 M | 2.0 M | 3.5x | 5x | about 14%نحو 14% |
| ResNet-50 | 26 M | 7.47 M | 3.4x | 6.3x | about 8%نحو 8% |
| SqueezeNet | 1 M | 0.38 M | 3.2x | 3.5x | 0% |
| Layersالطبقات | Parametersالمعاملات | FLOPsFLOPs | Kept 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% |
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أبرز نتيجة |
|---|---|---|---|
| EIE | ISCA 2016 | Pruned FC weights and zero activations, model in SRAMأوزان FC المقلَّمة والتنشيطات الصفرية، والنموذج داخل SRAM | 189x CPU, 13x GPU, 24000x energy vs CPU189x مقارنة بـ CPU، و13x مقارنة بـ GPU، و24000x في الطاقة مقارنة بـ CPU |
| ESE | FPGA 2017 | Pruned LSTM weights for speechأوزان LSTM المقلَّمة للتعرف على الكلام | 43x Core i7, 3x Titan X, 282 GOPS43x مقارنة بـ Core i7، و3x مقارنة بـ Titan X، و282 GOPS |
| SpArch | HPCA 2020 | Sparse matrix times sparse matrixضرب مصفوفة متناثرة في مصفوفة متناثرة | 2.8x fewer DRAM accesses, 4x over OuterSPACEقراءات DRAM أقل بمقدار 2.8x، و4x مقارنة بـ OuterSPACE |
| SpAtten | HPCA 2021 | Tokens and heads of attentionالرموز (tokens) ورؤوس الانتباه (heads) | 10x less DRAM traffic, 162x over Titan Xpحركة بيانات DRAM أقل بمقدار 10x، و162x مقارنة بـ Titan Xp |
| A100 Sparse Tensor Core | NVIDIA 2020 | Any matrix in the 2:4 patternأي مصفوفة بنمط 2:4 | up to 2x peak, 1.3x to 1.6x measured on BERT-Large layersحتى 2x في الذروة، و1.3x إلى 1.6x مقيسة على طبقات BERT-Large |
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) |
|---|---|---|---|---|
| AlexNet | 24.8% | 80.41% | 79.94% | 79.20% |
| VGG-16 | 23.5% | 90.56% | 90.48% | 89.70% |
| ResNet-50 | 40.0% | 92.34% | 92.26% | 92.07% |
The convolution weight tensorموتر أوزان الالتفاف
| Unitالوحدة | Sliceالمقطع من الموتر | Weightsالأوزان | Share of 54الحصة من 54 |
|---|---|---|---|
| Single weightوزن واحد | W[o, i, r, c] | 1 | 1.9% |
| Row inside a kernelصف داخل نواة | W[o, i, r, :] | k_w = 3 | 5.6% |
| Kernelنواة (kernel) | W[o, i, :, :] | k_h x k_w = 9 | 16.7% |
| Filter (output channel)مرشح (filter، أي قناة إخراج) | W[o, :, :, :] | c_i x k_h x k_w = 18 | 33.3% |
| Input channelقناة إدخال | W[:, i, :, :] | c_o x k_h x k_w = 27 | 50.0% |
| 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 |
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: التقليم الدقيق والنمطي وتقليم القنوات
| Patternالنمط | N nonzero per M (NVIDIA)N قيم غير صفرية لكل M (NVIDIA) | N pruned per M (slide)N قيم مقلَّمة لكل M (الشريحة) |
|---|---|---|
| 2:4 | 50% | 50% |
| 1:4 | 75% | 25% |
| 2:8 | 75% | 25% |
| 4:8 | 50% | 50% |
| Itemالبند | FP16FP16 | INT8INT8 |
|---|---|---|
| Denseكثيفة | 1024 bits | 512 bits |
| Kept values (half)القيم المحفوظة (النصف) | 512 bits | 256 bits |
| 2-bit indicesفهارس من 2 بت | 64 bits | 64 bits |
| Compressed totalالإجمالي بعد الضغط | 576 bits | 320 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% |
| Networkالشبكة | Metricالمقياس | Dense FP16FP16 كثيف | Sparse FP16FP16 متناثر |
|---|---|---|---|
| ResNet-50 | ImageNet top-1دقة top-1 على ImageNet | 76.1 | 76.2 |
| BERT-Large | SQuAD v1.1 F1مقياس F1 على SQuAD v1.1 | 91.9 | 91.9 |
| FairSeq Transformer | WMT'14 EN-DE BLEUمقياس BLEU على WMT'14 EN-DE | 28.2 | 28.5 |
| MaskRCNN-RN50 | COCO 2017 bbAPمقياس bbAP على COCO 2017 | 37.9 | 37.9 |
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:4 | Fixed 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مباشر على أي عتاد: شبكة كثيفة أصغر |
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.3 | Uniform 0.4موحد 0.4 | Per-layerلكل طبقة |
|---|---|---|---|
| Layer 0الطبقة 0 | 0.70 | 0.60 | 0.50 |
| Layers 1 to 4الطبقات 1 إلى 4 | 0.49 each0.49 لكل منها | 0.36 each0.36 لكل منها | 0.35, 0.21, 0.24, 0.56 |
| Total keptالإجمالي المتبقي | 53.2% | 40.8% | 37.2% |
| Modelالنموذج | MMACsMMACs | Top-1Top-1 | Latencyزمن الاستجابة | Speedupالتسريع |
|---|---|---|---|---|
| MobileNet 1.0 (full width)MobileNet 1.0 (العرض الكامل) | 569 | 70.6% | 123.3 ms | 1.00x |
| MobileNet 0.75 (uniform shrink)MobileNet 0.75 (تصغير موحد) | 325 | 68.4% | 72.3 ms | 1.7x |
| AMC, 50% FLOPs budgetAMC، ميزانية 50% من FLOPs | 285 | 70.5% | 68.3 ms | 1.81x |
| AMC, 50% latency budgetAMC، ميزانية 50% من زمن الاستجابة | 272 | 70.2% | 63.3 ms | 1.95x |
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: معايير المقدار والقياس
| Criterionالمعيار | Row 0 scoreدرجة الصف 0 | Row 1 scoreدرجة الصف 1 | Row 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على مستوى الصف L1 | 5 | 6 | row 0الصف 0 | [[0, 0], [1, -5]] |
| Row-wise L2على مستوى الصف L2 | sqrt(13) = 3.61 | sqrt(26) = 5.10 | row 0الصف 0 | [[0, 0], [1, -5]] |
| Rowالصف | L1L1 | L2L2 |
|---|---|---|
| [3, 3] | 6 | sqrt(18) = 4.24 |
| [0, 5] | 5 | 5 |
| Row keptالصف المحفوظ | [3, 3] | [0, 5] |
Scaling-based pruning and batch norm gammaالتقليم القائم على معاملات القياس وgamma في batch norm
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: معايير الخسارة والتنشيط والانحدار
| OBD nameالاسم في OBD | Slide 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ⱼ |
| Weightالوزن | wᵢwᵢ | hᵢᵢhᵢᵢ | ½ hᵢᵢ wᵢ²½ hᵢᵢ wᵢ² | Magnitudeالمقدار | OBDOBD |
|---|---|---|---|---|---|
| A | 1.5 | 0.2 | 0.225 | keepيُحفظ | pruneيُقلَّم |
| B | 1.0 | 1.0 | 0.5 | keepيُحفظ | keepيُحفظ |
| C | -0.6 | 4.0 | 0.72 | keepيُحفظ | keepيُحفظ |
| D | 0.5 | 8.0 | 1.0 | pruneيُقلَّم | keepيُحفظ |
| E | 0.2 | 2.0 | 0.04 | pruneيُقلَّم | pruneيُقلَّم |
APoZ and Network TrimmingAPoZ وNetwork Trimming
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تقليم القنوات القائم على الانحدار
| Stepالخطوة | Fixedالثابت | Solvedالمحسوب | Solverطريقة الحل | Outputالمخرج |
|---|---|---|---|---|
| 1 | W | β | LASSO (L1-relaxed selection)LASSO (اختيار مُرخّى بـ L1) | Which input channels surviveأي قنوات الإدخال تبقى |
| 2 | β | W | Least squares (closed form)المربعات الصغرى (حل مغلق) | Weights that best rebuild Zالأوزان التي تعيد بناء Z بأفضل شكل |
- ||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تدريب مع عقوبة L1 | Channelالقناة | |γ| | Liu et al. 2017 |
| OBD | Weights and hᵢᵢالأوزان وhᵢᵢ | One second backward passتمرير خلفي ثانٍ واحد | Weightالوزن | ½ hᵢᵢ wᵢ² | LeCun et al. 1989 |
| APoZ | ReLU 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خطأ إعادة بناء Z | He, Zhang, Sun 2017 |
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».