Majid Al-RaimiFrom sensitivity curves to per-layer ratiosمن منحنيات الحساسية إلى نسب لكل طبقة

COE 592Lecture 4.2المحاضرة 4.2Part 03الجزء 03

From sensitivity curves to per-layer ratiosمن منحنيات الحساسية إلى نسب لكل طبقة

Pick an accuracy threshold, read off each layer's pruning rate where its curve crosses it, and see why this heuristic ignores the interaction between layers.اختر عتبة للدقة، واقرأ نسبة التقليم لكل طبقة عند النقطة التي يتقاطع فيها منحناها مع العتبة، وافهم لماذا يتجاهل هذا الأسلوب الاستدلالي (heuristic) التفاعل بين الطبقات.

Conceptsالمفاهيم
3
Slidesالشرائح
18-23
Readingمدة القراءة
18 min18 دقيقة
Understoodما فهمته
0/3 conceptsمفاهيم

Why this part mattersلماذا يهمّ هذا الجزء

Part 02 ended with a wall of six curves and no numbers. This part is the step that converts that chart into the six per-layer ratios you actually type into a pruning script, and it is the exact place where an exam will hand you a small accuracy table, a threshold and a parameter count per layer, and ask for the per-layer rates and the overall rate.

It is also the baseline that every automated method in the rest of the lecture is judged against. AMC and NetAdapt exist because the threshold read-off has a specific, nameable flaw, so for the research project you need to be able to run this heuristic, defend it as a cheap starting point, and say precisely why it falls short. One horizontal line, six crossings, one weighted sum, one honest caveat. That is the whole part.

انتهى الجزء 02 بجدار من ستة منحنيات بلا أي أرقام. هذا الجزء هو الخطوة التي تحوّل ذلك المخطط إلى النسب الست الخاصة بكل طبقة، وهي النسب التي تكتبها فعلًا في سكربت التقليم (pruning script). وهو بالضبط الموضع الذي سيعطيك فيه الامتحان جدول دقة صغيرًا، وعتبة، وعدد المعاملات لكل طبقة، ثم يطلب منك نسبة كل طبقة والنسبة الكلية.

وهو أيضًا خط الأساس (baseline) الذي تُقارن به كل طريقة آلية في بقية المحاضرة. فـ AMC و NetAdapt موجودتان لأن قراءة العتبة فيها عيب محدد يمكن تسميته، لذلك تحتاج في مشروعك البحثي إلى أن تكون قادرًا على تشغيل هذه الطريقة التقريبية، والدفاع عنها كنقطة بداية رخيصة، وأن تقول بدقة لماذا تقصر. خط أفقي واحد، ست نقاط عبور، مجموع موزون واحد، وتحفّظ صادق واحد. هذا هو الجزء كله.

By the end you canفي نهاية هذا الجزء ستستطيع

  1. Read a sensitivity chart and classify layers as sensitive or redundant from the slope of their curves.قراءة مخطط الحساسية وتصنيف الطبقات إلى حساسة (sensitive) أو فائضة (redundant) من ميل منحنياتها.
  2. Apply the threshold rule to read off a pruning rate for every layer, including layers that never cross T.تطبيق قاعدة العتبة لاستخراج نسبة تقليم لكل طبقة، بما في ذلك الطبقات التي لا تعبر T أبدًا.
  3. Compute the overall pruning rate as a parameter-weighted average and adjust T until it meets a target.حساب نسبة التقليم الكلية كمتوسط موزون بعدد المعاملات، وتعديل T حتى تحقق الهدف المطلوب.
  4. Explain in one sentence why the result is sub-optimal, using the words single-layer sweep and interaction.شرح سبب كون النتيجة دون المثلى (sub-optimal) في جملة واحدة، باستخدام عبارتي single-layer sweep و interaction.
  5. Connect the limits of the heuristic to the motivation for automated pruning in the next two parts.ربط حدود هذه الطريقة التقريبية (heuristic) بالدافع وراء التقليم الآلي في الجزأين التاليين.

Put your finger on the 80% column of the VGG-11 chart and read straight down. The green L1 curve is still at about 92% accuracy. The blue L0 curve has already dropped to about 71%. Same network, same dataset, same pruning ratio, and the two layers are twenty points apart. That gap is the entire reason per-layer pruning ratios exist, and it is what the six curves are there to expose.

ضع إصبعك على عمود 80% في مخطط VGG-11 واقرأ نزولًا. المنحنى الأخضر L1 ما زال عند دقة تقارب 92%، أما المنحنى الأزرق L0 فقد هبط بالفعل إلى نحو 71%. الشبكة نفسها، ومجموعة البيانات نفسها، ونسبة التقليم نفسها، ومع ذلك تفصل بين الطبقتين عشرون نقطة. هذه الفجوة هي السبب الكامل لوجود نسب تقليم خاصة بكل طبقة، وهي ما وُضعت المنحنيات الست لكشفه.

Recall what each curve is. Sensitivity analysis prunes one layer L_i alone at ratios r in {0, 0.1, ..., 0.9}, measures the accuracy at each ratio with every other layer left dense, then moves on to the next layer and repeats. The result is one accuracy versus ratio line per layer. Every line starts at the same place, the dense accuracy of about 93% on CIFAR-10, so the starting point carries no information at all. What differs is the slope: how soon and how steeply each line bends down as r grows. That slope is the layer's sensitivity.

تذكّر ما يمثله كل منحنى. يقوم sensitivity analysis بتقليم طبقة واحدة L_i وحدها عند النسب r ضمن {0, 0.1, ..., 0.9}، ويقيس الدقة عند كل نسبة مع ترك كل الطبقات الأخرى كثيفة (dense)، ثم ينتقل إلى الطبقة التالية ويكرر. النتيجة خط واحد للدقة مقابل النسبة لكل طبقة. كل الخطوط تبدأ من المكان نفسه، أي الدقة الكثيفة التي تقارب 93% على CIFAR-10، لذلك فنقطة البداية لا تحمل أي معلومة على الإطلاق. ما يختلف هو الميل: متى وبأي حدة ينحني كل خط إلى الأسفل كلما كبرت r. هذا الميل هو sensitivity الطبقة، أي حساسيتها.

LayerالطبقةAt 70% prunedعند تقليم 70%At 80% prunedعند تقليم 80%At 90% prunedعند تقليم 90%Verdictالحكم
L0L083.5%83.5%71%71%32%32%Most sensitive: bends first, falls off a cliffالأكثر حساسية: تنحني أولًا ثم تسقط كأنها من فوق جرف
L1L193%93%92%92%85%85%Most redundant: flat almost to the endالأكثر فائضًا: مسطحة تقريبًا حتى النهاية
L2L291.5%91.5%89.5%89.5%79%79%Redundant: still about 79% at 90%فائضة: ما زالت عند نحو 79% عند 90%
L3L391.5%91.5%85.5%85.5%51%51%Moderate: bends late, drops hard at 90%متوسطة: تنحني متأخرة، ثم تهبط بشدة عند 90%
L4L490.5%90.5%77%77%39%39%Sensitive past 70%حساسة بعد 70%
L5L592%92%90%90%82%82%Redundant: about 82% at 90%فائضة: نحو 82% عند 90%
Six curves at a glance (accuracy read from the slide chart, VGG-11 on CIFAR-10)المنحنيات الست في لمحة (الدقة مقروءة من مخطط الشريحة، VGG-11 على CIFAR-10)

The rule that falls out of the table is simple. A curve that stays flat as r grows belongs to a redundant layer: most of its weights can go with no visible cost, so it should be pruned hard. A curve that bends early belongs to a sensitive layer: its weights are doing work that nothing else in the network can absorb, so it should be pruned gently. The slide summarizes it as "some layers are less sensitive to pruning" (L1, the flattest) and "some layers are more sensitive to pruning" (L0, the steepest), and the whole point of drawing all six on one axis is that you can rank them by eye.

القاعدة التي تخرج من الجدول بسيطة. المنحنى الذي يبقى مسطحًا كلما كبرت r يعود إلى طبقة فائضة (redundant): يمكن حذف معظم أوزانها دون كلفة ظاهرة، لذلك ينبغي تقليمها بقوة. أما المنحنى الذي ينحني مبكرًا فيعود إلى طبقة حساسة (sensitive): أوزانها تؤدي عملًا لا يستطيع أي جزء آخر من الشبكة أن يعوّضه، لذلك ينبغي تقليمها بلطف. تلخّص الشريحة ذلك بعبارة "some layers are less sensitive to pruning" (أي L1، الأكثر تسطحًا) وعبارة "some layers are more sensitive to pruning" (أي L0، الأكثر انحدارًا)، والهدف كله من رسم المنحنيات الست على محور واحد هو أن تستطيع ترتيبها بالعين.

Why the first layer is the fragile oneلماذا الطبقة الأولى هي الطبقة الهشّة

L0 being the most sensitive is not a quirk of this run. Han et al. (2015), the paper the chart's method comes from, report the same pattern on AlexNet: "The first convolutional layer, which interacts with the input image directly, is most sensitive to pruning. We suspect this sensitivity is due to the input layer having only 3 channels and thus less redundancy than the other convolutional layers" (section 5, Figure 6). Their Figure 6 also shows convolutional layers as a group being more sensitive than fully connected layers, which is the same story at coarser resolution: the layers with the fewest weights per unit of work have the least slack. A 3 x 3 kernel over three input channels has 27 weights per filter; removing 80% of them leaves five, and five numbers cannot describe an edge detector.

كون L0 الأكثر حساسية ليس مصادفة في هذه التجربة. فـ Han et al. (2015)، وهي الورقة التي جاءت منها طريقة المخطط، تذكر النمط نفسه على AlexNet: "The first convolutional layer, which interacts with the input image directly, is most sensitive to pruning. We suspect this sensitivity is due to the input layer having only 3 channels and thus less redundancy than the other convolutional layers" (القسم 5، الشكل 6)، أي أن أول طبقة التفافية، التي تتعامل مع صورة الإدخال مباشرة، هي الأكثر حساسية للتقليم، ويرجّحون أن السبب أن طبقة الإدخال لها 3 قنوات فقط وبالتالي فائض أقل من بقية الطبقات الالتفافية. ويُظهر الشكل 6 لديهم أيضًا أن الطبقات الالتفافية كمجموعة أكثر حساسية من الطبقات المتصلة بالكامل (fully connected)، وهي القصة نفسها بدقة أقل: الطبقات التي تملك أقل عدد من الأوزان لكل وحدة عمل لديها أقل هامش. نواة 3 x 3 على ثلاث قنوات إدخال فيها 27 وزنًا لكل مرشّح (filter)، وحذف 80% منها يُبقي خمسة فقط، وخمسة أرقام لا تكفي لوصف كاشف حواف (edge detector).

Recall

Which VGG-11 layer in the chart is most sensitive, and what physical reason does Han et al. give?أي طبقة من VGG-11 في المخطط هي الأكثر حساسية، وما السبب الفيزيائي الذي يذكره Han et al.؟

L0, the first conv layer. It interacts with the input image directly, and the input has only three channels, so the layer has little redundancy to spare.
L0، أول طبقة conv. فهي تتعامل مع صورة الإدخال مباشرة، والإدخال له ثلاث قنوات فقط، لذلك لا تملك الطبقة إلا فائضًا قليلًا يمكن التخلي عنه.

Quick checkاختبار سريع

On the VGG-11 chart, which layer tolerates 90 percent pruning best, and what does that say about it?في مخطط VGG-11، أي طبقة تتحمل تقليم 90 بالمئة بأفضل شكل، وماذا يقول ذلك عنها؟

Now draw one dashed horizontal line across the chart just under 80% accuracy, where the slide puts it (measured against the gridlines it sits at about 79%). Walk along the blue L0 curve from the left. It sits above the line through 60%, is still above it at 70% (about 83.5%), and has dropped to 71% by 80%. Somewhere between those two grid points it crossed the line, at roughly 73% pruning. That crossing is L0's pruning rate. Do the same for the orange L3 (about 82%) and the steep red L4, whose 80% point sits just under the line: strict interpolation puts the crossing at about 78.5%, and the slide rounds its drawn guide up to 80%. L1, the flat red L2 and L5 never reach the line inside the sweep, so they get the largest tested rate, 90%, which is where the slide draws its last vertical guide.

الآن ارسم خطًا أفقيًا متقطعًا واحدًا عبر المخطط تحت دقة 80% بقليل، حيث تضعه الشريحة (بالقياس على خطوط الشبكة يقع عند نحو 79%). امشِ على المنحنى الأزرق L0 من اليسار. يبقى فوق الخط حتى 60%، وما زال فوقه عند 70% (نحو 83.5%)، ثم يهبط إلى 71% عند 80%. في مكان ما بين نقطتي الشبكة هاتين عبر الخط، عند تقليم يقارب 73%. نقطة العبور هذه هي نسبة تقليم L0. افعل الشيء نفسه مع المنحنى البرتقالي L3 (نحو 82%) ومع المنحنى الأحمر الحاد L4، الذي تقع نقطته عند 80% تحت الخط بقليل: الاستكمال الدقيق (interpolation) يضع العبور عند نحو 78.5%، والشريحة تقرّب خطها الإرشادي المرسوم إلى 80%. أما L1 والأحمر المسطح L2 و L5 فلا تصل إلى الخط أبدًا داخل نطاق المسح، لذلك تأخذ أكبر نسبة مُختبرة، 90%، وهي المكان الذي ترسم فيه الشريحة آخر خط إرشادي رأسي.

The threshold line rises to the slide's level, then a crossing marker and a vertical guide light up for each layer in the order they cross. The replica's crossings land within about a point and a half of the slide's guidesيرتفع خط العتبة إلى مستوى الشريحة، ثم تضيء علامة عبور وخط إرشادي رأسي لكل طبقة بترتيب عبورها. تقع نقاط العبور في هذه النسخة ضمن نحو نقطة ونصف من الخطوط الإرشادية في الشريحة

Pruning rates read off at T of about 79 to 80 percent (from the dashed guides on the slide)نسب التقليم المقروءة عند T تقارب 79 إلى 80 بالمئة (من الخطوط الإرشادية المتقطعة في الشريحة)

L0
about 73%: crosses T between the 70% and 80% pointsنحو 73%: تعبر T بين النقطتين 70% و 80%
L1
90% or beyond: still about 85% accuracy at the last swept ratio90% أو أكثر: ما زالت دقتها نحو 85% عند آخر نسبة مُختبرة
L2
90% or beyond: about 79% accuracy at 90%, on the line90% أو أكثر: دقتها نحو 79% عند 90%، أي على الخط تمامًا
L3
about 82%: crosses just past the 80% pointنحو 82%: تعبر بعد نقطة 80% بقليل
L4
about 78% by interpolation; the slide rounds its drawn guide up to 80%نحو 78% بالاستكمال (interpolation)، والشريحة تقرّب خطها الإرشادي المرسوم إلى 80%
L5
90% or beyond: about 82% accuracy at 90%90% أو أكثر: دقتها نحو 82% عند 90%

That is the whole mechanism, and it deserves to be stated as an algorithm rather than a picture, because the exam version comes as a table, not a chart. Choose an accuracy threshold T. For each layer, the pruning ratio is the largest swept ratio whose accuracy is still at or above T. Layers whose curves never dip below T inside the sweep get the maximum swept ratio.

هذه هي الآلية كلها، وتستحق أن تُصاغ كخوارزمية لا كصورة، لأن نسخة الامتحان تأتي كجدول لا كمخطط. اختر accuracy threshold T، أي عتبة الدقة. لكل طبقة، تكون pruning ratio هي أكبر نسبة مُختبرة ما زالت دقتها عند T أو أعلى منها. والطبقات التي لا تنزل منحنياتها أبدًا تحت T داخل نطاق المسح تأخذ أكبر نسبة مُختبرة.

ri=max⁡{ r∈{0,0.1,…,0.9}:Accr i≥T }r_i = \max\left\{\, r \in \{0, 0.1, \dots, 0.9\} : \mathrm{Acc}^{\,i}_{r} \ge T \,\right\}
Table form: the largest swept ratio at or above T. On a chart, interpolate the crossing between the last grid point at or above T and the first below itفي الجدول: أكبر نسبة مُجرَّبة عند T أو فوقها. وفي المخطط: استكمل نقطة التقاطع بين آخر نقطة شبكة عند T أو فوقها وأول نقطة تحتها

The read-off table above and the worked example below follow the slide's drawn guides, which use the chart form and interpolate between grid points. By the strict table form L0 and L4 would snap to 70% and L3 to 80%, and exact interpolation puts L4 at about 78.5%, so the slide's 80% guide for L4 is a rounding of its own chart. The formula is the exam rule; the guides are how the slide applies it by eye.

جدول القراءة أعلاه والمثال المحلول أدناه يتبعان الخطوط الإرشادية المرسومة في الشريحة، وهي تستخدم صيغة المخطط وتستكمل بين نقاط الشبكة. وفق صيغة الجدول الصارمة كانت L0 و L4 ستُقرَّبان إلى 70% و L3 إلى 80%، والاستكمال الدقيق يضع L4 عند نحو 78.5%، لذلك فإن خط 80% الإرشادي لـ L4 في الشريحة هو تقريب لمخططها نفسه. المعادلة هي قاعدة الامتحان، والخطوط الإرشادية هي طريقة تطبيق الشريحة لها بالعين.

From six rates to one overall rateمن ست نسب إلى نسبة كلية واحدة

The slide bullet reads "pick a degradation threshold T such that the overall pruning rate is desired", and the word overall hides a calculation students routinely get wrong. The overall rate is not the average of the six numbers. It is the fraction of all weights removed, so each layer's rate is weighted by how many weights that layer has. A 90% rate on a layer with 2.36 million weights removes far more than a 73% rate on a layer with 1,728.

يقول بند الشريحة "pick a degradation threshold T such that the overall pruning rate is desired"، أي اختر عتبة تدهور T بحيث تكون نسبة التقليم الكلية هي المطلوبة، وكلمة overall (الكلية) تخفي حسابًا يخطئ فيه الطلاب كثيرًا. فـ overall rate ليست متوسط الأرقام الستة، بل هي نسبة كل الأوزان المحذوفة، لذلك تُوزن نسبة كل طبقة بعدد أوزانها. نسبة 90% على طبقة فيها 2.36 مليون وزن تحذف أكثر بكثير من نسبة 73% على طبقة فيها 1,728 وزنًا.

R=∑iriNi∑iNi,compression=∑iNi∑i(1−ri) Ni=11−RR = \frac{\sum_i r_i N_i}{\sum_i N_i}, \qquad \text{compression} = \frac{\sum_i N_i}{\sum_i (1 - r_i)\, N_i} = \frac{1}{1 - R}
Overall pruning rate as a parameter-weighted average, and the compression factor it impliesمعدل التقليم الكلي بوصفه متوسطًا موزونًا بعدد المعاملات، ومعامل الضغط الناتج عنه

T is the one knob. If R comes out below the target, lower T: every curve now runs further right before it crosses, so every r_i grows or stays pinned at the maximum swept ratio, and R never falls. If the pruned network turns out too inaccurate, raise T and no rate can grow. The loop is: pick T, read off six rates, compute R, compare with the target, move T, repeat. It converges in a handful of iterations because R is monotone in T.

T هي المقبض الوحيد. إذا خرجت R أقل من الهدف فاخفض T: كل منحنى يمتد الآن أبعد نحو اليمين قبل أن يعبر، فكل r_i تكبر أو تبقى مثبتة عند أكبر نسبة مُختبرة، و R لا تنخفض أبدًا. وإذا تبيّن أن الشبكة المقلّمة دقتها ضعيفة جدًا فارفع T، وعندها لا يمكن لأي نسبة أن تكبر. الحلقة هي: اختر T، اقرأ ست نسب، احسب R، قارنها بالهدف، حرّك T، كرّر. وهي تتقارب خلال بضع تكرارات لأن R رتيبة (monotone) بالنسبة إلى T.

Worked exampleمثال محلول

What the slide's T buys on VGG-11ماذا تحقق T الموجودة في الشريحة على VGG-11

  1. Assign illustrative weight countsعيّن أعدادًا توضيحية للأوزان

    The slide does not say which six layers L0 to L5 are, so take the first six 3 x 3 conv layers of VGG configuration A (Simonyan and Zisserman, Table 1) with biases ignored: 3 x 64 x 9 = 1,728, 64 x 128 x 9 = 73,728, 128 x 256 x 9 = 294,912, 256 x 256 x 9 = 589,824, 256 x 512 x 9 = 1,179,648, 512 x 512 x 9 = 2,359,296. Total 4,499,136. These counts are illustrative; the read-off rule does not depend on them, but R does.
    لا تذكر الشريحة ما هي الطبقات الست من L0 إلى L5، لذلك خذ أول ست طبقات conv بحجم 3 x 3 من إعداد VGG رقم A (Simonyan and Zisserman، الجدول 1) مع تجاهل الانحيازات (biases): 3 x 64 x 9 = 1,728، 64 x 128 x 9 = 73,728، 128 x 256 x 9 = 294,912، 256 x 256 x 9 = 589,824، 256 x 512 x 9 = 1,179,648، 512 x 512 x 9 = 2,359,296. المجموع 4,499,136. هذه الأعداد توضيحية، وقاعدة القراءة لا تعتمد عليها، لكن R تعتمد عليها.
  2. Multiply each rate by its countاضرب كل نسبة في عددها

    Rates in layer order are 0.73, 0.90, 0.90, 0.82, 0.80, 0.90, taken from the slide's drawn guides rather than the strict grid rule: exact interpolation puts L4 at 0.785, and the 0.80 here is the slide's rounding of that guide. So 1,728 x 0.73 + 73,728 x 0.90 + 294,912 x 0.90 + 589,824 x 0.82 + 1,179,648 x 0.80 + 2,359,296 x 0.90 is about 3,883,778 weights pruned.
    النسب بترتيب الطبقات هي 0.73, 0.90, 0.90, 0.82, 0.80, 0.90، مأخوذة من الخطوط الإرشادية المرسومة في الشريحة لا من قاعدة الشبكة الصارمة: الاستكمال الدقيق يضع L4 عند 0.785، والقيمة 0.80 هنا هي تقريب الشريحة لذلك الخط. إذن 1,728 x 0.73 + 73,728 x 0.90 + 294,912 x 0.90 + 589,824 x 0.82 + 1,179,648 x 0.80 + 2,359,296 x 0.90 تساوي نحو 3,883,778 وزنًا مقلّمًا.
  3. Divide by the totalاقسم على المجموع

    R = 3,883,778 / 4,499,136 = 86.3%. About 615,358 weights remain.
    R = 3,883,778 / 4,499,136 = 86.3%. يتبقى نحو 615,358 وزنًا.
  4. Weighted versus unweightedالموزون مقابل غير الموزون

    QuantityالكميةValueالقيمةWhy it differsسبب الاختلاف
    Unweighted mean of the six ratesالمتوسط غير الموزون للنسب الست84.2%84.2%Treats the 1,728-weight L0 like the 2.36M-weight L5يعامل L0 ذات 1,728 وزنًا مثل L5 ذات 2.36M وزن
    Parameter-weighted rate Rالنسبة الموزونة بعدد المعاملات R86.3%86.3%The big late layers are pruned at 80 to 90%, so R is higherالطبقات الكبيرة المتأخرة تُقلَّم بين 80 و 90%، لذلك تكون R أعلى
    Weights remainingالأوزان المتبقية615,358 of 4,499,136615,358 من 4,499,136About one in seven survivesينجو نحو وزن واحد من كل سبعة
    Compression factorمعامل الضغط7.3x7.3x1 / (1 - 0.863)1 / (1 - 0.863)

The simulator below runs this loop on curves digitized from the slide, so at its default T of 79% the interpolated crossings land within about a point and a half of the slide's guides (L4 reads 78.5% against the drawn 80%) and R reads 86.0% against the worked example's 86.3%. Drag T and watch all six vertical guides move at once; switch between snapping to the 10% grid and interpolating between grid points; and read R, the unweighted mean and the compression factor as they update. Try T at 90 first, then 70, and note which direction R moves.

المحاكي أدناه يشغّل هذه الحلقة على منحنيات مُرقمنة من الشريحة، لذلك عند قيمته الافتراضية T = 79% تقع نقاط العبور المستكملة ضمن نحو نقطة ونصف من خطوط الشريحة الإرشادية (L4 تقرأ 78.5% مقابل 80% المرسومة) وتقرأ R القيمة 86.0% مقابل 86.3% في المثال المحلول. اسحب T وراقب الخطوط الإرشادية الرأسية الستة تتحرك معًا؛ وبدّل بين التقريب إلى شبكة 10% والاستكمال بين نقاط الشبكة؛ واقرأ R والمتوسط غير الموزون ومعامل الضغط (compression factor) وهي تتحدث. جرّب T عند 90 أولًا، ثم عند 70، ولاحظ في أي اتجاه تتحرك R.

SimulatorمحاكيThreshold read-off: one line, six pruning ratesقراءة الحد: خط واحد، وست نسب تقليم
79.0% accuracy floorأدنى دقة مقبولة 79.0%
304458728610010%20%30%40%50%60%70%80%90%pruning rate per layer, VGG-11 on CIFAR-10 (digitized from the slide)accuracy (%)T = 79%L0L1L2L3L4L5
Per-layer pruning rate read off at the current threshold, with illustrative weight countsنسبة التقليم لكل طبقة مقروءة عند الحد الحالي، مع أعداد أوزان توضيحية
LayerالطبقةShape (illustrative)الشكل (توضيحي)RateالنسبةAccuracy thereالدقة عندهاWeightsالأوزانPrunedالمقلَّم
L03 x 64 x 3 x 373.6%79.0%1,7281,272
L164 x 128 x 3 x 390.0%85.0%73,72866,355
L2128 x 256 x 3 x 390.0%79.0%294,912265,421
L3256 x 256 x 3 x 381.9%79.0%589,824482,972
L4256 x 512 x 3 x 378.5%79.0%1,179,648926,242
L5512 x 512 x 3 x 390.0%82.0%2,359,2962,123,366
Overall rate R85.9%sum(r_i N_i) / sum(N_i)
Unweighted mean84.0%mean of the six ratesمتوسط النسب الست
Weights left633,508of 4,499,136من 4,499,136
Compression7.1x1 / (1 - R)

Drag T down and every vertical guide slides right at once: one knob moves all six rates. Drag it up and the guides retreat, so a higher T prunes less. The six curves are digitized from the slide chart, and the default T of 79% is where the slide draws its dashed line, a hair under the 80 mark. The weight counts are illustrative: the first six 3 x 3 conv layers of VGG configuration A with biases ignored, since the slide does not say which layers L0 to L5 are. Snap mode returns the last grid point still at or above T; interpolate mode places the crossing between grid points, which is what the dashed guides on the slide do.اسحب T إلى الأسفل فتنزلق كل الخطوط الرأسية إلى اليمين معًا: مقبض واحد يحرك النسب الست كلها. واسحبه إلى الأعلى فتتراجع الخطوط، أي أن T الأعلى يقلّم أقل. المنحنيات الست مرقمنة من مخطط الشريحة، والقيمة الافتراضية T = 79% هي حيث ترسم الشريحة خطها المتقطع، تحت علامة 80 بقليل. أعداد الأوزان توضيحية: هي أول ست طبقات التفاف 3 x 3 في إعداد VGG من النوع A مع تجاهل الانحيازات(biases)، لأن الشريحة لا تحدد أي الطبقات هي L0 إلى L5. وضع الالتقاط(snap) يعيد آخر نقطة في الشبكة لا تزال عند T أو فوقه، ووضع الاستيفاء(interpolate) يضع نقطة التقاطع بين نقاط الشبكة، وهذا ما تفعله الخطوط المتقطعة في الشريحة.

Same L0 curve twice. Raising T from 70 to 86 percent pulls the crossing from about 80 to about 64 percent, and the pruned span under the axis shrinksمنحنى L0 نفسه مرتين. رفع T من 70 إلى 86 بالمئة يسحب نقطة العبور من نحو 80 إلى نحو 64 بالمئة، فيتقلص المدى المقلَّم تحت المحور

The exam version: a table instead of a chartنسخة الامتحان: جدول بدلًا من مخطط

On paper you will get an accuracy table for two or three layers, a threshold and a weight count per layer. The procedure is identical. Read each row until the accuracy falls below T, take the last ratio that was still at or above T, weight by the counts, and add.

على الورق ستحصل على جدول دقة لطبقتين أو ثلاث، وعتبة، وعدد أوزان لكل طبقة. الإجراء مطابق: اقرأ كل صف حتى تنزل الدقة تحت T، وخذ آخر نسبة كانت ما تزال عند T أو أعلى، ثم زِن بالأعداد واجمع.

Layerالطبقةr = 50%r = 50%r = 60%r = 60%r = 70%r = 70%r = 80%r = 80%r = 90%r = 90%
A (100,000 weights)A (100,000 وزن)90%90%84%84%70%70%52%52%30%30%
B (400,000 weights)B (400,000 وزن)95%95%93%93%91%91%86%86%75%75%
C (500,000 weights)C (500,000 وزن)95%95%95%95%94%94%93%93%90%90%
Exam-style table: accuracy after pruning one layer alone, threshold T = 90 percentجدول بأسلوب الامتحان: الدقة بعد تقليم طبقة واحدة وحدها، والعتبة T = 90 بالمئة

Worked exampleمثال محلول

Three layers, T = 90 percentثلاث طبقات، T = 90 بالمئة

  1. Read each rowاقرأ كل صف

    A is at 90% at r = 50 and 84% at 60, so r_A = 50%. B is at 91% at 70 and 86% at 80, so r_B = 70%. C is still at 90% at the last ratio, so r_C = 90%.
    الطبقة A عند 90% في r = 50 وعند 84% في 60، إذن r_A = 50%. الطبقة B عند 91% في 70 وعند 86% في 80، إذن r_B = 70%. الطبقة C ما زالت عند 90% في آخر نسبة، إذن r_C = 90%.
  2. Weight by the countsزِن بالأعداد

    100,000 x 0.5 + 400,000 x 0.7 + 500,000 x 0.9 = 50,000 + 280,000 + 450,000 = 780,000.
    100,000 x 0.5 + 400,000 x 0.7 + 500,000 x 0.9 = 50,000 + 280,000 + 450,000 = 780,000.
  3. Divide by the totalاقسم على المجموع

    R = 780,000 / 1,000,000 = 78%. 220,000 weights remain, a compression of about 4.5x. The unweighted mean would have been 70%, which is wrong.
    R = 780,000 / 1,000,000 = 78%. يتبقى 220,000 وزن، أي ضغط بنحو 4.5x. المتوسط غير الموزون كان سيعطي 70%، وهذا خطأ.
  4. One sentence on optimalityجملة واحدة عن الأمثلية

    The rates come from single-layer sweeps, so the accuracy of pruning A, B and C together is never measured and is usually below T. The next concept explains why.
    النسب مأخوذة من مسوحات على طبقة واحدة (single-layer sweeps)، لذلك فإن دقة تقليم A و B و C معًا لا تُقاس أبدًا وتكون عادة تحت T. المفهوم التالي يشرح السبب.

Recall

State the rule that turns one layer's sensitivity curve into a pruning rate.اذكر القاعدة التي تحوّل منحنى حساسية طبقة واحدة إلى نسبة تقليم.

The rate is where the curve crosses T: on a table, the largest swept ratio still at or above T; on a chart, the interpolated crossing between grid points. Layers that never cross T inside the sweep get the maximum swept ratio.
النسبة هي النقطة التي يعبر فيها المنحنى T: في الجدول هي أكبر نسبة مُختبرة ما زالت عند T أو أعلى، وفي المخطط هي نقطة العبور المستكملة بين نقاط الشبكة. والطبقات التي لا تعبر T أبدًا داخل نطاق المسح تأخذ أكبر نسبة مُختبرة.

Recall

Your overall pruning rate comes out below target. Do you raise or lower T, and why?خرجت نسبة التقليم الكلية أقل من الهدف. هل ترفع T أم تخفضها، ولماذا؟

Lower T. A lower accuracy floor lets every curve run further to the right before crossing, so each per-layer rate grows or stays at the maximum swept ratio, and the weighted overall rate never falls.
اخفض T. الحد الأدنى الأقل للدقة يسمح لكل منحنى بالامتداد أبعد نحو اليمين قبل العبور، فتكبر نسبة كل طبقة أو تبقى عند أكبر نسبة مُختبرة، والنسبة الكلية الموزونة لا تنخفض أبدًا.

Recall

Three layers with 100k, 400k and 500k weights read off at 50, 70 and 90 percent. What is the overall rate?ثلاث طبقات فيها 100k و 400k و 500k وزن، قُرئت نسبها عند 50 و 70 و 90 بالمئة. ما النسبة الكلية؟

(50k + 280k + 450k) / 1M = 78%, not the unweighted 70%.
(50k + 280k + 450k) / 1M = 78%، وليست 70% غير الموزونة.

Quick checkاختبار سريع

You raise the accuracy threshold T from 80 percent to 88 percent on the sensitivity chart. What happens to the per-layer pruning rates read off the curves?رفعت عتبة الدقة T من 80 بالمئة إلى 88 بالمئة على مخطط الحساسية. ماذا يحدث لنسب التقليم الخاصة بكل طبقة المقروءة من المنحنيات؟

Quick checkاختبار سريع

Layer A has 200,000 weights and crosses T at 60 percent, B has 300,000 and crosses at 80 percent, C has 500,000 and crosses at 90 percent. Overall pruning rate?الطبقة A فيها 200,000 وزن وتعبر T عند 60 بالمئة، و B فيها 300,000 وتعبر عند 80 بالمئة، و C فيها 500,000 وتعبر عند 90 بالمئة. ما نسبة التقليم الكلية؟

Take two of the rates you just read off. L0 pruned to 73% on its own costs about 14 points (93 down to the line at 79). L4 pruned to 80% on its own costs about 16 points. Now prune both at once. L4 was trained on features that flow through a dense L0. Its tolerance to losing 80% of its weights was measured with those features intact, and that condition no longer holds. The network now sees both perturbations at the same time, and the combined drop is usually larger than either single-layer drop, and the chart contains no measurement of it.

خذ نسبتين من النسب التي قرأتها للتو. تقليم L0 إلى 73% وحدها يكلّف نحو 14 نقطة (من 93 نزولًا إلى الخط عند 79). وتقليم L4 إلى 80% وحدها يكلّف نحو 16 نقطة. الآن قلّم الاثنتين معًا. لقد دُرّبت L4 على ميزات (features) تمر عبر L0 كثيفة. وقد قيس تحمّلها لفقدان 80% من أوزانها وتلك الميزات سليمة، وهذا الشرط لم يعد قائمًا. الشبكة الآن ترى الاضطرابين في الوقت نفسه، والهبوط المشترك يكون عادة أكبر من أي من الهبوطين المنفردين، والمخطط لا يحتوي أي قياس له.

ExperimentالتجربةAccuracyالدقةDropالهبوط
L0 pruned to 73%, nothing else touchedتقليم L0 إلى 73% دون المساس بأي طبقة أخرى93 to about 79من 93 إلى نحو 79about 14 points, measured on the chartنحو 14 نقطة، مقيسة على المخطط
L4 pruned to 80%, nothing else touchedتقليم L4 إلى 80% دون المساس بأي طبقة أخرى93 to about 77من 93 إلى نحو 77about 16 points, measured on the chartنحو 16 نقطة، مقيسة على المخطط
Both pruned at onceتقليم الاثنتين معًاnot on any curveغير موجودة على أي منحنىusually more than either single drop, never measured by the sweepعادة أكبر من أي من الهبوطين المنفردين، ولم يقسها المسح أبدًا
Alone versus together, VGG-11 at the read-off ratesمنفردة مقابل مجتمعة، VGG-11 عند النسب المقروءة
Each single-layer bar drops to about T, as its curve promised. The combined bar drops further, into a gap no sweep ever measured. The third bar's level is illustrativeكل عمود لطبقة منفردة يهبط إلى نحو T، كما وعد منحناه. أما العمود المشترك فيهبط أكثر، إلى فجوة لم يقسها أي مسح. مستوى العمود الثالث توضيحي

The slide asks "is this optimal?" and answers itself: "maybe not. We do not consider the interaction between layers." The next slide of the source deck puts it even more directly, "sensitivity analysis ignores the interaction between layers, sub-optimal". The reason is built into the procedure. Each curve is a one-dimensional slice of accuracy along one layer's axis, taken with every other layer frozen dense. The read-off then treats those axes as independent, as if you could add up six separate tolerances and get the tolerance of the whole. Layers are not independent. That is the Layer interaction the heuristic leaves out, and it is why T is only a proxy for the accuracy you will actually get, not a guarantee.

تسأل الشريحة "is this optimal?" (هل هذا أمثل؟) وتجيب نفسها: "maybe not. We do not consider the interaction between layers."، أي ربما لا، فنحن لا نأخذ التفاعل بين الطبقات في الحسبان. والشريحة التالية في العرض الأصلي تقولها بشكل أوضح: "sensitivity analysis ignores the interaction between layers, sub-optimal". السبب مبني في الإجراء نفسه. كل منحنى شريحة أحادية البعد من الدقة على محور طبقة واحدة، مأخوذة وكل الطبقات الأخرى مجمّدة كثيفة. ثم تعامل القراءة تلك المحاور كأنها مستقلة، كأنك تستطيع جمع ست قدرات تحمّل منفصلة لتحصل على تحمّل الكل. لكن الطبقات ليست مستقلة. هذا هو layer interaction (التفاعل بين الطبقات) الذي تُغفله هذه الطريقة التقريبية، ولهذا فإن T مجرد مؤشر تقريبي للدقة التي ستحصل عليها فعلًا، وليست ضمانًا.

Sweep each layer aloneامسح كل طبقة وحدها
6 layers x 9 ratios = 54 runs6 طبقات x 9 نسب = 54 تشغيلًا

Every other layer stays dense while one layer is pruned.

تبقى كل الطبقات الأخرى كثيفة بينما تُقلَّم طبقة واحدة.

six curvesستة منحنيات
Choose T, read six ratesاختر T واقرأ ست نسب
one horizontal lineخط أفقي واحد

Each rate assumes the other five layers are still dense.

كل نسبة تفترض أن الطبقات الخمس الأخرى ما زالت كثيفة.

interaction ignoredالتفاعل مُهمَل
Prune all six at onceقلّم الست معًا
a network no sweep measuredشبكة لم يقسها أي مسح

Losses compound. Fine-tuning recovers some of the gap.

تتراكم الخسائر. ويستعيد الضبط الدقيق (fine-tuning) جزءًا من الفجوة.

Three stages of the heuristic. Interaction is never measured because the sweep and the final prune are different experimentsثلاث مراحل للطريقة التقريبية. التفاعل لا يُقاس أبدًا لأن المسح والتقليم النهائي تجربتان مختلفتان

Why the heuristic ignores interactions on purposeلماذا تتجاهل الطريقة التقريبية التفاعلات عن قصد

The omission is a cost decision, not an oversight. The sweep needs (layers) x (ratios) evaluations, 6 x 9 = 54 here, each a forward pass over the validation set. Measuring every joint setting would need 9^6 = 531,441 evaluations for six layers, and real networks have dozens of layers. The AMC paper says exactly this about hand-crafted rules: "as the layers in deep neural networks are not independent, these rule-based pruning policies are non-optimal, and doesn't transfer from one model to another model", and "the design space has exponential complexity, which is infeasible to be solved by greedy, rule-based methods" (He et al., 2018, section 1). The heuristic trades optimality for a search that finishes in an afternoon.

هذا الإغفال قرار كلفة، لا سهو. يحتاج المسح إلى (عدد الطبقات) x (عدد النسب) من التقييمات، أي 6 x 9 = 54 هنا، وكل تقييم تمرير أمامي (forward pass) على مجموعة التحقق (validation set). أما قياس كل إعداد مشترك فيحتاج إلى 9^6 = 531,441 تقييمًا لست طبقات، والشبكات الحقيقية فيها عشرات الطبقات. وورقة AMC تقول هذا بالضبط عن القواعد المصممة يدويًا: "as the layers in deep neural networks are not independent, these rule-based pruning policies are non-optimal, and doesn't transfer from one model to another model"، أي أن طبقات الشبكات العميقة ليست مستقلة فهذه السياسات القائمة على القواعد ليست مثلى ولا تنتقل من نموذج إلى آخر، و "the design space has exponential complexity, which is infeasible to be solved by greedy, rule-based methods"، أي أن فضاء التصميم أُسّي التعقيد ولا يمكن حله بطرق جشعة (greedy) قائمة على القواعد (He et al., 2018، القسم 1). تقايض هذه الطريقة الأمثلية ببحث ينتهي في فترة ما بعد الظهر.

Two things keep it usable in practice. First, Fine-tuning after pruning (part 06) recovers a large share of the compounded loss, so the read-off does not have to be exact, only in the right region. Second, it is the starting point that the automated methods improve on rather than throw away. NetAdapt removes filters from one layer per iteration, re-measures accuracy after a short fine-tune, and keeps the best proposal, so interactions get folded in one step at a time (Yang et al., 2018). AMC goes further and learns the whole per-layer assignment as one policy, rewarded on the accuracy of the jointly pruned network (He et al., 2018). Both are Automated pruning, and both exist because the single-layer sweep leaves accuracy on the table.

أمران يُبقيانها صالحة للاستخدام عمليًا. الأول أن fine-tuning بعد التقليم (الجزء 06) يستعيد جزءًا كبيرًا من الخسارة المتراكمة، لذلك لا يلزم أن تكون القراءة دقيقة، بل يكفي أن تكون في المنطقة الصحيحة. والثاني أنها نقطة البداية التي تحسّنها الطرق الآلية بدلًا من أن ترميها. فـ NetAdapt تحذف مرشّحات من طبقة واحدة في كل تكرار، وتعيد قياس الدقة بعد ضبط دقيق قصير، وتحتفظ بأفضل اقتراح، فتُدمج التفاعلات خطوة بخطوة (Yang et al., 2018). و AMC تذهب أبعد فتتعلم التوزيع الكامل لكل الطبقات كسياسة (policy) واحدة، مكافأتها دقة الشبكة المقلّمة بشكل مشترك (He et al., 2018). كلتاهما من automated pruning (التقليم الآلي)، وكلتاهما موجودتان لأن المسح على طبقة واحدة يترك دقة ممكنة دون استغلال.

Recall

In one sentence, why is the threshold read-off sub-optimal?في جملة واحدة، لماذا تكون قراءة العتبة دون المثلى؟

Each curve was measured with only that layer pruned, so the accuracy loss of pruning all layers together, which compounds through layer interactions, is never measured.
كل منحنى قيس مع تقليم تلك الطبقة وحدها، لذلك فإن خسارة الدقة الناتجة عن تقليم كل الطبقات معًا، والتي تتراكم عبر تفاعلات الطبقات، لا تُقاس أبدًا.

Recall

How many evaluations does the sweep cost for six layers and nine ratios, and how many would a full joint search cost?كم تقييمًا يكلّف المسح لست طبقات وتسع نسب، وكم سيكلّف بحث مشترك كامل؟

6 x 9 = 54 for the sweep, against 9^6 = 531,441 joint settings. The exponential cost is why the heuristic ignores interactions and why parts 04 and 05 use learning and greedy measurement instead.
6 x 9 = 54 للمسح، مقابل 9^6 = 531,441 إعدادًا مشتركًا. هذه الكلفة الأُسّية هي سبب تجاهل الطريقة التقريبية للتفاعلات، وسبب استخدام الجزأين 04 و 05 للتعلّم والقياس الجشع (greedy) بدلًا منها.

Quick checkاختبار سريع

Why does pruning every layer at its threshold-read rate usually lose more accuracy than T predicts?لماذا يخسر تقليم كل طبقة عند نسبتها المقروءة من العتبة عادةً دقة أكبر مما تتنبأ به T؟

Recapالخلاصة

If you remember nothing elseإن لم تتذكر شيئاً آخر فتذكّر هذا

  • Sensitivity is the slope of a layer's accuracy versus ratio curve. L0 (first conv, 3-channel input) is the most sensitive, L1 the most redundant.الحساسية هي ميل منحنى الدقة مقابل النسبة لكل طبقة. الطبقة L0 (أول طبقة conv، ومدخلها 3 قنوات) هي الأكثر حساسية، و L1 هي الأكثر فائضًا.
  • The threshold rule: r_i is where the curve crosses T. In table form it is the largest swept ratio at or above T; in chart form it is the interpolated crossing between grid points. Layers that never cross T get the maximum swept ratio.قاعدة العتبة: r_i هي النقطة التي يعبر فيها المنحنى T. في صيغة الجدول هي أكبر نسبة مُختبرة دقتها عند T أو أعلى منها، وفي صيغة المخطط هي نقطة العبور المستكملة (interpolated) بين نقاط الشبكة. الطبقات التي لا تعبر T أبدًا تأخذ أكبر نسبة مُختبرة.
  • With T at about 79 to 80 percent (the slide's dashed line) the guides read off roughly 73, 90+, 90+, 82, 80 and 90+ percent for L0 to L5.عندما تكون T نحو 79 إلى 80 بالمئة (الخط المتقطع في الشريحة) تعطي الخطوط الإرشادية تقريبًا 73 و 90+ و 90+ و 82 و 80 و 90+ بالمئة للطبقات من L0 إلى L5.
  • The overall rate is parameter-weighted, not the mean of the six rates. With illustrative VGG-11 counts it is about 86 percent (7.3x) against an unweighted 84 percent.النسبة الكلية موزونة بعدد المعاملات، وليست متوسط النسب الست. باستخدام أعداد توضيحية لـ VGG-11 تبلغ نحو 86 بالمئة (7.3x) مقابل 84 بالمئة للمتوسط غير الموزون.
  • Higher T keeps more weights, lower T prunes more. Tune T until the overall rate hits the target.رفع T يُبقي أوزانًا أكثر، وخفض T يقلّم أكثر. عدّل T حتى تصل النسبة الكلية إلى الهدف.
  • Every curve is a single-layer experiment, so simultaneous pruning compounds losses the chart never measured. T is a proxy and the assignment is sub-optimal.كل منحنى تجربة على طبقة واحدة فقط، لذلك فإن التقليم المتزامن يُراكم خسائر لم يقسها المخطط أبدًا. T مجرد مؤشر تقريبي (proxy) والتوزيع الناتج دون الأمثل.
  • Han et al. used this heuristic successfully (9x on AlexNet, 13x on VGG-16 with iterative retraining). AMC and NetAdapt exist because a better joint assignment exists.استخدم Han et al. هذه الطريقة بنجاح (9x على AlexNet و 13x على VGG-16 مع إعادة تدريب تكرارية). وتوجد AMC و NetAdapt لأن هناك توزيعًا مشتركًا أفضل.

Sourcesالمصادر