Majid Al-RaimiWhy prune: energy, definition and formulationلماذا نقلّم: الطاقة والتعريف والصياغة

COE 592Lecture 4.1المحاضرة 4.1Part 01الجزء 01

Why prune: energy, definition and formulationلماذا نقلّم: الطاقة والتعريف والصياغة

Memory access dominates the energy bill of deep learning, so fewer weights means less data movement; pruning removes synapses and neurons and is posed as minimizing loss under an L0 budget, echoing synaptic pruning in the human brain.الوصول إلى الذاكرة يهيمن على فاتورة الطاقة في التعلم العميق، لذا فإن أوزانًا أقل تعني نقل بيانات أقل؛ التقليم يزيل المشابك (synapses) والعصبونات ويُصاغ بوصفه تقليلًا للخسارة تحت ميزانية L0، على غرار التقليم المشبكي في الدماغ البشري.

Conceptsالمفاهيم
5
Slidesالشرائح
1-6
Readingمدة القراءة
30 min30 دقيقة
Understoodما فهمته
0/5 conceptsمفاهيم

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

Every model you want on an embedded board is limited first by how many weights must be moved, not by how many multiplies the chip can do. One number from this part, 640 pJ for a DRAM access against 3.1 pJ for an integer multiply, justifies the pruning, quantization and sparse-hardware lectures that follow.

This part gives you three tools. A roadmap of the pruning pipeline, which doubles as the checklist for any pruning experiment in your research. The energy argument, which is the answer to the exam question "why is memory rather than arithmetic the bottleneck?". And the formulation of pruning as constrained optimization, which is the standard way to write down what pruning optimizes and why it cannot be solved by gradient descent alone. The part closes with the biological curve that inspired the whole idea.

كل نموذج تريد تشغيله على لوحة مدمجة (embedded board) يحدّه أولًا عدد الأوزان التي يجب نقلها، لا عدد عمليات الضرب التي تستطيع الشريحة تنفيذها. رقم واحد من هذا الجزء، 640 pJ للوصول إلى DRAM مقابل 3.1 pJ لعملية ضرب أعداد صحيحة، يبرّر محاضرات الـ pruning والـ quantization والعتاد المخصص للمصفوفات المتناثرة (sparse hardware) التي تأتي بعده.

يمنحك هذا الجزء ثلاث أدوات. الأولى خريطة طريق لسلسلة الـ pruning، وهي في الوقت نفسه قائمة التحقق لأي تجربة pruning في بحثك. الثانية حجة الطاقة، وهي إجابة سؤال الامتحان «لماذا تكون الذاكرة، لا العمليات الحسابية، هي عنق الزجاجة؟». الثالثة صياغة الـ pruning كمسألة تحسين مقيّدة (constrained optimization)، وهي الطريقة القياسية لكتابة ما يحسّنه الـ pruning ولماذا لا يمكن حلّه بالـ gradient descent وحده. ويُختتم الجزء بالمنحنى البيولوجي الذي ألهم الفكرة كلها.

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

  1. Name the four decisions of the pruning pipeline and say which ones this lecture covers.سمِّ القرارات الأربعة في سلسلة الـ pruning، وحدّد أيها تغطيه هذه المحاضرة.
  2. Reproduce the 45 nm energy ladder and argue with numbers why DRAM traffic, not arithmetic, dominates.أعِد بناء سُلّم الطاقة لتقنية 45 nm، وبرهن بالأرقام لماذا تهيمن حركة البيانات من DRAM، لا العمليات الحسابية.
  3. Distinguish synapse pruning from neuron pruning and state what each does to a layer's weight matrix.ميّز بين pruning الوصلات (synapse pruning) وpruning العصبونات (neuron pruning)، واذكر ما يفعله كلٌّ منهما بمصفوفة أوزان الطبقة.
  4. Write the pruning formulation with a less-or-equal budget, name every symbol, and explain why the L0 constraint forces heuristic criteria.اكتب صياغة الـ pruning بميزانية «أصغر من أو يساوي»، وسمِّ كل رمز فيها، واشرح لماذا يفرض قيد L0 اللجوء إلى معايير تقريبية (heuristic criteria).
  5. Describe the brain's overprovision-then-prune curve and use it as motivation, not as proof, for network pruning.صِف منحنى الدماغ «بناء فائض ثم تقليم»، واستخدمه دافعًا لـ pruning الشبكات العصبية، لا دليلًا عليه.

Suppose you have a trained object detector that is accurate on your validation set but will not fit on the board you are targeting. Before you touch a single weight, four questions need answers, and the outline slide of this lecture is exactly that checklist. It reappears on slides 14 and 26 as a progress marker, so treat it as the map you return to as each section closes.

افترض أن لديك نموذج كشف أجسام (object detector) مدرّبًا ودقيقًا على مجموعة التحقق (validation set)، لكنه لا يتسع على اللوحة التي تستهدفها. قبل أن تلمس وزنًا واحدًا، هناك أربعة أسئلة تحتاج إلى إجابة، وشريحة المخطط العام (outline) في هذه المحاضرة هي قائمة التحقق هذه بالضبط. تعود الشريحة للظهور في الشريحتين 14 و26 كمؤشر للتقدم، فتعامل معها كالخريطة التي ترجع إليها كلما انتهى قسم.

Pruning makes a network smaller by removing the synapses and neurons whose removal hurts performance least. That one sentence hides a sequence of design decisions. First you must formulate the problem: what exactly is being minimized, and under what budget. Then you choose the granularity, the pattern in which weights are removed, from single scattered weights up to whole channels. Then a criterion, the rule that scores which synapses or neurons are least important. Then a ratio, the target sparsity for each layer. Finally you fine-tune or retrain the pruned network so the accuracy you lost comes back.

الـ Pruning (التقليم) يصغّر الشبكة بإزالة الوصلات (synapses) والعصبونات (neurons) التي يضرّ حذفها بالأداء أقل ما يمكن. هذه الجملة الواحدة تخفي سلسلة من قرارات التصميم. أولًا يجب أن تصوغ المسألة: ما الذي نقلّله بالضبط، وتحت أي ميزانية. ثم تختار الـ granularity (درجة التفصيل)، أي النمط الذي تُزال به الأوزان، من أوزان منفردة متفرقة إلى قنوات (channels) كاملة. ثم تختار criterion (معيارًا)، أي القاعدة التي تعطي درجة لكل وصلة أو عصبون لتحديد الأقل أهمية. ثم تختار ratio (نسبة)، أي الـ sparsity المستهدفة لكل طبقة. وأخيرًا تُجري fine-tune أو تعيد تدريب الشبكة بعد التقليم حتى تعود الدقة التي فقدتها.

Formulateالصياغة
This partهذا الجزء

Loss under an L0 budget

الخسارة تحت ميزانية L0

Granularityالدقة الحبيبية
Parts 03 to 04الجزءان 03 و04

What pattern to remove

أي نمط نزيل

Criterionالمعيار
Parts 05 to 06الجزءان 05 و06

Which synapses or neurons

أي المشابك أو العصبونات

Ratioالنسبة
Lecture 04-2المحاضرة 04-2

Sparsity per layer

التناثرية لكل طبقة

Fine-tuneالضبط الدقيق
Lecture 04-2المحاضرة 04-2

Recover the accuracy

استعادة الدقة

The pruning pipeline: the formulation plus four decisions, taught across two lecturesسلسلة الـ pruning: الصياغة ثم أربعة قرارات، تُدرَّس على مدى محاضرتين
DecisionالقرارQuestion the slide asksالسؤال الذي تطرحه الشريحةWhere it is taughtأين يُدرَّس
Formulateالصياغة (Formulate)What is pruning? How should we formulate pruning?ما الـ pruning؟ وكيف نصوغ مسألة الـ pruning؟This partهذا الجزء
Granularityدرجة التفصيل (Granularity)In what pattern should we prune the neural network?بأي نمط نقلّم الشبكة العصبية؟Parts 03 and 04الجزءان 03 و04
Criterionالمعيار (Criterion)What synapses or neurons should we prune?أي الوصلات (synapses) أو العصبونات (neurons) نقلّم؟Parts 05 and 06الجزءان 05 و06
Ratioالنسبة (Ratio)What should target sparsity be for each layer?ما الـ sparsity المستهدفة لكل طبقة؟Lecture 04-2المحاضرة 04-2
Fine-tune or trainالـ fine-tuning أو التدريبHow should we improve performance of pruned models?كيف نحسّن أداء النماذج بعد الـ pruning؟Part 02 previews it; Lecture 04-2يمهّد له الجزء 02؛ والمحاضرة 04-2
The outline slide as a table: each decision, the question the slide attaches to it, and where it is taughtشريحة المخطط العام على شكل جدول: كل قرار، والسؤال الذي تربطه به الشريحة، وأين يُدرَّس

This lecture, Pruning and Sparsity I, covers the formulation, the granularity and the criteria. The ratio and the fine-tuning belong to Pruning and Sparsity II, the next lecture. The split mirrors the two pruning lectures of the MIT course the deck is built on, and it explains why the outline slide is highlighted only at the top: the yellow marker moves down as the lecture proceeds.

هذه المحاضرة، Pruning and Sparsity I، تغطي الصياغة والـ granularity والمعايير. أما النسبة (ratio) والـ fine-tuning فينتميان إلى Pruning and Sparsity II، أي المحاضرة التالية. هذا التقسيم يطابق محاضرتي الـ pruning في مقرر MIT الذي بُني عليه هذا العرض، وهو يفسّر لماذا تكون شريحة المخطط العام مظلّلة في أعلاها فقط: العلامة الصفراء تنزل للأسفل كلما تقدمت المحاضرة.

Recall

What are the four decisions that follow the formulation of pruning, and which of them belong to Lecture 04-2?ما القرارات الأربعة التي تلي صياغة الـ pruning، وأيّها ينتمي إلى المحاضرة 04-2؟

Granularity (in what pattern to prune), criterion (which synapses or neurons to prune), ratio (what target sparsity each layer gets), and fine-tuning or training the pruned network. Ratio and fine-tuning are Lecture 04-2.
الـ granularity (بأي نمط نقلّم)، والمعيار (criterion: أي الوصلات أو العصبونات نقلّم)، والنسبة (ratio: ما الـ sparsity المستهدفة لكل طبقة)، والـ fine-tuning أو تدريب الشبكة بعد التقليم. النسبة والـ fine-tuning من نصيب المحاضرة 04-2.

Take one weight of a fully connected layer. It is fetched from off-chip DRAM and multiplied by an activation. The fetch costs 640 pJ. The 32-bit integer multiply costs 3.1 pJ. Divide them: 640 / 3.1 ≈ 206. Fetching the weight costs as much energy as about two hundred multiplies. That single ratio is the reason this lecture exists.

خذ وزنًا واحدًا من طبقة متصلة بالكامل (fully connected). يُجلب هذا الوزن من ذاكرة DRAM خارج الشريحة ثم يُضرب في قيمة تنشيط (activation). عملية الجلب تكلّف 640 pJ. أما عملية ضرب الأعداد الصحيحة بعرض 32-bit فتكلّف 3.1 pJ. اقسم أحدهما على الآخر: 640 / 3.1 ≈ 206. جلب الوزن يكلّف من الطاقة ما يعادل نحو مئتي عملية ضرب. هذه النسبة الواحدة هي سبب وجود هذه المحاضرة.

The numbers come from Mark Horowitz's ISSCC 2014 keynote, measured for a 45 nm process at 0.9 V, and reproduced in Han et al. (2015), which the slide follows. The full ladder is worth knowing by heart, because it is the quantitative case for every compression technique in this course. Read it top to bottom as an ordering of operations by cost, and notice that the four arithmetic rows and the register file all sit below 4 pJ while the two memory rows, SRAM and DRAM, close the table at 5 pJ and 640 pJ.

هذه الأرقام مأخوذة من الكلمة الرئيسية التي ألقاها Mark Horowitz في ISSCC 2014، وهي مقيسة لتقنية تصنيع 45 nm عند جهد 0.9 V، وأعاد نشرها Han et al. (2015)، وهي الورقة التي تتبعها الشريحة. يستحق السُّلّم كاملًا أن تحفظه عن ظهر قلب، لأنه الحجة الكمية لكل تقنية ضغط في هذا المقرر. اقرأه من الأعلى إلى الأسفل على أنه ترتيب للعمليات بحسب كلفتها، ولاحظ أن صفوف العمليات الحسابية الأربعة وملف المسجلات (register file) كلها أقل من 4 pJ، بينما يُختتم الجدول بصفّي الذاكرة، SRAM وDRAM، عند 5 pJ و640 pJ.

OperationالعمليةEnergyالطاقةRelative to int ADDنسبةً إلى جمع الأعداد الصحيحة int ADD
32-bit int ADDجمع أعداد صحيحة 32-bit int ADD0.1 pJ0.1 pJ1x1x
32-bit float ADDجمع بالفاصلة العائمة 32-bit float ADD0.9 pJ0.9 pJ9x9x
32-bit register fileملف المسجلات 32-bit register file1 pJ1 pJ10x10x
32-bit int MULTضرب أعداد صحيحة 32-bit int MULT3.1 pJ3.1 pJ31x31x
32-bit float MULTضرب بالفاصلة العائمة 32-bit float MULT3.7 pJ3.7 pJ37x37x
32-bit SRAM cacheذاكرة 32-bit SRAM cache5 pJ5 pJ50x50x
32-bit DRAM memoryذاكرة 32-bit DRAM memory640 pJ640 pJ6400x6400x
Rough energy per 32-bit operation, 45 nm, 0.9 V (Horowitz 2014 via Han et al. 2015)الطاقة التقريبية لكل عملية بعرض 32-bit، بتقنية 45 nm وجهد 0.9 V (Horowitz 2014 عبر Han et al. 2015)
Seven energies on a log axis: six short bars for arithmetic and on-chip storage, one bar nearly four decades long for DRAM. The arrow reads off 640 / 3.1, about 206x.سبع قيم للطاقة على محور لوغاريتمي: ستة أعمدة قصيرة للعمليات الحسابية والتخزين داخل الشريحة، وعمود واحد بطول أربع رتب عشرية تقريبًا لـ DRAM. السهم يقرأ 640 / 3.1، أي نحو 206x.

Han et al. summarize the ladder in one sentence: memory access is three orders of magnitude more energy expensive than simple arithmetic. Sze et al. make the same point in their survey: DRAM accesses require up to several orders of magnitude more energy than computation, and DRAM consumes two orders of magnitude more energy per access than a small on-chip memory of a few kilobytes. Measured against the rows of the ladder, one DRAM access costs as much as each of the following.

يلخّص Han et al. السُّلّم في جملة واحدة: الوصول إلى الذاكرة أغلى من العمليات الحسابية البسيطة بثلاث رتب عشرية (orders of magnitude) من حيث الطاقة. ويطرح Sze et al. الفكرة نفسها في مسحهم البحثي: الوصول إلى DRAM يتطلب طاقة أكبر من الحساب بما يصل إلى عدة رتب عشرية، وDRAM تستهلك لكل وصول طاقة أكبر برتبتين عشريتين من ذاكرة صغيرة داخل الشريحة حجمها بضعة كيلوبايتات. وبالمقارنة مع صفوف السُّلّم، فإن وصولًا واحدًا إلى DRAM يكلّف ما يعادل كل واحدة مما يلي.

One 640 pJ DRAM access costs as much as one...وصول واحد إلى DRAM بكلفة 640 pJ يكلّف ما يعادل...

One 32-bit int ADDعملية جمع واحدة لأعداد صحيحة بعرض 32-bit
6400x6400x
One register file readقراءة واحدة من ملف المسجلات (register file)
640x640x
One SRAM cache readقراءة واحدة من ذاكرة SRAM cache
128x128x
One 32-bit int MULTعملية ضرب واحدة لأعداد صحيحة بعرض 32-bit
206x206x
EDRAMEint MULT=640 pJ3.1 pJ≈206\frac{E_{\text{DRAM}}}{E_{\text{int MULT}}} = \frac{640\ \text{pJ}}{3.1\ \text{pJ}} \approx 206
One weight fetch buys about two hundred multipliesجلب وزن واحد يكلّف ما يعادل نحو مئتي عملية ضرب

The slide's icon line, one DRAM stick equals 200 ×+, rounds the chart's arrow: that arrow runs from the DRAM bar to the 32-bit int MULT bar, so the 200 is 640 / 3.1 ≈ 206 rounded down. Pricing one MAC instead (3.1 + 0.1 = 3.2 pJ) gives 640 / 3.2 = 200. Either way the answer is about two hundred.

سطر الأيقونات في الشريحة، حيث شريحة DRAM واحدة تساوي 200 ×+، هو تقريب لسهم المخطط: ذلك السهم يمتد من عمود DRAM إلى عمود ضرب الأعداد الصحيحة 32-bit int MULT، لذا فإن الـ 200 هي 640 / 3.1 ≈ 206 مقرّبة إلى الأسفل. وإذا حسبت كلفة MAC واحدة بدلًا من ذلك (3.1 + 0.1 = 3.2 pJ) تحصل على 640 / 3.2 = 200. في الحالتين الجواب نحو مئتين.

The chain from weights to wattsالسلسلة من الأوزان إلى الواط

The slide states the consequence as a chain: data movement, more memory references, more energy. Every weight that does not fit on chip is a DRAM reference on every inference. A network with more weights moves more bytes, more bytes mean more DRAM references, and each reference costs 640 pJ. The compute, the MACs that the earlier lectures counted so carefully, turns out to be the cheap part. This is the memory access energy problem, and pruning attacks it at the root by reducing the number of weights that have to move at all.

تعرض الشريحة النتيجة على شكل سلسلة: حركة البيانات، فمزيد من مرات الوصول إلى الذاكرة، فمزيد من الطاقة. كل وزن لا يتسع داخل الشريحة يعني وصولًا إلى DRAM في كل عملية استدلال (inference). الشبكة ذات الأوزان الأكثر تنقل بايتات أكثر، والبايتات الأكثر تعني مرات وصول أكثر إلى DRAM، وكل وصول يكلّف 640 pJ. أما الحساب، أي عمليات الـ MAC التي عددناها بعناية في المحاضرات السابقة، فيتضح أنه الجزء الرخيص. هذه هي مشكلة memory access energy (طاقة الوصول إلى الذاكرة)، والـ pruning يعالجها من جذورها بتقليل عدد الأوزان التي يجب نقلها أصلًا.

Worked exampleمثال محلول

A billion connections at 20 frames per second (Han et al. 2015)مليار وصلة بمعدل 20 إطارًا في الثانية (Han et al. 2015)

  1. Count the fetchesعُدّ عمليات الجلب

    A network with 1,000,000,000 connections run at 20 Hz fetches every weight twenty times a second: 2 × 10^10 DRAM references per second.
    شبكة فيها 1,000,000,000 وصلة تعمل بتردد 20 Hz تجلب كل وزن عشرين مرة في الثانية: أي 2 × 10^10 وصول إلى DRAM في الثانية.
  2. Price each fetchاحسب كلفة كل عملية جلب

    2 × 10^10 × 640 pJ = 12.8 J every second, so 12.8 W.
    2 × 10^10 × 640 pJ = 12.8 J في كل ثانية، أي 12.8 W.
  3. Resultالنتيجة

    12.8 W for DRAM traffic alone, before a single multiply is counted. Han et al. call this well beyond the power envelope of a typical mobile device.
    12.8 W لحركة البيانات من DRAM وحدها، قبل احتساب عملية ضرب واحدة. ويصف Han et al. هذا الرقم بأنه يتجاوز بكثير حدود الطاقة المتاحة لجهاز محمول نموذجي.

Worked exampleمثال محلول

One layer of a million fp32 weights, before and after 90 percent pruningطبقة واحدة بمليون وزن fp32، قبل pruning بنسبة 90 بالمئة وبعده

  1. Dense: memoryالكثيفة (dense): الذاكرة

    10^6 weights fetched once each from DRAM: 10^6 × 640 pJ = 640 µJ.
    10^6 وزن يُجلب كل منها مرة واحدة من DRAM: 10^6 × 640 pJ = 640 µJ.
  2. Dense: arithmeticالكثيفة (dense): الحساب

    One float multiply and one float add per weight: 10^6 × (3.7 + 0.9) pJ = 4.6 µJ.
    عملية ضرب واحدة وعملية جمع واحدة بالفاصلة العائمة (float) لكل وزن: 10^6 × (3.7 + 0.9) pJ = 4.6 µJ.
  3. Dense: shareالكثيفة (dense): الحصة

    640 / 644.6 ≈ 0.993. Memory is 99.3% of the layer's energy, and the ratio of memory to arithmetic is 640 / 4.6 ≈ 139.
    640 / 644.6 ≈ 0.993. الذاكرة تمثّل 99.3% من طاقة الطبقة، ونسبة الذاكرة إلى الحساب هي 640 / 4.6 ≈ 139.
  4. Pruned: keep 100,000 weightsبعد الـ pruning: نُبقي 100,000 وزن

    Fetch 10^5 × 640 pJ = 64 µJ, compute 10^5 × 4.6 pJ = 0.46 µJ.
    الجلب 10^5 × 640 pJ = 64 µJ، والحساب 10^5 × 4.6 pJ = 0.46 µJ.
  5. Resultالنتيجة

    Total drops from 644.6 µJ to 64.46 µJ, about 10x, ignoring the index overhead of a sparse format, which Part 03 reintroduces.
    ينخفض المجموع من 644.6 µJ إلى 64.46 µJ، أي نحو 10x، مع تجاهل كلفة الفهارس (index overhead) في صيغة التخزين المتناثرة (sparse format)، وهي كلفة يعيد الجزء 03 إدخالها.
QuantityالكميةDense, 10^6 weightsكثيفة، 10^6 وزنPruned, 10^5 weightsبعد الـ pruning، 10^5 وزن
DRAM fetch energyطاقة الجلب من DRAM640 µJ640 µJ64 µJ64 µJ
MAC energyطاقة عمليات الـ MAC4.6 µJ4.6 µJ0.46 µJ0.46 µJ
Total per inferenceالمجموع لكل عملية استدلال644.6 µJ644.6 µJ64.46 µJ64.46 µJ
Share from memoryحصة الذاكرة99.3%99.3%99.3%99.3%
The same layer dense and 90 percent prunedالطبقة نفسها كثيفة، وبعد pruning بنسبة 90 بالمئة

There is a second payoff hiding in the ladder. Once a pruned model is small enough, its weights stop living in DRAM at all and sit in on-chip SRAM, where an access costs 5 pJ instead of 640 pJ. That is the argument of Deep Compression: pruning plus quantization shrinks both networks to a few megabytes, small enough to fit in on-chip SRAM cache rather than off-chip DRAM.

هناك مكسب ثانٍ مخفي في السُّلّم. حين يصبح النموذج بعد الـ pruning صغيرًا بما يكفي، تتوقف أوزانه عن الإقامة في DRAM أصلًا وتستقر في ذاكرة SRAM داخل الشريحة، حيث يكلّف الوصول 5 pJ بدلًا من 640 pJ. هذه هي حجة Deep Compression: الـ pruning مع الـ quantization يقلّصان كلتا الشبكتين إلى بضعة ميغابايتات، وهو حجم صغير بما يكفي ليتسع في ذاكرة SRAM cache داخل الشريحة بدلًا من DRAM خارجها.

ModelالنموذجBeforeقبلAfterبعدRatioالنسبة
AlexNetAlexNet240 MB240 MB6.9 MB6.9 MB35x35x
VGG-16VGG-16552 MB552 MB11.3 MB11.3 MB49x49x
Model size before and after Deep Compression (Han, Mao and Dally 2016)حجم النموذج قبل Deep Compression وبعده (Han وMao وDally 2016)

Separately, benchmarking the pruned fully connected layers on CPU, GPU and mobile GPU measured 3x to 7x less energy per layer. Fewer weights is the first win; crossing the SRAM boundary is the second.

وبشكل منفصل، أظهر قياس أداء الطبقات المتصلة بالكامل بعد الـ pruning على CPU وGPU وGPU المحمول انخفاضًا في الطاقة لكل طبقة بين 3x و7x. تقليل الأوزان هو المكسب الأول؛ وعبور حد SRAM هو المكسب الثاني.

SimulatorمحاكيMemory energy budget: weights, sparsity and where they liveميزانية طاقة الذاكرة: الأوزان والتناثر وأين تُخزَّن
Presets
each kept weight is fetched once per inference and used in one MAC (4.6 pJ)يُجلب كل وزن محتفظ به مرة واحدة في كل استدلال ويُستخدم في عملية MAC واحدة (4.6 pJ)
Energy per inferenceالطاقة لكل استدلال39.32mJ61 M kept weights × (640 pJ + 4.6 pJ)61 M وزنًا محتفظًا به × (640 pJ + 4.6 pJ)
Power at 20 Hz786.41mWmemory alone 780.8 mWالذاكرة وحدها 780.8 mW
Share spent on memoryحصة الذاكرة من الطاقة99.3%39.04 mJ of 39.32 mJ39.04 mJ من أصل 39.32 mJ
Model size (fp32)حجم النموذج (fp32)244MBvs dense in DRAM: 1x less energyمقارنةً بالنموذج الكثيف في DRAM: طاقة أقل بمقدار 1x

Figures are the slide's 45 nm, 0.9 V numbers from 2014 and ignore activation traffic and the index overhead of storing a sparse matrix. The 1 B at 20 Hz preset reproduces Han et al.'s memory-only estimate of 12.8 W (the total adds 0.09 W of MACs).الأرقام هي أرقام الشريحة لتقنية 45 nm عند 0.9 V من عام 2014، وهي تتجاهل حركة بيانات الـ activations وكلفة الفهارس الإضافية لتخزين مصفوفة متناثرة. الإعداد المسبق 1 B at 20 Hz يعيد إنتاج تقدير Han et al. للذاكرة وحدها وهو 12.8 W (ويضيف الإجمالي 0.09 W لعمليات MAC).

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

Using the slide's 45 nm figures, about how many 32-bit integer multiplies cost the same energy as one 32-bit DRAM access?باستخدام أرقام الشريحة لتقنية 45 nm، كم عملية ضرب لأعداد صحيحة بعرض 32-bit تكلّف تقريبًا الطاقة نفسها التي يكلّفها وصول واحد إلى DRAM بعرض 32-bit؟

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

According to slide 3, what is the primary motivation for pruning a network?بحسب الشريحة 3، ما الدافع الأساسي لتقليم (pruning) شبكة عصبية؟

Recall

One DRAM access versus one 32-bit integer multiply in 45 nm: give the two energies and the ratio. What is the ratio against an integer add?وصول واحد إلى DRAM مقابل ضرب واحد لأعداد صحيحة بعرض 32-bit في تقنية 45 nm: اذكر الطاقتين والنسبة. وما النسبة مقارنة بجمع الأعداد الصحيحة؟

640 pJ versus 3.1 pJ, so 640 / 3.1 ≈ 206, about 200x. Against the 0.1 pJ integer add it is 6400x.
640 pJ مقابل 3.1 pJ، إذن 640 / 3.1 ≈ 206، أي نحو 200x. ومقارنة بجمع الأعداد الصحيحة الذي يكلّف 0.1 pJ تكون النسبة 6400x.

The slide's before-and-after picture, taken from Han et al. (2015), is a small fully connected network with layers of 5, 4, 3 and 2 nodes. Count the edges: 5 × 4 + 4 × 3 + 3 × 2 = 20 + 12 + 6 = 38 synapses and 14 neurons. After pruning the layers read 5, 3, 2, 2. One hidden neuron is gone from the second layer, one from the third, and most of the remaining edges have vanished. Two different things were removed, and the slide labels them with two different arrows.

صورة «قبل وبعد» في الشريحة، المأخوذة من Han et al. (2015)، هي شبكة صغيرة متصلة بالكامل طبقاتها فيها 5, 4, 3 و2 عقد. عُدّ الحواف: 5 × 4 + 4 × 3 + 3 × 2 = 20 + 12 + 6 = 38 وصلة (synapse) و14 عصبونًا. بعد الـ pruning تصبح الطبقات 5, 3, 2, 2. اختفى عصبون مخفي واحد من الطبقة الثانية، وآخر من الثالثة، واختفت معظم الحواف المتبقية. أُزيل شيئان مختلفان، والشريحة تسمّيهما بسهمين مختلفين.

First the synapses: thirteen of the 38 edges fade while every node stays. Then the neurons: one node in each hidden layer collapses and the thirteen edges still attached to them go with it, leaving exactly the slide's 5-3-2-2 network with its twelve edges.أولًا الوصلات: ثلاث عشرة حافة من أصل 38 تتلاشى بينما تبقى كل العقد. ثم العصبونات: تنهار عقدة واحدة في كل طبقة مخفية وتذهب معها الحواف الثلاث عشرة التي ما زالت متصلة بها، فيبقى بالضبط شبكة الشريحة 5-3-2-2 بحوافها الاثنتي عشرة.

A synapse is one weight w_ij, one edge between neuron j of one layer and neuron i of the next. Synapse pruning sets that single entry to zero, and the neurons at both ends survive with one fewer connection. A neuron is a node. Neuron pruning removes the node and therefore every edge incident to it at once: all of its incoming weights and all of its outgoing weights. Nothing about the neuron remains, so nothing that fed it or read from it needs to exist either.

الوصلة (synapse) هي وزن واحد w_ij، أي حافة واحدة بين العصبون j في طبقة والعصبون i في الطبقة التالية. الـ Synapse pruning يجعل هذا العنصر الواحد صفرًا، ويبقى العصبونان على طرفيه مع وصلة أقل بواحدة. أما العصبون فهو عقدة. الـ Neuron pruning يزيل العقدة، وبالتالي يزيل دفعة واحدة كل حافة متصلة بها: كل أوزانها الداخلة وكل أوزانها الخارجة. لا يبقى شيء من العصبون، لذا لا حاجة لوجود أي شيء كان يغذّيه أو يقرأ منه.

The matrix view makes the difference concrete. A linear layer holds its weights in a matrix W of shape [out, in], one row per output neuron and one column per input neuron. Synapse pruning zeroes scattered entries of that matrix, and the matrix keeps its shape; the result is a sparse matrix that must be stored with indices to say where the survivors are. Neuron pruning deletes a whole row of this layer's W(the neuron's inputs) and the matching column of the next layer's W (its outputs); both matrices become smaller dense matrices with no bookkeeping at all. This is the seed of the granularity spectrum in Part 03: fine-grained pruning lives at the synapse end and coarse-grained pruning at the neuron end.

النظر إلى المصفوفات يجعل الفرق ملموسًا. الطبقة الخطية (linear layer) تحفظ أوزانها في مصفوفة W شكلها [out, in]، صف لكل عصبون خرج وعمود لكل عصبون دخل. الـ synapse pruning يصفّر عناصر متفرقة من هذه المصفوفة، وتحتفظ المصفوفة بشكلها؛ والنتيجة مصفوفة متناثرة (sparse) يجب تخزينها مع indices (فهارس) توضّح أين توجد القيم الباقية. أما الـ neuron pruning فيحذف صفًا كاملًا من W في هذه الطبقة (مداخل العصبون) والعمود المقابل من W في الطبقة التالية (مخارجه)؛ فتصبح المصفوفتان مصفوفتين كثيفتين (dense) أصغر دون أي حسابات إضافية لتتبع المواقع. هذه هي بذرة طيف الـ granularity في الجزء 03: الـ fine-grained pruning يقع عند طرف الوصلات، والـ coarse-grained pruning عند طرف العصبونات.

Worked exampleمثال محلول

Same number of weights removed, two different resultsالعدد نفسه من الأوزان المحذوفة، ونتيجتان مختلفتان

  1. The setupالإعداد

    Layer one has 4 inputs and 3 outputs, so W_1 is 3 × 4 = 12 weights. Layer two takes those 3 outputs to 2, so W_2 is 2 × 3 = 6 weights.
    الطبقة الأولى لها 4 مداخل و3 مخارج، إذن W_1 فيها 3 × 4 = 12 وزنًا. الطبقة الثانية تأخذ هذه المخارج الـ 3 إلى 2، إذن W_2 فيها 2 × 3 = 6 أوزان.
  2. Option A: prune 6 synapsesالخيار A: تقليم 6 وصلات

    Zero six entries of W_1. It still has 3 rows and 4 columns, with six zeros scattered inside. Every neuron still exists.
    صفّر ستة عناصر من W_1. تبقى فيها 3 صفوف و4 أعمدة، مع ستة أصفار متفرقة بداخلها. كل عصبون ما زال موجودًا.
  3. Option B: prune neuron 2 of layer oneالخيار B: تقليم العصبون 2 من الطبقة الأولى

    Delete row 2 of W_1 (4 weights) and column 2 of W_2 (2 weights): 4 + 2 = 6 weights gone.
    احذف الصف 2 من W_1 (4 أوزان) والعمود 2 من W_2 (وزنان، 2): 4 + 2 = 6 أوزان حُذفت.
  4. Resultالنتيجة

    Both options remove six weights. Option A leaves a sparse 3 × 4 matrix. Option B leaves dense 2 × 4 and 2 × 2 matrices that any hardware multiplies at full speed.
    كلا الخيارين يزيل ستة أوزان. الخيار A يترك مصفوفة متناثرة 3 × 4. الخيار B يترك مصفوفتين كثيفتين 2 × 4 و2 × 2 يضربهما أي عتاد بسرعته الكاملة.
ChoiceالخيارWeights removedالأوزان المزالةShapes afterالأشكال بعد ذلكSparse or denseمتناثرة أم كثيفة
Prune 6 synapsesتقليم 6 وصلات663 × 4 and 2 × 3, unchanged3 × 4 و2 × 3، دون تغييرSparse: 6 zeros scattered inside a 3 × 4 matrixمتناثرة (sparse): 6 أصفار متفرقة داخل مصفوفة 3 × 4
Prune neuron 2تقليم العصبون 24 + 2 = 64 + 2 = 62 × 4 and 2 × 22 × 4 and 2 × 2Dense: both matrices simply got smallerكثيفة (dense): المصفوفتان صغرتا ببساطة
Six weights removed, two waysستة أوزان تُزال بطريقتين

Han et al. describe the effect of synapse pruning on a layer in one line: this pruning converts a dense, fully-connected layer to a sparse layer. They also stress that retraining the surviving weights is critical, because zeroing connections drops accuracy immediately. Part 02 shows that curve and how fine-tuning recovers it.

يصف Han et al. أثر الـ synapse pruning على الطبقة في سطر واحد: هذا الـ pruning يحوّل الطبقة الكثيفة المتصلة بالكامل إلى طبقة متناثرة. ويؤكدون أيضًا أن إعادة تدريب الأوزان الباقية أمر حاسم، لأن تصفير الوصلات يُسقط الدقة فورًا. الجزء 02 يعرض هذا المنحنى وكيف يستعيده الـ fine-tuning.

  • Synapse pruning: unit is one weight, neurons survive, the matrix keeps its shape but becomes sparse.Synapse pruning: الوحدة وزن واحد، والعصبونات تبقى، والمصفوفة تحتفظ بشكلها لكنها تصبح متناثرة.
  • Neuron pruning: unit is one node, all incident weights go, a row and a column disappear, matrices stay dense.Neuron pruning: الوحدة عقدة واحدة، وكل الأوزان المتصلة بها تُحذف، ويختفي صف وعمود، وتبقى المصفوفات كثيفة.
  • Both reduce the number of weights that must be fetched; only the second reduces it in a shape hardware likes.كلاهما يقلّل عدد الأوزان التي يجب جلبها؛ لكن الثاني وحده يقلّله بشكل يناسب العتاد.

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

Which statement about pruning one hidden neuron is correct?أي العبارات التالية صحيحة بشأن تقليم عصبون مخفي واحد؟

Recall

A 3 × 4 linear layer feeds a 2 × 3 layer. You prune neuron 2 of the first layer. How many weights vanish, and what shapes remain?طبقة خطية 3 × 4 تغذّي طبقة 2 × 3. قلّمت العصبون 2 من الطبقة الأولى. كم وزنًا يختفي، وما الأشكال المتبقية؟

Row 2 of the first matrix (4 weights) and column 2 of the second (2 weights): 6 weights. The layers become 2 × 4 and 2 × 2, both still dense.
الصف 2 من المصفوفة الأولى (4 أوزان) والعمود 2 من الثانية (وزنان، 2): المجموع 6 أوزان. تصبح الطبقتان 2 × 4 و2 × 2، وكلتاهما ما زالت كثيفة.

Start with a weight vector small enough to see whole: W = [0.8, -0.05, 0.3, -0.01]. It has four nonzero entries. Give yourself a budget of two. One candidate is W_P = [0.8, 0, 0.3, 0], which has exactly two nonzeros. Is it the best candidate? That depends on the training loss it produces, and the pruning formulation on the slide is precisely the question: among all weight vectors with at most two nonzeros, which one makes the loss smallest?

ابدأ بمتجه أوزان صغير بما يكفي لتراه كاملًا: W = [0.8, -0.05, 0.3, -0.01]. فيه أربعة عناصر غير صفرية. ضع لنفسك ميزانية من عنصرين. أحد المرشحين هو W_P = [0.8, 0, 0.3, 0]، وفيه عنصران غير صفريين بالضبط. هل هو أفضل مرشح؟ يعتمد ذلك على قيمة دالة الخسارة (loss) التي ينتجها في التدريب، وpruning formulation (صياغة الـ pruning) في الشريحة هي هذا السؤال بالضبط: من بين كل متجهات الأوزان التي فيها عنصران غير صفريين على الأكثر، أيّها يجعل الخسارة أصغر ما يمكن؟

arg⁡min⁡W  L(x; W)\underset{\mathbf{W}}{\arg\min}\; L(\mathbf{x};\, \mathbf{W})
Ordinary training: minimize the loss with no constraint on the weightsالتدريب العادي: تقليل الخسارة دون قيد على الأوزان
arg⁡min⁡WP  L(x; WP)s.t.∥WP∥0≤N\underset{\mathbf{W}_P}{\arg\min}\; L(\mathbf{x};\, \mathbf{W}_P) \quad \text{s.t.} \quad \lVert \mathbf{W}_P \rVert_0 \le N
Pruning: the same loss, but only weight vectors with at most N nonzeros are admissibleالتقليم (pruning): الخسارة نفسها، لكن لا يُقبل إلا متجه أوزان فيه N قيمة غير صفرية على الأكثر

The left half of the slide figure is ordinary training: pick W to minimize L, with the whole dense network available. The right half adds one line. The search variable becomes W_P, the pruned weights, and a constraint limits how many of its entries may be nonzero. Everything else, the loss, the data, the architecture, is unchanged. Pruning is training with a budget.

النصف الأيسر من شكل الشريحة هو التدريب العادي: اختر W بحيث تقلّل L، والشبكة الكثيفة كلها متاحة. النصف الأيمن يضيف سطرًا واحدًا. يصبح متغير البحث W_P، أي الأوزان بعد الـ pruning، ويحدّ قيدٌ عدد عناصره التي يُسمح أن تكون غير صفرية. كل ما عدا ذلك، أي الخسارة والبيانات والمعمارية، يبقى دون تغيير. الـ pruning هو تدريب بميزانية.

Every symbol in the formulationكل رمز في الصياغة

L
The training objective (the loss), unchanged from ordinary trainingهدف التدريب (دالة الخسارة loss)، دون تغيير عن التدريب العادي
x
The input data the loss is evaluated onبيانات الدخل التي تُحسب عليها الخسارة
W
The original dense weights the network was trained withالأوزان الكثيفة (dense) الأصلية التي دُرّبت بها الشبكة
W_P
The pruned weights, the thing we search overالأوزان بعد الـ pruning، وهي ما نبحث فيه
||W_P||_0
The count of nonzero entries in W_P, the L0 pseudo-normعدد العناصر غير الصفرية في W_P، أي الـ L0 pseudo-norm (شبه المعيار)
N
The target number of nonzeros, the budget the pruned model must respectالعدد المستهدف من العناصر غير الصفرية، أي الميزانية التي يجب أن يلتزم بها النموذج بعد الـ pruning
A 4 × 6 weight matrix under a budget of N = 8. The sixteen smallest magnitudes are zeroed one rank at a time, the eight largest survive, and the counter drops from 24 nonzeros to 8: a hard count constraint being met, not a soft shrink.مصفوفة أوزان 4 × 6 تحت ميزانية N = 8. تُصفَّر القيم الست عشرة الأصغر من حيث المقدار (magnitude) واحدة تلو الأخرى بحسب الترتيب، وتبقى الثماني الأكبر، وينخفض العداد من 24 عنصرًا غير صفري إلى 8: قيد عدّ صارم يُستوفى، لا تقليص ناعم للقيم.

Why the constraint needs heuristicsلماذا يحتاج القيد إلى حلول تقريبية (heuristics)

The L0 norm counts nonzeros, and despite its name it is not a norm at all. A norm must scale with its argument, so that doubling the vector doubles the norm. Doubling our example gives ||2W||_0 = 4 = ||W||_0, not 8. Worse, as a function of the weights it is piecewise constant: nudge any nonzero weight and the count does not change, so the gradient is zero almost everywhere and undefined exactly at zero. Louizos, Welling and Kingma state it plainly: the L0 norm of weights is non-differentiable, so it cannot be incorporated directly as a regularization term. Gradient descent, the only tool that scales to millions of weights, gets no signal from the constraint.

الـ L0 norm يعدّ العناصر غير الصفرية، ورغم اسمه فهو ليس norm أصلًا. يجب أن يتناسب الـ norm مع مدخله، بحيث يتضاعف عند مضاعفة المتجه. لكن مضاعفة مثالنا تعطي ||2W||_0 = 4 = ||W||_0، لا 8. والأسوأ أنه كدالة في الأوزان ثابت على فترات (piecewise constant): حرّك أي وزن غير صفري قليلًا ولن يتغير العدد، لذا فالـ gradient صفر في كل مكان تقريبًا وغير معرّف عند الصفر بالضبط. ويقولها Louizos وWelling وKingma بوضوح: الـ L0 norm للأوزان غير قابل للاشتقاق، لذا لا يمكن إدخاله مباشرة كحد regularization. والـ gradient descent، وهو الأداة الوحيدة التي تتوسع لملايين الأوزان، لا يتلقى أي إشارة من هذا القيد.

The constraint is also combinatorial. Choosing which N of the |W| entries survive is a subset selection. With 16 weights and a budget of 8 there are C(16, 8) = 12,870 masks to compare, each requiring a retrained loss to evaluate. With a million weights and a budget of a hundred thousand the count is astronomically large. Exact search is out of the question.

والقيد أيضًا توافقي (combinatorial). اختيار أي N من بين |W| عنصرًا سيبقى هو مسألة اختيار مجموعة جزئية (subset selection). مع 16 وزنًا وميزانية 8 هناك C(16, 8) = 12,870 من الـ masks (الأقنعة) للمقارنة، وكل منها يتطلب حساب الخسارة بعد إعادة التدريب لتقييمه. ومع مليون وزن وميزانية مئة ألف يصبح العدد ضخمًا بشكل فلكي. البحث الدقيق غير وارد إطلاقًا.

So the field replaces the exact problem by the pipeline of the first concept. A criterion assigns each weight or neuron an importance score, such as its magnitude |w|, and the least important are zeroed; that is a greedy stand-in for the search over masks. A ratio fixes N for each layer; that is the budget. Fine-tuning then re-minimizes L over the surviving entries, which is the only part gradient descent can do. The formulation is exact; everything after it is an approximation, and the quality of the approximation is what the rest of this lecture and the next are about.

لذلك يستبدل المجال المسألة الدقيقة بسلسلة الخطوات في المفهوم الأول. الـ criterion (المعيار) يعطي كل وزن أو عصبون درجة أهمية، مثل مقداره |w|، ويُصفَّر الأقل أهمية؛ وهذا بديل جشع (greedy) للبحث في كل الأقنعة. والـ ratio (النسبة) يحدد N لكل طبقة؛ وهذه هي الميزانية. ثم يعيد الـ fine-tuning تقليل L على العناصر الباقية، وهو الجزء الوحيد الذي يستطيع الـ gradient descent القيام به. الصياغة دقيقة؛ وكل ما بعدها تقريب، وجودة هذا التقريب هي موضوع بقية هذه المحاضرة والمحاضرة التالية.

From N to sparsityمن N إلى الـ sparsity

sparsity=1−N∣W∣\text{sparsity} = 1 - \frac{N}{|\mathbf{W}|}
The fraction of weights that are zero, equal to the pruning ratio when everything below the budget is removedنسبة الأوزان الصفرية، وهي تساوي نسبة التقليم حين يُزال كل ما هو دون الميزانية

Worked exampleمثال محلول

AlexNet under Han et al. (2015)AlexNet وفق Han et al. (2015)

  1. Countالعدّ

    AlexNet has |W| = 61 M parameters. Han et al. prune it to N = 6.7 M.
    في AlexNet عدد |W| = 61 M من المعاملات. يقلّمها Han et al. إلى N = 6.7 M.
  2. Sparsityالـ sparsity

    1 - 6.7 / 61 = 1 - 0.11 = 0.89, so 89% of the weights are zero.
    1 - 6.7 / 61 = 1 - 0.11 = 0.89، إذن 89% من الأوزان أصفار.
  3. Resultالنتيجة

    89% sparsity, a pruning ratio of 89%, and 61 / 6.7 ≈ 9x fewer parameters, with no loss of accuracy after retraining.
    sparsity بنسبة 89%، ونسبة pruning قدرها 89%، ومعاملات أقل بـ 61 / 6.7 ≈ 9x، دون أي خسارة في الدقة بعد إعادة التدريب.

In the tiny example, keeping 2 of 4 entries is 50% sparsity; the mask visual above keeps 8 of 24, which is 67%. The glossary defines the pruning ratio as the percentage of parameters pruned away, and when every zero comes from pruning the two quantities coincide.

في المثال الصغير، إبقاء 2 من 4 عناصر يعني sparsity بنسبة 50%؛ والشكل التوضيحي للقناع أعلاه يُبقي 8 من 24، أي 67%. يعرّف المسرد (glossary) نسبة الـ pruning بأنها النسبة المئوية للمعاملات التي أُزيلت، وحين يكون كل صفر ناتجًا عن الـ pruning تتطابق الكميتان.

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

In argmin over W_P of L(x; W_P) subject to ||W_P||_0 <= N, what does N stand for?في الصياغة argmin على W_P للدالة L(x; W_P) بشرط ||W_P||_0 <= N، إلامَ يرمز N؟

Recall

Why can gradient descent not handle the L0 constraint directly, and what replaces it in practice?لماذا لا يستطيع الـ gradient descent التعامل مع قيد L0 مباشرة، وما الذي يحل محله عمليًا؟

||W||_0 is piecewise constant, so its gradient is zero almost everywhere and undefined at zero, and it is not a true norm since ||2W||_0 = ||W||_0. Practical methods score importance with a criterion and fix N per layer with a ratio, then fine-tune the survivors.
||W||_0 ثابت على فترات، لذا فالـ gradient الخاص به صفر في كل مكان تقريبًا وغير معرّف عند الصفر، وهو ليس norm حقيقيًا لأن ||2W||_0 = ||W||_0. الطرق العملية تقيّم الأهمية بمعيار (criterion) وتحدد N لكل طبقة بنسبة (ratio)، ثم تُجري fine-tuning للأوزان الباقية.

Recall

Write the pruning formulation and name each symbol.اكتب صياغة الـ pruning وسمِّ كل رمز.

argmin over W_P of L(x; W_P) subject to ||W_P||_0 ≤ N. L is the training loss, x the input, W the original weights, W_P the pruned weights, ||.||_0 the count of nonzeros, and N the target number of nonzeros.
argmin على W_P للدالة L(x; W_P) بشرط ||W_P||_0 ≤ N. L هي خسارة التدريب، وx المدخلات، وW الأوزان الأصلية، وW_P الأوزان بعد الـ pruning، و||.||_0 عدد العناصر غير الصفرية، وN العدد المستهدف من العناصر غير الصفرية.

A newborn's cortical neuron carries about 2,500 synapses. By the age of two to four the figure is near 15,000. An adult settles around 7,000. The brain grows to six times its newborn connection count, then removes more than half of that peak. Growth to a peak, then elimination: the curve on the slide is the shape of train-dense-then-prune, drawn by biology decades before anyone pruned a neural network.

يحمل العصبون القشري لدى المولود نحو 2,500 وصلة (synapse). وبين عمر سنتين وأربع سنوات يقترب الرقم من 15,000. ثم يستقر لدى البالغ عند نحو 7,000. ينمو الدماغ حتى يصل إلى ستة أضعاف عدد وصلاته عند الولادة، ثم يزيل أكثر من نصف تلك القمة. نمو حتى قمة، ثم إزالة: المنحنى في الشريحة هو شكل «درّب الشبكة كثيفة ثم قلّمها»، رسمته البيولوجيا قبل عقود من أن يقلّم أحد شبكة عصبية.

Synapses per neuron against age, using the slide's figures: 2,500 at birth, a peak of 15,000 at two to four years, 7,000 in adulthood. The shaded region is what pruning removed.عدد الوصلات لكل عصبون مقابل العمر، بأرقام الشريحة: 2,500 عند الولادة، وقمة 15,000 بين سنتين وأربع سنوات، و7,000 في البلوغ. المنطقة المظلّلة هي ما أزاله التقليم.

The three numbers on the slideالأرقام الثلاثة في الشريحة

Newbornالمولود
about 2,500 synapses per neuronنحو 2,500 وصلة لكل عصبون
2 to 4 yearsمن سنتين إلى أربع سنوات
peak, about 15,000 synapses per neuronالقمة، نحو 15,000 وصلة لكل عصبون
Adultالبالغ
about 7,000 synapses per neuronنحو 7,000 وصلة لكل عصبون

Worked exampleمثال محلول

How much the brain overprovisions and removesكم يبني الدماغ من فائض، وكم يزيل

  1. Growthالنمو

    15,000 / 2,500 = 6x more synapses per neuron at the peak than at birth.
    15,000 / 2,500 = 6x وصلات أكثر لكل عصبون عند القمة مقارنة بالولادة.
  2. Eliminationالإزالة

    (15,000 - 7,000) / 15,000 = 8,000 / 15,000 ≈ 0.53, so about 53% of the peak is pruned away.
    (15,000 - 7,000) / 15,000 = 8,000 / 15,000 ≈ 0.53، إذن يُزال نحو 53% من القمة.
  3. Resultالنتيجة

    Adults keep roughly 47% of their peak synapses. Using the slide's illustrative figures, in the vocabulary of the previous concept the brain runs at about 53% sparsity relative to its own dense peak.
    يحتفظ البالغون بنحو 47% من وصلاتهم عند القمة. وباستخدام أرقام الشريحة التوضيحية، وبمصطلحات المفهوم السابق، يعمل الدماغ بـ sparsity تقارب 53% مقارنة بقمته الكثيفة الخاصة.

This is synaptic pruning, and Han et al. invoke it in the introduction of the paper the slide follows: their method learns the network connectivity in addition to the weights, much as in the mammalian brain, where synapses are created in the first few months of a child's development, followed by gradual pruning of little-used connections, falling to typical adult values. The parallel to the pipeline is exact in shape. Overprovision (train a large dense network), score by use (the criterion), remove the weak connections (prune), and let the remaining ones strengthen (fine-tune).

هذا هو synaptic pruning (التقليم المشبكي)، ويستشهد به Han et al. في مقدمة الورقة التي تتبعها الشريحة: طريقتهم تتعلم بنية اتصال الشبكة إضافة إلى الأوزان، تمامًا كما في دماغ الثدييات، حيث تُنشأ الوصلات في الأشهر الأولى من نمو الطفل، ثم يتبعها تقليم تدريجي للوصلات قليلة الاستخدام، فتنخفض إلى القيم المعتادة لدى البالغين. والتوازي مع سلسلة الخطوات دقيق في شكله. بناء فائض (درّب شبكة كثيفة كبيرة)، ثم تقييم بحسب الاستخدام (المعيار)، ثم إزالة الوصلات الضعيفة (الـ pruning)، ثم ترك الوصلات الباقية تتقوّى (fine-tune).

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

Using slide 6's figures, roughly what fraction of the peak synapses per neuron is eliminated by adulthood?باستخدام أرقام الشريحة 6، ما الكسر التقريبي من وصلات القمة لكل عصبون الذي يُزال بحلول البلوغ؟

Recall

Give the synapses per neuron at birth, at the peak and in adulthood from slide 6, and the fraction eliminated between peak and adult.اذكر عدد الوصلات لكل عصبون عند الولادة وعند القمة وفي البلوغ بحسب الشريحة 6، والنسبة التي تُزال بين القمة والبلوغ.

About 2,500 at birth, 15,000 at two to four years, 7,000 in adults. 8,000 / 15,000 ≈ 53% eliminated.
نحو 2,500 عند الولادة، و15,000 بين سنتين وأربع سنوات، و7,000 لدى البالغين. يُزال 8,000 / 15,000 ≈ 53%.

Recapالخلاصة

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

  • Pruning is a pipeline: formulate, choose granularity, choose criterion, choose ratio, fine-tune. This lecture covers the first three, Lecture 04-2 the last two.الـ pruning سلسلة خطوات: الصياغة، ثم اختيار الـ granularity، ثم اختيار المعيار (criterion)، ثم اختيار النسبة (ratio)، ثم الـ fine-tuning. تغطي هذه المحاضرة الثلاث الأولى، وتغطي المحاضرة 04-2 الأخيرتين.
  • In 45 nm at 0.9 V a 32-bit DRAM access costs 640 pJ against 3.1 pJ for an int multiply and 0.1 pJ for an int add: about 200x and 6400x.في تقنية 45 nm وعند 0.9 V يكلّف الوصول إلى DRAM بعرض 32-bit مقدار 640 pJ، مقابل 3.1 pJ لضرب أعداد صحيحة و0.1 pJ لجمع أعداد صحيحة: أي نحو 200x و6400x.
  • Data movement drives memory references, memory references drive energy, so fewer weights means fewer fetches and, once the model fits SRAM, 128x cheaper accesses.حركة البيانات تولّد مرات الوصول إلى الذاكرة، ومرات الوصول تولّد استهلاك الطاقة، لذا فإن أوزانًا أقل تعني عمليات جلب أقل، وما إن يتسع النموذج داخل SRAM يصبح كل وصول أرخص بـ 128x.
  • A 1-billion-connection network at 20 Hz spends 12.8 W on DRAM fetches alone.شبكة بمليار وصلة تعمل بتردد 20 Hz تستهلك 12.8 W على جلب البيانات من DRAM وحده.
  • Synapse pruning zeroes single weights and leaves neurons in place; neuron pruning deletes a node with all incident edges, a row here and a column in the next layer.pruning الوصلات يصفّر أوزانًا منفردة ويُبقي العصبونات في مكانها؛ أما pruning العصبونات فيحذف العقدة مع كل الحواف المتصلة بها، أي صفًا في هذه الطبقة وعمودًا في الطبقة التالية.
  • Pruning is argmin over W_P of L(x; W_P) subject to ||W_P||_0 <= N; the slide bullet's strict less-than is a typo inherited from the MIT deck.الـ pruning هو argmin على W_P للدالة L(x; W_P) بشرط ||W_P||_0 <= N؛ وعلامة «أصغر تمامًا» في نقطة الشريحة خطأ مطبعي موروث من عرض MIT.
  • ||.||_0 counts nonzeros, is not a true norm and has no useful gradient, so practical pruning uses importance criteria and per-layer ratios.الرمز ||.||_0 يعدّ القيم غير الصفرية، وليس norm حقيقيًا، وليس له gradient مفيد، لذا يعتمد الـ pruning العملي على معايير الأهمية (importance criteria) وعلى نسب مختلفة لكل طبقة.
  • Sparsity equals 1 - N/|W|; AlexNet at 61 M to 6.7 M parameters is 89 percent sparsity, 9x fewer weights.الـ sparsity تساوي 1 - N/|W|؛ وتقليص AlexNet من 61 M إلى 6.7 M معامل يعني sparsity بنسبة 89 بالمئة، أي أوزانًا أقل بـ 9x.
  • The brain grows from about 2,500 to 15,000 synapses per neuron and prunes to about 7,000: overprovision, then remove the little-used.ينمو الدماغ من نحو 2,500 إلى 15,000 وصلة (synapse) لكل عصبون، ثم يقلّمها إلى نحو 7,000: يبني فائضًا أولًا، ثم يزيل الوصلات قليلة الاستخدام.

Sourcesالمصادر