COE 592Lecture 4.1المحاضرة 4.1Part 04الجزء 04
Fine-grained, N:M and channel pruning in practiceالتقليم الدقيق وN:M وتقليم القنوات عمليًا
Trade-offs of each granularity with real numbers: fine-grained compression ratios, NVIDIA 2:4 pattern sparsity with its compressed format and accuracy table, and channel pruning with non-uniform per-layer sparsity versus uniform shrinking.مقايضات كل مستوى دقة بأرقام حقيقية: نسب الضغط في التقليم الدقيق، وتناثر النمط 2:4 من NVIDIA مع صيغته المضغوطة وجدول دقته، وتقليم القنوات مع تناثر غير منتظم لكل طبقة مقابل التصغير المنتظم.
- Conceptsالمفاهيم
- 5
- Slidesالشرائح
- 19-25
- Readingمدة القراءة
- 30 min30 دقيقة
Why this part mattersلماذا يهمّ هذا الجزء
Your research targets embedded deployment, where the question is never "how many weights can I remove" but "which removal makes this board faster". This part is where the granularity spectrum of part 03 meets real hardware.
It explains why a 9x compressed AlexNet (or a 13x compressed VGG-16) can run no faster on a GPU, why NVIDIA built a 2:4 pattern into its Ampere Tensor Cores, and why the model-compression papers you will cite (AMC, channel pruning) search for per-layer ratios instead of one global number. These are also the three most examinable facts in the lecture: which granularity gives speedup on commodity GPUs and why, what sparsity 2:4 means, and why non-uniform per-layer sparsity beats uniform shrink.
بحثك يستهدف النشر على الأنظمة المدمجة (embedded deployment)، حيث لا يكون السؤال أبدًا «كم وزنًا أستطيع أن أحذف» بل «أي حذف يجعل هذه اللوحة أسرع». هذا الجزء هو المكان الذي يلتقي فيه طيف درجة التقليم (granularity) من الجزء 03 بالعتاد الحقيقي.
يشرح لماذا قد لا يعمل AlexNet المضغوط بمقدار 9x (أو VGG-16 المضغوط بمقدار 13x) أسرع على GPU، ولماذا بنت NVIDIA نمط 2:4 داخل Tensor Cores في معمارية Ampere، ولماذا تبحث أوراق ضغط النماذج التي ستستشهد بها (AMC وتقليم القنوات channel pruning) عن نسب خاصة بكل طبقة بدلًا من رقم عام واحد. وهذه أيضًا أكثر ثلاث حقائق يُتوقع السؤال عنها في الامتحان من هذه المحاضرة: أي درجة تقليم تعطي تسريعًا على وحدات GPU التجارية الشائعة ولماذا، وما معنى تناثر 2:4، ولماذا يتفوق التناثر غير الموحّد لكل طبقة على التصغير الموحّد (uniform shrink).
By the end you canفي نهاية هذا الجزء ستستطيع
- Explain why fine-grained pruning gives the largest compression ratio but little or no speedup on GPUs with standard kernels, and name the hardware that can exploit it.تشرح لماذا يعطي التقليم الدقيق (fine-grained pruning) أكبر نسبة ضغط لكنه لا يعطي تسريعًا يُذكر، أو لا يعطي أي تسريع، على وحدات GPU التي تستخدم نوى (kernels) قياسية، وتسمّي العتاد الذي يستطيع الاستفادة منه.
- Define N:M sparsity under the NVIDIA convention, compute its sparsity for any N and M, and explain why the slide's wording is ambiguous.تعرّف تناثر N:M (N:M sparsity) وفق اصطلاح NVIDIA، وتحسب نسبة تناثره لأي قيمتين N وM، وتشرح لماذا صياغة الشريحة غامضة.
- Derive the 2:4 compressed layout and compute its memory saving for FP16 and INT8 values.تستنتج التخطيط المضغوط لنمط 2:4 وتحسب ما يوفّره من الذاكرة لقيم FP16 ولقيم INT8.
- State the pro and con of channel pruning and show how pruning one layer's channels shrinks two layers.تذكر ميزة تقليم القنوات (channel pruning) وعيبه، وتبيّن كيف يؤدي تقليم قنوات طبقة واحدة إلى تصغير طبقتين.
- Argue with AMC's measured Pixel 1 numbers why per-layer sparsity ratios beat uniform shrink at equal latency.تستدل بأرقام AMC المقاسة على هاتف Pixel 1 على أن نسب التناثر الخاصة بكل طبقة تتفوق على التصغير الموحّد (uniform shrink) عند زمن استجابة (latency) متساوٍ.
Go back to the very first picture of this lecture: a network before and after pruning, with individual synapses cut out while every neuron stays. That picture is fine-grained pruning, the synapse pruning of slide 4 seen through the lens of granularity. Slides 19 and 20 bring it back only to attach numbers to it, so treat them as a short callback rather than new material.
عُد إلى أول صورة في هذه المحاضرة: شبكة قبل التقليم وبعده، حيث قُطعت مشابك (synapses) منفردة وبقيت كل الخلايا العصبية. تلك الصورة هي fine-grained pruning (التقليم الدقيق)، أي synapse pruning في الشريحة 4 منظورًا إليه من زاوية granularity (درجة التقليم). الشريحتان 19 و20 تعيدانه فقط لتربطا به أرقامًا، فتعامل معهما على أنهما تذكير قصير لا مادة جديدة.
The numbers are the ones from part 02. Han et al. pruned AlexNet from 61 M to 6.7 M parameters and VGG-16 from 138 M to 10.3 M without losing accuracy, a pruning ratio of roughly 89% and 93% (Han, Pool, Tran and Dally, NIPS 2015). Those results are only possible because the method may zero any single weight, wherever it sits in the tensor. The slide calls this "flexible pruning indices": the set of surviving positions is unconstrained, so the algorithm can find redundant weights anywhere and usually reaches the largest compression ratio of all granularities.
الأرقام هي نفسها من الجزء 02. قلّم Han et al. شبكة AlexNet من 61 M إلى 6.7 M معامل، وشبكة VGG-16 من 138 M إلى 10.3 M، دون خسارة في الدقة، أي pruning ratio (نسبة تقليم) تقارب 89% و93% (Han, Pool, Tran and Dally, NIPS 2015). هذه النتائج ممكنة فقط لأن الطريقة يجوز لها تصفير أي وزن منفرد أينما كان موقعه في الموتّر (tensor). تسمي الشريحة ذلك «flexible pruning indices» (فهارس تقليم مرنة): مجموعة المواقع الباقية غير مقيّدة، فتستطيع الخوارزمية أن تجد الأوزان الزائدة في أي مكان، وعادةً تصل إلى أكبر نسبة ضغط بين كل درجات التقليم.
| Networkالشبكة | Parameters beforeالمعاملات قبل | Parameters afterالمعاملات بعد | Reductionالتخفيض |
|---|---|---|---|
| AlexNetAlexNet | 61 M61 M | 6.7 M6.7 M | 9x9x |
| VGG-16VGG-16 | 138 M138 M | 10.3 M10.3 M | 12x (paper: 13x)12x (في الورقة: 13x) |
| GoogleNetGoogleNet | 7 M7 M | 2.0 M2.0 M | 3.5x3.5x |
| ResNet-50ResNet-50 | 26 M26 M | 7.47 M7.47 M | 3.4x3.4x |
Why flexibility is expensive at run timeلماذا تكون المرونة مكلفة وقت التشغيل
Now look at what the flexibility leaves behind. After fine-grained pruning the weight tensor still has its original shape; it is simply riddled with zeros at irregular positions. A dense matrix multiply on a GPU does not know the zeros are there and multiplies them anyway, so the work is unchanged. To skip them you must store the weights in a sparse format such as CSR, CSC or COO, where every surviving value carries an index saying where it belongs. Mishra et al. note that these formats make memory accesses data dependent and that the index metadata can cost up to 200% of the weight storage when the weights are 8-bit (Mishra et al., 2021). Zhou et al. summarize the situation in one line: fine-grained sparsity "can achieve a high compression ratio but is not hardware friendly and hence receives limited speed gains" (Zhou et al., ICLR 2021).
انظر الآن إلى ما تتركه المرونة خلفها. بعد التقليم الدقيق يبقى موتّر الأوزان بشكله الأصلي؛ هو فقط مليء بالأصفار في مواقع غير منتظمة. ضرب المصفوفات الكثيف (dense matrix multiply) على GPU لا يعرف أن الأصفار موجودة فيضربها على أي حال، فيبقى العمل كما هو. لكي تتخطاها يجب أن تخزّن الأوزان في sparse format (صيغة متناثرة) مثل CSR أو CSC أو COO، حيث تحمل كل قيمة باقية فهرسًا يحدد مكانها. يشير Mishra et al. إلى أن هذه الصيغ تجعل الوصول إلى الذاكرة معتمدًا على البيانات، وأن البيانات الوصفية للفهارس قد تكلّف حتى 200% من مساحة تخزين الأوزان عندما تكون الأوزان بدقة 8 بت (Mishra et al., 2021). ويلخص Zhou et al. الوضع في سطر واحد: التناثر الدقيق «يمكن أن يحقق نسبة ضغط عالية لكنه غير ملائم للعتاد، ولذلك لا يحصل إلا على مكاسب محدودة في السرعة» (Zhou et al., ICLR 2021).
That is why the red line on slide 20 matters more than the table. Speedup from fine-grained sparsity needs hardware built around indices. Han's own EIE accelerator is the example the MIT source deck names: by reading compressed weights and skipping zero activations, it ran fully-connected layers 189x faster than a CPU and 13x faster than a GPU running the uncompressed network (Han et al., ISCA 2016). With sparse kernels the picture depends on batch size: in EIE's own measurements cuSPARSE ran pruned FC layers 4x to 9x faster than dense at batch 1 on a Titan X, but slower at batch 64, which is why the slide says "not GPU (easily)". On an ordinary GPU with dense kernels, the same pruned network runs at roughly dense speed.
لهذا السبب يهم الخط الأحمر في الشريحة 20 أكثر من الجدول. التسريع من sparsity (التناثر) الدقيق يحتاج إلى عتاد مبني حول الفهارس. مسرّع EIE الذي صممه Han نفسه هو المثال الذي تذكره عروض MIT الأصلية: بقراءة الأوزان المضغوطة وتخطي التفعيلات (activations) الصفرية، شغّل الطبقات المتصلة بالكامل (fully-connected) أسرع بمقدار 189x من CPU وأسرع بمقدار 13x من GPU يشغّل الشبكة غير المضغوطة (Han et al., ISCA 2016). مع النوى المتناثرة (sparse kernels) تعتمد الصورة على حجم الدفعة (batch size): في قياسات EIE نفسها شغّلت مكتبة cuSPARSE طبقات FC المقلّمة أسرع من الكثيفة بمقدار 4x إلى 9x عند دفعة حجمها 1 على Titan X، لكنها كانت أبطأ عند دفعة حجمها 64، ولهذا تقول الشريحة «not GPU (easily)» (ليس على GPU بسهولة). على GPU عادي بنوى كثيفة، تعمل الشبكة المقلّمة نفسها بسرعة قريبة من سرعة الشبكة الكثيفة.
EIE on compressed fully-connected layers (Han et al., ISCA 2016)EIE على الطبقات المتصلة بالكامل المضغوطة (Han et al., ISCA 2016)
- Speedup over CPUالتسريع مقارنةً بـ CPU
- 189x189x
- Speedup over GPUالتسريع مقارنةً بـ GPU
- 13x13x
- Energy efficiency over GPUكفاءة الطاقة مقارنةً بـ GPU
- 3400x3400x
Recall
Why does fine-grained pruning usually reach a larger compression ratio than channel pruning, and why does that not translate into GPU speedup?لماذا يصل التقليم الدقيق عادةً إلى نسبة ضغط أكبر من تقليم القنوات، ولماذا لا يتحول ذلك إلى تسريع على GPU؟
Quick checkاختبار سريع
A layer is pruned to 90 percent unstructured sparsity and run on a plain GPU with dense kernels. What happens to latency?قُلّمت طبقة إلى تناثر غير منظّم بنسبة 90 بالمئة وشُغّلت على GPU عادي بنوى كثيفة. ماذا يحدث لزمن الاستجابة؟
Take one row of eight FP16 weights and split it into two groups of four. In each group keep the two largest magnitudes and zero the other two. Every group now has exactly two zeros and two nonzeros, so the row is 50% sparse, and so is every other row treated the same way. That is 2:4 sparsity, the classic case of N:M sparsity and the reason the lecture lists pattern-based pruning as its own step on the granularity spectrum.
خذ صفًا واحدًا من ثمانية أوزان بصيغة FP16 وقسّمه إلى مجموعتين من أربعة. في كل مجموعة احتفظ بأكبر قيمتين من حيث المقدار (magnitude) وصفّر القيمتين الأخريين. أصبحت كل مجموعة تحتوي بالضبط على صفرين وقيمتين غير صفريتين، فيكون الصف متناثرًا بنسبة 50%، وكذلك كل صف آخر يُعامل بالطريقة نفسها. هذا هو 2:4 sparsity، الحالة الكلاسيكية من N:M sparsity، وهو سبب أن المحاضرة تضع pattern-based pruning (التقليم القائم على نمط) خطوةً مستقلة على طيف درجات التقليم.
The general rule needs one careful sentence, because the slide's sentence is ambiguous. In NVIDIA's definition, which is the one hardware implements, an N:M pattern allows at most N nonzero values in every contiguous group of M. The Ampere whitepaper describes 2:4 as a matrix "that allows two non-zero values in every four-entry vector", and Mishra et al. write of "the 2 nonzero values in each group of 4" (NVIDIA, 2020; Mishra et al., 2021). Slide 21 instead says that "N of them is pruned". For 2:4 the two readings agree, since two kept and two pruned are the same thing. For any other pattern they do not.
القاعدة العامة تحتاج إلى جملة دقيقة، لأن جملة الشريحة غامضة. في تعريف NVIDIA، وهو التعريف الذي ينفّذه العتاد، يسمح نمط N:M بـ N قيم غير صفرية على الأكثر في كل مجموعة متجاورة من M. تصف الورقة البيضاء لمعمارية Ampere نمط 2:4 بأنه مصفوفة «تسمح بقيمتين غير صفريتين في كل متجه من أربعة عناصر»، ويكتب Mishra et al. عن «القيمتين غير الصفريتين في كل مجموعة من 4» (NVIDIA, 2020; Mishra et al., 2021). أما الشريحة 21 فتقول إن «N of them is pruned» (يُقلَّم N منها). في نمط 2:4 تتفق القراءتان، لأن الاحتفاظ باثنتين وتقليم اثنتين شيء واحد. أما في أي نمط آخر فلا تتفقان.
Why a pattern is the middle of the spectrumلماذا يقع النمط في منتصف الطيف
Inside each group of four the pattern is still fine-grained: any two of the four positions may survive, six possible masks, chosen by magnitude. Across the matrix it is rigidly structured: every group holds exactly two values, no more and no fewer. Mishra et al. point out what this buys: because the sparsity is constant across the matrix, "there is no indirection required; a nonzero value's position in memory can be determined from the compression rate directly" (Mishra et al., 2021). The hardware always knows that group g starts at value slot 2g. That is the difference between a lookup and an address calculation, and it is what makes fine-grained-in-the-small, structured-in-the-large worth a place of its own.
داخل كل مجموعة من أربعة يبقى النمط دقيقًا: أي اثنين من المواقع الأربعة يمكن أن يبقيا، أي ستة أقنعة (masks) ممكنة، يُختار منها حسب المقدار. وعلى مستوى المصفوفة كلها هو منظّم بصرامة: كل مجموعة تحمل قيمتين بالضبط، لا أكثر ولا أقل. يوضح Mishra et al. ما يكسبه ذلك: لأن التناثر ثابت عبر المصفوفة، «لا حاجة إلى أي إحالة غير مباشرة (indirection)؛ يمكن تحديد موقع القيمة غير الصفرية في الذاكرة من معدل الضغط مباشرةً» (Mishra et al., 2021). العتاد يعرف دائمًا أن المجموعة g تبدأ عند خانة القيمة 2g. هذا هو الفرق بين البحث في جدول (lookup) وحساب عنوان، وهو ما يجعل النمط «الدقيق على المستوى الصغير، المنظّم على المستوى الكبير» جديرًا بمكان مستقل.
The compressed formatالصيغة المضغوطة
The rule also fixes the storage layout, which is the right-hand panel of slide 21. An R by C dense matrix becomes an R by C/2 block of nonzero values plus an R by C/2 block of 2-bit indices, where each index records the position, 0 to 3, of a kept value inside its group of four. Two bits are enough because a group has only four positions. One corner case keeps the format regular: if a group happens to have three or four zeros after training, two values are stored anyway, padded with zeros as needed (Mishra et al., 2021).
القاعدة تحدد أيضًا تخطيط التخزين، وهو اللوحة اليمنى في الشريحة 21. المصفوفة الكثيفة بحجم R by C تصبح كتلة بحجم R by C/2 من القيم غير الصفرية، مع كتلة بحجم R by C/2 من 2-bit indices (فهارس من بتّين)، حيث يسجّل كل فهرس موقع القيمة المحتفظ بها داخل مجموعتها الرباعية، من 0 إلى 3. البتّان كافيان لأن المجموعة فيها أربعة مواقع فقط. وهناك حالة طرفية واحدة تحفظ انتظام الصيغة: إذا صادف أن مجموعة فيها ثلاثة أصفار أو أربعة بعد التدريب، تُخزَّن قيمتان على أي حال، مع حشوها بأصفار عند الحاجة (Mishra et al., 2021).
Worked exampleمثال محلول
Compressing an 8 by 8 FP16 matrixضغط مصفوفة 8 في 8 بصيغة FP16
Dense storageالتخزين الكثيف
64 values at 16 bits each: 64 x 16 = 1024 bits.64 قيمة، كل منها 16 bits: 64 x 16 = 1024 bits.Kept valuesالقيم المحتفظ بها
Half survive, 32 values: 32 x 16 = 512 bits.يبقى النصف، أي 32 قيمة: 32 x 16 = 512 bits.Indicesالفهارس
One 2-bit position per kept value: 32 x 2 = 64 bits.موقع من بتّين لكل قيمة محتفظ بها: 32 x 2 = 64 bits.Compressed totalالمجموع بعد الضغط
512 + 64 = 576 bits.512 + 64 = 576 bits.Resultالنتيجة
1024 / 576 = 1.78x smaller, 43.75% saved. Per group of four the arithmetic is 64 bits versus 36 bits, which is exact for a matrix of any size.أصغر بمقدار 1024 / 576 = 1.78x، أي توفير 43.75%. لكل مجموعة من أربعة يكون الحساب 64 bits مقابل 36 bits، وهذا دقيق لمصفوفة بأي حجم.
2:4 storage for FP16 weights, 8 by 8 matrixتخزين 2:4 لأوزان FP16، مصفوفة 8 في 8
- Dense FP16FP16 كثيف
- 1024 bits1024 بت
- Kept valuesالقيم المحتفظ بها
- 512 bits512 بت
- 2-bit indicesفهارس من بتّين
- 64 bits64 بت
- Compressed totalالإجمالي بعد الضغط
- 576 bits576 بت
- Ratioالنسبة
- 1.78x1.78x
- Index overhead on the kept valuesكلفة الفهارس نسبةً إلى القيم المحتفظ بها
- 12.5%12.5%
The same matrix with INT8 weightsالمصفوفة نفسها بأوزان INT8
- Dense INT8INT8 كثيف
- 512 bits512 بت
- Kept valuesالقيم المحتفظ بها
- 256 bits256 بت
- 2-bit indicesفهارس من بتّين
- 64 bits64 بت
- Compressed totalالإجمالي بعد الضغط
- 320 bits320 بت
- Ratioالنسبة
- 1.6x1.6x
- Index overhead on the kept valuesكلفة الفهارس نسبةً إلى القيم المحتفظ بها
- 25%25%
The two tables carry an insight that matters when you combine pruning with the quantization lectures: the index costs two bits whatever the value width, so the narrower the value type the more the index costs relatively. Mishra et al. give the same figures, about 44% saved for 16-bit and about 38% for 8-bit weights, which is why NVIDIA says the format cuts storage and bandwidth by "almost" 2x rather than exactly 2x (Mishra et al., 2021; NVIDIA, 2020).
يحمل الجدولان فكرة مهمة عندما تجمع التقليم مع محاضرات التكميم (quantization): الفهرس يكلّف بتّين مهما كان عرض القيمة، فكلما ضاق نوع القيمة زادت كلفة الفهرس نسبيًا. يعطي Mishra et al. الأرقام نفسها، توفير نحو 44% للأوزان بدقة 16 بت ونحو 38% للأوزان بدقة 8 بت، ولهذا تقول NVIDIA إن الصيغة تخفض التخزين وعرض النطاق (bandwidth) «تقريبًا» بمقدار 2x وليس 2x بالضبط (Mishra et al., 2021; NVIDIA, 2020).
Where the 2x speedup comes fromمن أين يأتي تسريع 2x
Storage is only half of the payoff. The Ampere A100 added Sparse Tensor Core instructions that take a 2:4 compressed operand and, in the whitepaper's words, "skip the compute on entries that have zero values, resulting in a doubling of the Tensor Core compute throughput": a 16 x 8 x 16 matrix multiply instruction completes in half the cycles of its dense counterpart (NVIDIA, 2020). Software reaches it through TensorRT 8 and cuSPARSELt; the slide's link covers the TensorRT 8.0 path. Zhou et al. restate the same about 2x for the A100, citing NVIDIA rather than measuring it themselves (Zhou et al., ICLR 2021).
التخزين نصف المكسب فقط. أضافت Ampere A100 تعليمات Sparse Tensor Core التي تأخذ مُعامَلًا (operand) مضغوطًا بنمط 2:4، وبتعبير الورقة البيضاء «تتخطى الحساب على المدخلات ذات القيم الصفرية، مما يؤدي إلى مضاعفة إنتاجية الحساب في Tensor Core»: تعليمة ضرب مصفوفات بحجم 16 x 8 x 16 تكتمل في نصف عدد الدورات التي تحتاجها نظيرتها الكثيفة (NVIDIA, 2020). تصل البرمجيات إليها عبر TensorRT 8 وcuSPARSELt؛ ورابط الشريحة يغطي مسار TensorRT 8.0. ويعيد Zhou et al. ذكر الرقم نفسه، نحو 2x على A100، نقلًا عن NVIDIA لا بقياس خاص بهم (Zhou et al., ICLR 2021).
Try the pattern yourself below. Switch the convention from "N nonzero" to "N pruned" at 2:4 and nothing changes; switch it at 1:4 and the sparsity flips from 75% to 25%, which is exactly the ambiguity flagged above. Then toggle FP16 to INT8 and watch the index overhead double.
جرّب النمط بنفسك في الأسفل. غيّر الاصطلاح من «N nonzero» إلى «N pruned» عند 2:4 ولن يتغير شيء؛ غيّره عند 1:4 وسينقلب التناثر من 75% إلى 25%، وهذا بالضبط الغموض المشار إليه أعلاه. ثم بدّل من FP16 إلى INT8 وراقب كلفة الفهرس الإضافية وهي تتضاعف.
Recall
Define 2:4 sparsity, give its sparsity percentage, and state the storage layout.عرّف تناثر 2:4، واذكر نسبة تناثره، وصِف تخطيط تخزينه.
Recall
Under the NVIDIA convention, what is the sparsity of 1:4 and of 4:8?وفق اصطلاح NVIDIA، ما نسبة تناثر 1:4، وما نسبة تناثر 4:8؟
Quick checkاختبار سريع
A weight matrix satisfies the 2:4 pattern. What fraction of its weights is zero?مصفوفة أوزان تحقق نمط 2:4. ما نسبة أوزانها التي تساوي صفرًا؟
Quick checkاختبار سريع
Using NVIDIA's convention, how many weights in every group of four are zero under a 1:4 pattern?وفق اصطلاح NVIDIA، كم وزنًا في كل مجموعة من أربعة يساوي صفرًا في نمط 1:4؟
A format that halves storage and doubles matmul throughput is worth nothing if the network gets worse. So look at one row first: ResNet-50 on ImageNet scores 76.1% top-1 dense in FP16 and 76.2% after 2:4 pruning. Half the weights are gone and the accuracy is unchanged; the extra 0.1 is run-to-run noise, not a gain.
صيغة تخفض التخزين إلى النصف وتضاعف إنتاجية ضرب المصفوفات لا قيمة لها إذا ساءت الشبكة. لذلك انظر إلى صف واحد أولًا: ResNet-50 على ImageNet يحقق 76.1% في top-1 وهو كثيف بصيغة FP16، و76.2% بعد تقليم 2:4. ذهب نصف الأوزان وبقيت الدقة كما هي؛ والزيادة 0.1 مجرد ضجيج بين تشغيل وآخر، لا مكسب حقيقي.
The rule that produced that row is NVIDIA's three-step recipe. Train the dense network as usual. Prune it to 2:4 by keeping the two largest magnitudes in every group of four, which fixes the mask. Then retrain with the mask held fixed, using the original schedule and hyperparameters, so the survivors absorb the job of the pruned weights. That last step is the fine-tuning loop of part 02 applied under a structural constraint, and the whitepaper reports "virtually no loss in inferencing accuracy" across dozens of networks with it (NVIDIA, 2020). The choice of mask by magnitude inside each group previews the magnitude criterion of part 05.
القاعدة التي أنتجت ذلك الصف هي وصفة NVIDIA ذات الخطوات الثلاث. درّب الشبكة الكثيفة كالمعتاد. ثم قلّمها إلى 2:4 بالاحتفاظ بأكبر قيمتين من حيث المقدار في كل مجموعة من أربعة، وهذا يثبّت mask (القناع). ثم أعد التدريب مع إبقاء القناع ثابتًا، باستخدام الجدول الزمني والمعاملات الفائقة (hyperparameters) الأصلية، لكي تتولى الأوزان الباقية مهمة الأوزان المقلّمة. هذه الخطوة الأخيرة هي حلقة fine-tuning (الضبط الدقيق) من الجزء 02 مطبّقةً تحت قيد بنيوي، وتذكر الورقة البيضاء «عدم وجود خسارة تُذكر تقريبًا في دقة الاستدلال» عبر عشرات الشبكات باستخدامها (NVIDIA, 2020). واختيار القناع حسب المقدار داخل كل مجموعة يمهّد لمعيار المقدار (magnitude criterion) في الجزء 05.
| Networkالشبكة | Data setمجموعة البيانات | Metricالمقياس | Dense FP16FP16 كثيف | Sparse FP16FP16 متناثر | Changeالتغيّر |
|---|---|---|---|---|---|
| ResNet-50ResNet-50 | ImageNetImageNet | Top-1Top-1 | 76.176.1 | 76.276.2 | +0.1+0.1 |
| ResNeXt-101_32x8dResNeXt-101_32x8d | ImageNetImageNet | Top-1Top-1 | 79.379.3 | 79.379.3 | 0.00.0 |
| XceptionXception | ImageNetImageNet | Top-1Top-1 | 79.279.2 | 79.279.2 | 0.00.0 |
| SSD-RN50SSD-RN50 | COCO 2017COCO 2017 | bbAPbbAP | 24.824.8 | 24.824.8 | 0.00.0 |
| MaskRCNN-RN50MaskRCNN-RN50 | COCO 2017COCO 2017 | bbAPbbAP | 37.937.9 | 37.937.9 | 0.00.0 |
| FairSeq TransformerFairSeq Transformer | EN-DE WMT'14EN-DE WMT'14 | BLEUBLEU | 28.228.2 | 28.528.5 | +0.3+0.3 |
| BERT-LargeBERT-Large | SQuAD v1.1SQuAD v1.1 | F1F1 | 91.991.9 | 91.991.9 | 0.00.0 |
Read the table across, never down. The seven rows use four different metrics (top-1 accuracy, box AP, BLEU and F1), so the only meaningful comparison is dense versus sparse within one row. Read that way the evidence is unusually broad: image classification, object detection, instance segmentation, translation and question answering, spanning convolutional networks and Transformers, and not one row lost measurable accuracy. The whitepaper's explanation is that after training "only a subset of weights have acquired a meaningful purpose", and the retraining step lets the network re-adapt around the fixed mask (NVIDIA, 2020).
اقرأ الجدول أفقيًا، ولا تقرأه عموديًا أبدًا. الصفوف السبعة تستخدم أربعة مقاييس مختلفة (دقة top-1، وbox AP، وBLEU، وF1)، فالمقارنة الوحيدة ذات المعنى هي الكثيف مقابل المتناثر داخل الصف الواحد. وبهذه القراءة تكون الأدلة واسعة على نحو غير معتاد: تصنيف الصور، واكتشاف الأجسام، وتجزئة المثيلات (instance segmentation)، والترجمة، والإجابة عن الأسئلة، وتشمل الشبكات الالتفافية وTransformers، ولم يخسر صف واحد دقة قابلة للقياس. وتفسير الورقة البيضاء هو أنه بعد التدريب «لا تكتسب إلا مجموعة جزئية من الأوزان غرضًا ذا معنى»، وخطوة إعادة التدريب تسمح للشبكة بأن تتكيف من جديد حول القناع الثابت (NVIDIA, 2020).
Recall
Name the three steps of NVIDIA's 2:4 recipe and give one row of evidence that it holds accuracy.سمِّ الخطوات الثلاث في وصفة 2:4 من NVIDIA، وأعطِ صفًا واحدًا من الأدلة على أنها تحافظ على الدقة.
Now the coarse end of the spectrum. A convolution layer with 64 output channels is pruned at sparsity 0.5: thirty-two whole filters are deleted and the layer becomes a 32-channel layer. Nothing about the result is sparse. Its weight tensor, in the [c_o, c_i, k_h, k_w] layout of part 03, is simply smaller in the c_o dimension, and the next layer, which consumed those channels, is smaller in its c_i dimension.
الآن الطرف الخشن من الطيف. طبقة التفاف (convolution) لها 64 قناة خرج تُقلَّم بنسبة تناثر 0.5: تُحذف اثنان وثلاثون مرشّحًا (filter) كاملًا وتصبح الطبقة بـ 32 قناة. لا شيء في النتيجة متناثر. موتّر أوزانها، بالتخطيط [c_o, c_i, k_h, k_w] من الجزء 03، صار ببساطة أصغر في البعد c_o، والطبقة التالية التي كانت تستهلك تلك القنوات صارت أصغر في بعدها c_i.
That is the whole argument for channel pruning, and both sides of the slide's trade-off follow from it. Pro: direct speedup on any hardware, because a network with fewer channels does less work in every dense library that exists. Li et al. put it precisely: removing whole filters "does not result in sparse connectivity patterns", so it "does not need the support of sparse convolution libraries and can work with existing efficient BLAS libraries" (Li et al., ICLR 2017). He, Zhang and Sun report a 5x speedup on VGG-16 for a 0.3% increase in error and 2x on ResNet for 1.4% (He, Zhang and Sun, ICCV 2017). Con: a smaller compression ratio, because a channel is a much coarser unit than a weight. Keeping a channel means keeping all of its weights, including the weak ones that fine-grained pruning would have dropped, so you cannot reach the 9x to 13x of slide 20.
هذه هي الحجة الكاملة لصالح channel pruning (تقليم القنوات)، ومنها ينتج طرفا المقايضة في الشريحة. الميزة: تسريع مباشر على أي عتاد، لأن الشبكة ذات القنوات الأقل تؤدي عملًا أقل في كل مكتبة كثيفة موجودة. يعبّر Li et al. عن ذلك بدقة: إزالة مرشّحات كاملة (removing whole filters) «لا تؤدي إلى أنماط اتصال متناثرة»، ولذلك «لا تحتاج إلى دعم مكتبات الالتفاف المتناثر ويمكنها العمل مع مكتبات BLAS الفعالة الموجودة» (Li et al., ICLR 2017). ويذكر He, Zhang and Sun تسريعًا بمقدار 5x على VGG-16 مقابل زيادة في الخطأ قدرها 0.3%، و2x على ResNet مقابل 1.4% (He, Zhang and Sun, ICCV 2017). العيب: نسبة ضغط أصغر، لأن القناة وحدة أخشن بكثير من الوزن. الاحتفاظ بقناة يعني الاحتفاظ بكل أوزانها، بما فيها الأوزان الضعيفة التي كان التقليم الدقيق سيُسقطها، لذلك لا تستطيع الوصول إلى 9x حتى 13x كما في الشريحة 20.
Pruning one layer shrinks twoتقليم طبقة واحدة يصغّر طبقتين
The example above hid a compounding effect that the slide's bar chart depends on. Pruning the output channels of layer l removes rows from its own weight tensor and columns from layer l+1, because the input channels of l+1 are the output channels of l. The per-layer sparsity values on slide 24 therefore do not add up the way they look; they multiply through the chain.
أخفى المثال السابق أثرًا تراكميًا يعتمد عليه المخطط الشريطي في الشريحة. تقليم قنوات الخرج في الطبقة l يزيل صفوفًا من موتّر أوزانها هي وأعمدةً من الطبقة l+1، لأن قنوات الدخل في l+1 هي قنوات الخرج من l. لذلك فإن قيم sparsity (التناثر) لكل طبقة في الشريحة 24 لا تُجمع كما تبدو؛ بل تتضاعف بعضها في بعض عبر السلسلة.
Worked exampleمثال محلول
Five conv layers, uniform 0.3 versus the slide's per-layer sparsitiesخمس طبقات التفاف: تناثر موحّد 0.3 مقابل نسب التناثر الخاصة بكل طبقة في الشريحة
Set the baselineحدّد خط الأساس
Five stacked 3 x 3 layers, each 64 in and 64 out: 64 x 64 x 9 = 36,864 weights each, 184,320 in total. Layer 0's inputs come from the stem, which is not pruned, so its input columns are never removed.خمس طبقات 3 x 3 متراصّة، لكل منها 64 قناة دخل و64 قناة خرج: 64 x 64 x 9 = 36,864 وزنًا لكل طبقة، و184,320 في المجموع. مدخلات الطبقة 0 تأتي من الجذع (stem) غير المقلّم، فلا تُزال أعمدة دخلها أبدًا.Write the kept fraction of one layerاكتب النسبة المحتفظ بها لطبقة واحدة
Layer l keeps (1 - s_(l-1)) x (1 - s_l) of its weights: its input columns follow the previous layer's output sparsity, its output rows follow its own.الطبقة l تحتفظ بـ (1 - s_(l-1)) x (1 - s_l) من أوزانها: أعمدة دخلها تتبع تناثر خرج الطبقة السابقة، وصفوف خرجها تتبع تناثرها هي.Uniform shrink, s = 0.3 everywhereتصغير موحّد، s = 0.3 في كل مكان
Layer 0 keeps 0.70, every later layer keeps 0.7 x 0.7 = 0.49.الطبقة 0 تحتفظ بـ 0.70، وكل طبقة بعدها تحتفظ بـ 0.7 x 0.7 = 0.49.Per-layer sparsities 0.5, 0.3, 0.7, 0.2, 0.3نسب تناثر لكل طبقة: 0.5، 0.3، 0.7، 0.2، 0.3
Layer 0 keeps 0.50, then 0.35, 0.21, 0.24, 0.56.الطبقة 0 تحتفظ بـ 0.50، ثم 0.35، و0.21، و0.24، و0.56.Resultالنتيجة
Uniform shrink at 0.3 keeps 53.2% of the weights, uniform shrink at the per-layer set's mean of 0.4 keeps 40.8%, and the slide's per-layer set keeps 37.2%. Conv MACs scale with c_i x c_o, so the same fractions apply to compute.Uniform shrink (التصغير الموحّد) عند 0.3 يحتفظ بـ 53.2% من الأوزان، والتصغير الموحّد عند متوسط المجموعة الخاصة بكل طبقة وهو 0.4 يحتفظ بـ 40.8%، والمجموعة الخاصة بكل طبقة في الشريحة تحتفظ بـ 37.2%. عدد MACs في الالتفاف يتناسب مع c_i x c_o، فتنطبق النسب نفسها على الحساب.
| Layerالطبقة | Uniform 0.3 keptالمحتفظ به عند 0.3 موحّدة | Uniform 0.4 keptالمحتفظ به عند 0.4 موحّدة | Per-layer keptالمحتفظ به بنسب لكل طبقة |
|---|---|---|---|
| Layer 0الطبقة 0 | 1.0 x 0.7 = 0.701.0 x 0.7 = 0.70 | 1.0 x 0.6 = 0.601.0 x 0.6 = 0.60 | 1.0 x 0.5 = 0.501.0 x 0.5 = 0.50 |
| Layer 1الطبقة 1 | 0.7 x 0.7 = 0.490.7 x 0.7 = 0.49 | 0.6 x 0.6 = 0.360.6 x 0.6 = 0.36 | 0.5 x 0.7 = 0.350.5 x 0.7 = 0.35 |
| Layer 2الطبقة 2 | 0.7 x 0.7 = 0.490.7 x 0.7 = 0.49 | 0.6 x 0.6 = 0.360.6 x 0.6 = 0.36 | 0.7 x 0.3 = 0.210.7 x 0.3 = 0.21 |
| Layer 3الطبقة 3 | 0.7 x 0.7 = 0.490.7 x 0.7 = 0.49 | 0.6 x 0.6 = 0.360.6 x 0.6 = 0.36 | 0.3 x 0.8 = 0.240.3 x 0.8 = 0.24 |
| Layer 4الطبقة 4 | 0.7 x 0.7 = 0.490.7 x 0.7 = 0.49 | 0.6 x 0.6 = 0.360.6 x 0.6 = 0.36 | 0.8 x 0.7 = 0.560.8 x 0.7 = 0.56 |
| Total keptإجمالي المحتفظ به | 2.66 / 5 = 53.2%2.66 / 5 = 53.2% | 2.04 / 5 = 40.8%2.04 / 5 = 40.8% | 1.86 / 5 = 37.2%1.86 / 5 = 37.2% |
Uniform shrink versus channel pruneالتصغير الموحّد مقابل تقليم القنوات
The inequality on slide 24, "Uniform Shrink < Channel Prune", compares accuracy at a comparable budget. Uniform shrink applies one ratio to every layer, which is what a MobileNet width multiplier does. It ignores the fact that layers differ in how much redundancy they carry: some tolerate 70% removal and others only 20%. Channel pruning proper starts from the trained wide network, chooses a ratio per layer, deletes the least useful channels in each, and fine-tunes. Under the same latency or MAC budget, spending the cuts where they hurt least keeps more accuracy. Slide 24 defers the obvious question, how to find those ratios; the sensitivity analysis of lecture 04-2 (Pruning ratios, fine-tuning and sparse hardware) and the AMC search of the next concept are the answers.
المتباينة في الشريحة 24، «Uniform Shrink < Channel Prune»، تقارن الدقة عند ميزانية متقاربة. التصغير الموحّد يطبّق نسبة واحدة على كل طبقة، وهذا ما يفعله مُضاعِف العرض (width multiplier) في MobileNet. وهو يتجاهل أن الطبقات تختلف في مقدار الزيادة التي تحملها: بعضها يتحمل إزالة 70% وبعضها 20% فقط. أما تقليم القنوات بمعناه الصحيح فيبدأ من الشبكة العريضة المدرّبة، ويختار نسبة لكل طبقة، ويحذف أقل القنوات فائدة في كل منها، ثم يضبطها ضبطًا دقيقًا. تحت ميزانية زمن استجابة أو MACs نفسها، يحافظ توزيع القطع حيث يضر أقل على دقة أكبر. تؤجل الشريحة 24 السؤال البديهي، وهو كيف نجد تلك النسب؛ والجواب هو تحليل الحساسية في المحاضرة 04-2 (Pruning ratios, fine-tuning and sparse hardware) وبحث AMC في المفهوم التالي.
Recall
State the pro and con of channel pruning in one sentence each.اذكر ميزة تقليم القنوات وعيبه، في جملة واحدة لكل منهما.
Quick checkاختبار سريع
Which granularity speeds up inference on any GPU that has only dense BLAS libraries?أي درجة تقليم تسرّع الاستدلال على أي GPU لا يملك إلا مكتبات BLAS كثيفة؟
On a Google Pixel 1, the full-width MobileNet takes 123.3 ms per image and scores 70.6% ImageNet top-1. Shrinking it uniformly with the 0.75 width multiplier brings the latency down to 72.3 ms but the accuracy down to 68.4%. The channel-pruned model found by AMC runs in 68.3 ms at 70.5%: as fast as the shrunken model, 2.1 points more accurate, and only 0.1 below the full model at 1.81x its speed (He et al., ECCV 2018).
على هاتف Google Pixel 1، يستغرق MobileNet بكامل عرضه 123.3 ms لكل صورة ويحقق 70.6% في ImageNet top-1. تصغيره تصغيرًا موحّدًا (uniform shrink) بمضاعف العرض 0.75 يخفض زمن الاستجابة إلى 72.3 ms لكنه يخفض الدقة إلى 68.4%. أما النموذج المقلّم القنوات (channel-pruned) الذي وجده AMC فيعمل في 68.3 ms بدقة 70.5%: بسرعة النموذج المصغّر نفسها، وأدق منه بـ 2.1 نقطة، وأقل من النموذج الكامل بـ 0.1 فقط مع سرعة تبلغ 1.81x من سرعته (He et al., ECCV 2018).
AMC (AutoML for Model Compression) is the method behind the red curve on slide 25. It treats the per-layer sparsity ratios as actions for a reinforcement-learning agent, which walks the network layer by layer, proposes a ratio for each, and is rewarded by the accuracy the pruned model reaches under a FLOPs or latency constraint. The pruned model is then fine-tuned. The baseline is the easiest thing one could do instead, which the paper states plainly: "the easiest way to reduce the channels of a model is to use uniform channel shrinkage, i.e. use a width multiplier", and the result is that AMC "consistently outperforms the uniform baselines" (He et al., ECCV 2018).
AMC (AutoML for Model Compression) هي الطريقة وراء المنحنى الأحمر في الشريحة 25. تعامل نسب التناثر لكل طبقة على أنها أفعال (actions) لوكيل تعلم معزّز (reinforcement learning) يمر على الشبكة طبقةً طبقة، ويقترح نسبة لكل منها، ويُكافأ بالدقة التي يبلغها النموذج المقلّم تحت قيد على FLOPs أو على زمن الاستجابة. ثم يُضبط النموذج المقلّم ضبطًا دقيقًا. خط الأساس هو أسهل ما يمكن فعله بدلًا من ذلك، والورقة تقوله صراحةً: «أسهل طريقة لتقليل قنوات نموذج هي استخدام تصغير قنوات موحّد، أي استخدام مضاعف عرض»، والنتيجة أن AMC «يتفوق باستمرار على خطوط الأساس الموحّدة» (He et al., ECCV 2018).
| Modelالنموذج | MMACsMMACs | Top-1Top-1 | Pixel 1 latencyزمن الاستجابة على Pixel 1 | Speedupالتسريع |
|---|---|---|---|---|
| MobileNet 1.0 (full width)MobileNet 1.0 (العرض الكامل) | 569569 | 70.6%70.6% | 123.3 ms123.3 ms | 1.00x1.00x |
| MobileNet 0.75 (uniform shrink)MobileNet 0.75 (تصغير موحّد) | 325325 | 68.4%68.4% | 72.3 ms72.3 ms | 1.7x1.7x |
| AMC, 50% FLOPs budgetAMC، ميزانية 50% من FLOPs | 285285 | 70.5%70.5% | 68.3 ms68.3 ms | 1.81x1.81x |
| AMC, 50% latency budgetAMC، ميزانية 50% من زمن الاستجابة | 272272 | 70.2%70.2% | 63.3 ms63.3 ms | 1.95x1.95x |
The chart on the slide is AMC's Figure 5b. The four table rows above are exact; the remaining points in the table below are read off the figure and are approximate. Either way the shape is the same. At equal latency the searched ratios are about 1.5 to 2 points better. At similar accuracy they are much faster: the 50% latency-budget model keeps 70.2% at 63.3 ms, 1.95x faster than the 123.3 ms full model at 70.6%, only 0.4 points higher.
المخطط في الشريحة هو الشكل 5b من ورقة AMC. صفوف الجدول الأربعة أعلاه دقيقة؛ أما النقاط الباقية في الجدول أدناه فمقروءة من الشكل وتقريبية. وفي الحالتين الشكل العام واحد. عند زمن استجابة متساوٍ تكون النسب المبحوث عنها أفضل بنحو 1.5 إلى 2 نقطة. وعند دقة متقاربة تكون أسرع بكثير: النموذج ذو ميزانية زمن الاستجابة 50% يحافظ على 70.2% عند 63.3 ms، أي أسرع بمقدار 1.95x من النموذج الكامل البالغ 123.3 ms بدقة 70.6%، الذي يزيد عليه بـ 0.4 نقطة فقط.
| Curveالمنحنى | Latencyزمن الاستجابة | Top-1Top-1 |
|---|---|---|
| Uniformموحّد | about 52 msنحو 52 ms | about 67.5%نحو 67.5% |
| Uniformموحّد | about 90 msنحو 90 ms | about 69.1%نحو 69.1% |
| AMCAMC | about 52 msنحو 52 ms | about 69.2%نحو 69.2% |
Choosing a granularity for a real boardاختيار درجة التقليم للوحة حقيقية
This is where the part comes together for your project. The granularity you pick is a hardware decision, not a compression decision:
هنا يجتمع هذا الجزء في خدمة مشروعك. درجة التقليم التي تختارها قرار يتعلق بالعتاد، لا قرار يتعلق بالضغط:
- Target is an Ampere-class or newer NVIDIA GPU (a Jetson Orin, an A100): prune to 2:4. Half the weights, about 2x on the matmuls, accuracy held by retraining.إذا كان الهدف GPU من NVIDIA من فئة Ampere أو أحدث (Jetson Orin، أو A100): قلّم إلى 2:4. نصف الأوزان، ونحو 2x في ضرب المصفوفات، والدقة محفوظة بإعادة التدريب.
- Target is a phone CPU, a microcontroller or an NPU with dense kernels only: channel pruning with searched per-layer ratios, AMC style. A smaller dense network is the safest choice, since it needs no special kernels. Some mobile runtimes (XNNPACK) do accelerate high unstructured sparsity in 1x1 convolutions, so check what your runtime supports.إذا كان الهدف CPU هاتف، أو متحكمًا دقيقًا (microcontroller)، أو NPU بنوى كثيفة فقط: تقليم القنوات بنسب لكل طبقة مبحوث عنها على طريقة AMC. الشبكة الكثيفة الأصغر هي الخيار الأكثر أمانًا، لأنها لا تحتاج إلى نوى خاصة. بعض بيئات التشغيل على الهواتف (XNNPACK) تسرّع فعلًا التناثر غير المنظّم العالي في الالتفافات 1x1، فتحقق مما تدعمه بيئة التشغيل لديك.
- Target has a sparse accelerator such as EIE, or the constraint is storage and not latency: fine-grained pruning, for the largest compression ratio.إذا كان الهدف فيه مسرّع متناثر مثل EIE، أو كان القيد هو التخزين لا زمن الاستجابة: التقليم الدقيق، للحصول على أكبر نسبة ضغط.
Quick checkاختبار سريع
Why does channel pruning with per-layer sparsities beat a uniform width multiplier at the same latency?لماذا يتفوق تقليم القنوات بنسب تناثر خاصة بكل طبقة على مضاعف العرض الموحّد عند زمن الاستجابة نفسه؟
Recall
Give the AMC versus uniform numbers that show per-layer ratios beat uniform shrink.أعطِ أرقام AMC مقابل التصغير الموحّد التي تبيّن أن النسب الخاصة بكل طبقة تتفوق على التصغير الموحّد.
Recapالخلاصة
If you remember nothing elseإن لم تتذكر شيئاً آخر فتذكّر هذا
- Fine-grained pruning may zero any weight, so it compresses most (AlexNet 9x, VGG-16 13x) but needs a per-weight index; only custom hardware such as EIE turns that into speed.التقليم الدقيق يجوز له تصفير أي وزن، لذلك يحقق أكبر ضغط (AlexNet بمقدار 9x، وVGG-16 بمقدار 13x) لكنه يحتاج فهرسًا لكل وزن؛ ولا يحوّل ذلك إلى سرعة إلا عتاد مخصص مثل EIE.
- N:M sparsity keeps at most N nonzeros in every contiguous M weights; 2:4 is 50 percent sparse under either reading, but 1:4 is 75 percent (NVIDIA) versus 25 percent (slide wording).تناثر N:M يُبقي N قيمًا غير صفرية على الأكثر في كل M أوزان متجاورة؛ نمط 2:4 تناثره 50 بالمئة بأي القراءتين، أما 1:4 فتناثره 75 بالمئة (اصطلاح NVIDIA) مقابل 25 بالمئة (صياغة الشريحة).
- A 2:4 matrix stores half its values plus 2-bit indices: 36 bits per four FP16 weights instead of 64, about 1.78x, and Ampere Sparse Tensor Cores skip the zeros for about 2x math throughput.مصفوفة 2:4 تخزّن نصف قيمها مع فهارس من بتّين: 36 بت لكل أربعة أوزان FP16 بدلًا من 64، أي نحو 1.78x، وتتخطى Sparse Tensor Cores في معمارية Ampere الأصفار فتعطي نحو 2x في إنتاجية العمليات الحسابية.
- NVIDIA's train, prune to 2:4, retrain recipe held accuracy on all seven slide-22 tasks (ResNet-50 76.1 to 76.2, BERT-Large 91.9 to 91.9).وصفة NVIDIA (درّب، ثم قلّم إلى 2:4، ثم أعد التدريب) حافظت على الدقة في المهام السبع كلها في الشريحة 22 (ResNet-50 من 76.1 إلى 76.2، وBERT-Large من 91.9 إلى 91.9).
- Channel pruning removes whole channels, so the result is a smaller dense network with direct speedup on any hardware, at the cost of a smaller compression ratio.تقليم القنوات يزيل قنوات كاملة، فتكون النتيجة شبكة كثيفة (dense) أصغر تعطي تسريعًا مباشرًا على أي عتاد، على حساب نسبة ضغط أصغر.
- Pruning layer l's output channels also shrinks layer l+1's inputs, so per-layer channel sparsities compound in parameters and MACs.تقليم قنوات الخرج في الطبقة l يصغّر أيضًا مدخلات الطبقة l+1، لذلك تتضاعف نسب تناثر القنوات لكل طبقة بعضها في بعض في عدد المعاملات وفي عدد MACs.
- Uniform shrink applies one ratio everywhere; AMC's searched per-layer ratios give 70.5 percent at 68.3 ms versus 68.4 percent at 72.3 ms for the 0.75 width MobileNet on a Pixel 1.التصغير الموحّد يطبّق نسبة واحدة في كل مكان؛ أما نسب AMC المبحوث عنها لكل طبقة فتعطي 70.5 بالمئة عند 68.3 ms مقابل 68.4 بالمئة عند 72.3 ms لنموذج MobileNet بعرض 0.75 على هاتف Pixel 1.
- Higher sparsity is not faster inference unless the sparsity has a structure the target hardware can exploit.التناثر الأعلى لا يعني استدلالًا أسرع ما لم يكن لهذا التناثر بنية يستطيع العتاد المستهدف استغلالها.
Sourcesالمصادر
- Accelerating Inference with Sparsity Using the NVIDIA Ampere Architecture and NVIDIA TensorRTDocsNVIDIA Developer BlogThe slide's own link: 2:4 definition, the train, prune, retrain recipe, and the seven-row accuracy table.رابط الشريحة نفسها: تعريف 2:4، ووصفة درّب ثم قلّم ثم أعد التدريب، وجدول الدقة ذو الصفوف السبعة.(opens in a new tab)(يفتح في تبويب جديد)
- NVIDIA A100 Tensor Core GPU ArchitectureDocsNVIDIAPages 31 to 32: 2:4 definition, almost 2x storage saving, Sparse MMA doubling throughput.الصفحتان 31 و32: تعريف 2:4، وتوفير في التخزين يقارب 2x، وعمليات Sparse MMA التي تضاعف الإنتاجية.(opens in a new tab)(يفتح في تبويب جديد)
- NVIDIA Ampere Architecture In-DepthDocsNVIDIA Developer BlogFine-grained structured sparsity section.قسم التناثر المنظّم الدقيق (fine-grained structured sparsity).(opens in a new tab)(يفتح في تبويب جديد)
- Accelerating Sparse Deep Neural NetworksPaperMishra et al., arXiv 2021Section 3.1: 2-bit indices, 64 versus 36 bits per group, 44 and 38 percent savings, CSR metadata overhead.القسم 3.1: فهارس من بتّين، و64 مقابل 36 بت لكل مجموعة، وتوفير بنسبة 44 و38 بالمئة، وكلفة البيانات الوصفية في صيغة CSR.(opens in a new tab)(يفتح في تبويب جديد)
- Learning N:M Fine-grained Structured Sparse Neural Networks From ScratchPaperZhou et al., ICLR 2021Fine-grained sparsity is not hardware friendly; restates NVIDIA's about 2x on the A100 (not independently measured).التناثر الدقيق غير ملائم للعتاد؛ وتعيد الورقة ذكر رقم NVIDIA البالغ نحو 2x على A100 (دون قياس مستقل).(opens in a new tab)(يفتح في تبويب جديد)
- Learning both Weights and Connections for Efficient Neural NetworksPaperHan, Pool, Tran and Dally, NIPS 2015AlexNet 9x and VGG-16 13x parameter reduction without accuracy loss.تخفيض عدد المعاملات في AlexNet بمقدار 9x وفي VGG-16 بمقدار 13x دون خسارة في الدقة.(opens in a new tab)(يفتح في تبويب جديد)
- EIE: Efficient Inference Engine on Compressed Deep Neural NetworkPaperHan et al., ISCA 2016189x over CPU, 13x over GPU, 3400x more energy efficient than GPU, compared with CPU and GPU running the same DNN without compression.أسرع بمقدار 189x من CPU و13x من GPU، وأكفأ في استهلاك الطاقة بمقدار 3400x من GPU، مقارنةً بـ CPU وGPU يشغّلان الشبكة العصبية العميقة نفسها دون ضغط.(opens in a new tab)(يفتح في تبويب جديد)
- Efficient Methods and Hardware for Deep LearningBookSong Han, PhD thesis, Stanford 2017Table 3.1: GoogleNet 7 M to 2 M, ResNet-50 25.5 M to 7.47 M.الجدول 3.1: GoogleNet من 7 M إلى 2 M، وResNet-50 من 25.5 M إلى 7.47 M.(opens in a new tab)(يفتح في تبويب جديد)
- Pruning Filters for Efficient ConvNetsPaperLi et al., ICLR 2017Filter pruning needs no sparse libraries; 34 and 38 percent inference cost reduction.تقليم المرشّحات لا يحتاج إلى مكتبات متناثرة؛ وتخفيض كلفة الاستدلال بنسبة 34 و38 بالمئة.(opens in a new tab)(يفتح في تبويب جديد)
- Channel Pruning for Accelerating Very Deep Neural NetworksPaperHe, Zhang and Sun, ICCV 2017VGG-16 5x speedup at 0.3 percent error increase, ResNet 2x at 1.4 percent.تسريع VGG-16 بمقدار 5x مع زيادة في الخطأ قدرها 0.3 بالمئة، وتسريع ResNet بمقدار 2x مع زيادة قدرها 1.4 بالمئة.(opens in a new tab)(يفتح في تبويب جديد)
- AMC: AutoML for Model Compression and Acceleration on Mobile DevicesPaperHe, Lin, Liu, Wang, Li and Han, ECCV 2018Table 4 and Figure 5b: Pixel 1 latencies and the uniform width-multiplier baseline.الجدول 4 والشكل 5b: أزمنة الاستجابة على Pixel 1، وخط الأساس لمضاعف العرض الموحّد.(opens in a new tab)(يفتح في تبويب جديد)
- TinyML and Efficient Deep Learning Computing, Lecture 3: Pruning and Sparsity (Part I)DocsMIT 6.5940, Song Han, Fall 2024Source deck for slides 19 to 25, including the '(e.g., EIE)' example dropped from the COE 592 copy.العرض الأصلي للشرائح 19 إلى 25، بما فيه مثال «(e.g., EIE)» الذي حُذف من نسخة COE 592.(opens in a new tab)(يفتح في تبويب جديد)