COE 592Lecture 00المحاضرة 00Part 02الجزء 02
Course takeaways and getting startedمخرجات المقرر والبداية
What the course promises you will be able to do, the five pillars of efficient deep learning on constrained devices, and what to do in week one.ما الذي يعدك المقرر بأن تصبح قادرًا عليه، والركائز الخمس للتعلم العميق الكفء على الأجهزة المحدودة، وما الذي تفعله في الأسبوع الأول.
- Conceptsالمفاهيم
- 3
- Slidesالشرائح
- 9-12
- Readingمدة القراءة
- 18 min18 دقيقة
Why this part mattersلماذا يهمّ هذا الجزء
This part is the course contract. Every later lecture, from efficiency metrics through pruning, quantization, architecture search and deployment, is one turn of a five-step loop that slide 11 draws as a neural network funnelling down into a small development board.
Your exams and your research project will ask you to do two things with that loop: place a technique in it (is knowledge distillation an accelerate step or a compare step?), and compute whether a given model fits a given device. Both start here. The part also covers what the instructor asks of you in week one, and what the deck deliberately leaves to Blackboard.
هذا الجزء هو عقد المقرر. كل محاضرة لاحقة، من مقاييس الكفاءة مرورًا بالتقليم (pruning) والتكميم (quantization) والبحث عن المعماريات وصولًا إلى النشر، هي دورة واحدة في حلقة من خمس خطوات ترسمها الشريحة 11 على هيئة شبكة عصبية تنساب كالقمع نزولًا إلى لوحة تطوير صغيرة.
ستطلب منك الامتحانات ومشروعك البحثي أمرين مع هذه الحلقة: أن تضع تقنية ما في موضعها منها (هل تقطير المعرفة knowledge distillation خطوة تسريع أم خطوة مقارنة؟)، وأن تحسب هل يتسع نموذج معين في جهاز معين. كلا الأمرين يبدأ من هنا. ويغطي الجزء أيضًا ما يطلبه منك المحاضر في الأسبوع الأول، وما تتركه الشرائح عمدًا لـBlackboard.
By the end you canفي نهاية هذا الجزء ستستطيع
- State the five course takeaways and reorder them as a measure, optimize, compare, explore, deploy loop.تذكر مخرجات المقرر الخمس وتعيد ترتيبها في صورة حلقة: قِس، حسّن، قارن، استكشف، انشر.
- Compute a model's weight size from parameter count and bit width, and judge whether it fits a device tier.تحسب حجم أوزان النموذج من عدد المعاملات وعرض البت، وتحكم هل يتسع في فئة جهاز معينة.
- Explain why accuracy alone cannot select a model for a constrained device.تشرح لماذا لا تكفي الدقة وحدها لاختيار نموذج لجهاز محدود الموارد.
- Distinguish on-device inference from on-device training by their memory needs.تميّز بين الاستدلال على الجهاز والتدريب على الجهاز من حيث احتياجات الذاكرة.
- Set up a week-one plan: survey, prerequisites check, device tier, candidate model, metrics log.تضع خطة الأسبوع الأول: الاستبيان، والتحقق من المتطلبات المسبقة، وفئة الجهاز، والنموذج المرشح، وسجل المقاييس.
On the first evening each student says three things out loud: their name, their educational background (previous studies), and their work background (current or previous work, industry or occupation). Then everyone opens the Pre-course survey at https://forms.cloud.microsoft/r/5ssu8gkcS9, also printed as a QR code on slide 10, and answers questions about background, skills and expectations.
في الأمسية الأولى يذكر كل طالب ثلاثة أشياء بصوت مسموع: اسمه، وخلفيته التعليمية (دراسته السابقة)، وخلفيته العملية (عمله الحالي أو السابق، أو القطاع، أو المهنة). ثم يفتح الجميع pre-course survey (استبيان ما قبل المقرر) على الرابط https://forms.cloud.microsoft/r/5ssu8gkcS9، المطبوع أيضًا كرمز QR في الشريحة 10، ويجيبون عن أسئلة حول الخلفية والمهارات والتوقعات.
It is tempting to file both under administration, but they serve the same purpose as takeaway 1 later in this part: you cannot tune what you have not measured. A graduate course on efficient deep learning draws people from computer engineering, electrical engineering, computer science and industry. Some have trained convolutional networks for years and never flashed a microcontroller; others write firmware for embedded systems daily and have never opened PyTorch. The instructor uses the room's answers to set depth and pacing, so an honest answer about a gap is worth more to you than an impressive one.
من المغري أن تصنّف الأمرين تحت بند الإجراءات الإدارية، لكنهما يخدمان الغرض نفسه الذي يخدمه المُخرج 1 لاحقًا في هذا الجزء: لا يمكنك ضبط ما لم تقِسه. مقرر دراسات عليا في التعلم العميق الكفء يجمع طلابًا من هندسة الحاسب، والهندسة الكهربائية، وعلوم الحاسب، والصناعة. بعضهم درّب شبكات التفاف لسنوات ولم يبرمج microcontroller (متحكمًا دقيقًا) قط، وآخرون يكتبون البرمجيات الثابتة (firmware) لـembedded systems (الأنظمة المدمجة) يوميًا ولم يفتحوا PyTorch قط. يستخدم المحاضر إجابات القاعة لتحديد العمق والإيقاع، لذا فإن إجابة صادقة عن نقص لديك أنفع لك من إجابة مبهرة.
What is worth refreshing before week twoما يستحق المراجعة قبل الأسبوع الثاني
The deck does not list prerequisites, so treat the following as a hedged suggestion drawn from what the course will ask you to do rather than as a slide claim. The topics ahead (compression, pruning, quantization, deployment to boards) match the syllabus of MIT's 6.5940 TinyML and Efficient Deep Learning Computing, which lists an introductory machine learning subject and a computation structures subject as its prerequisites. Translated to tools, four skills will carry most of the weight.
لا تذكر الشرائح أي متطلبات مسبقة، لذا تعامل مع ما يلي كاقتراح حذر مستنتج مما سيطلبه منك المقرر، لا كادعاء ورد في الشرائح. الموضوعات القادمة (الضغط، وpruning(التقليم)، وquantization (التكميم)، وdeployment (النشر) على اللوحات) تطابق الخطة الدراسية لمقرر MIT 6.5940 TinyML and Efficient Deep Learning Computing، الذي يشترط مقررًا تمهيديًا في تعلم الآلة ومقررًا في بنى الحوسبة (computation structures). وإذا ترجمنا ذلك إلى أدوات، فإن أربع مهارات ستحمل معظم العبء.
Skills that will probably matter, and whyمهارات يُرجَّح أن تكون مهمة، ولماذا
- Python
- Every framework, script and notebook in efficient deep learning assumes it. The PyTorch beginner tutorial itself assumes basic familiarity with Python.كل إطار عمل وكل سكربت وكل دفتر notebook في التعلم العميق الكفء يفترض معرفتها. ودرس المبتدئين في PyTorch نفسه يفترض إلمامًا أساسيًا بـPython.
- PyTorch
- The compression and quantization literature (Deep Compression, MCUNet, TinyTL) ships PyTorch code; you will read and modify such code, not write frameworks.أدبيات الضغط والتكميم (Deep Compression وMCUNet وTinyTL) تنشر شيفرتها بـPyTorch؛ وستقرأ مثل هذه الشيفرة وتعدّلها، لا أن تكتب أطر عمل.
- Basic CNNsأساسيات الشبكات الالتفافية (CNNs)
- Convolutions, pooling and fully connected layers are what get pruned and quantized. The free Deep Learning book by Goodfellow, Bengio and Courville covers them.طبقات الالتفاف (convolution) والتجميع (pooling) والطبقات المتصلة كليًا هي ما يُقلَّم ويُكمَّم. ويغطيها كتاب Deep Learning المجاني لـGoodfellow وBengio وCourville.
- C for microcontrollersلغة C للمتحكمات الدقيقة
- LiteRT for Microcontrollers is written in C++ 17 for 32-bit platforms with no operating system, so deploying to a board means touching C or C++ code.LiteRT for Microcontrollers مكتوب بـC++ 17 لمنصات 32-bit بلا نظام تشغيل، لذا فالنشر على لوحة يعني التعامل مع شيفرة C أو C++.
None of these needs to be deep on day one. If you can train a small classifier in PyTorch, explain what a convolution computes, and compile and flash a blinking-LED program in C, you can follow the first weeks and fill in the rest as the loop demands it.
لا يلزم أن تتعمق في أي منها من اليوم الأول. إذا كنت تستطيع تدريب مصنّف صغير في PyTorch، وشرح ما يحسبه الالتفاف (convolution)، وترجمة برنامج يُومض LED بلغة C وتحميله على اللوحة، فبإمكانك متابعة الأسابيع الأولى واستكمال الباقي كلما احتاجت إليه الحلقة.
Recall
What three things does the icebreaker ask each student to share?ما الأشياء الثلاثة التي يطلب التعارف من كل طالب أن يذكرها؟
Take a small image classifier with 3 million parameters, trained in PyTorch and saved in 32-bit floating point. Its weights alone occupy 12 MB. A Raspberry Pi Pico has 2 MB of flash and 264 KB of SRAM. The model does not fit, and no amount of accuracy changes that. Everything this course teaches is what you do next.
خذ مصنّف صور صغيرًا فيه 3 million parameters (معامل)، دُرّب في PyTorch وحُفظ بصيغة الفاصلة العائمة 32-bit. أوزانه وحدها تشغل 12 MB. ولوحة Raspberry Pi Pico فيها 2 MB من flash (ذاكرة الفلاش) و264 KB من SRAM. النموذج لا يتسع، ولن تغيّر أي دقة هذه الحقيقة. كل ما يعلّمه هذا المقرر هو ما تفعله بعد ذلك.
Slide 11 states the promise as five takeaways. You will know the key Efficiency metrics for deep learning computing. You will understand how to speed up Inference and Training of neural networks on resource-constrained platforms. You will analyse the tradeoffs between different optimization techniques. You will be aware of recent research trends and industry practice. And you will get hands-on experience compressing and implementing deep learning models on resource-constrained devices. The infographic relabels the same five as Measure efficiency, Accelerate, Analyse trade-offs, Track the frontier, and Build and deploy, with a five-word footer: Measure, Optimize, Compare, Explore, Deploy.
تعرض الشريحة 11 وعد المقرر في خمس مخرجات. ستعرف أهم efficiency metrics (مقاييس الكفاءة) في حوسبة التعلم العميق. وستفهم كيف تسرّع inference (الاستدلال) وtraining (التدريب) للشبكات العصبية على منصات resource-constrained (محدودة الموارد). وستحلل tradeoffs (المفاضلات) بين تقنيات التحسين المختلفة. وستكون على اطلاع على اتجاهات البحث الحديثة وممارسات الصناعة. وستكتسب خبرة عملية في compressing (ضغط) نماذج التعلم العميق وتنفيذها على أجهزة محدودة الموارد. ويعيد الرسم التوضيحي تسمية المخرجات الخمس نفسها إلى Measure efficiency وAccelerate وAnalyse trade-offs وTrack the frontier وBuild and deploy، مع تذييل من خمس كلمات: Measure, Optimize, Compare, Explore, Deploy.
Read the five as a loop, not a listاقرأ الخمس حلقةً لا قائمة
The order on the slide is not arbitrary. It is the order in which you actually work. You measure a baseline: size, memory, compute, latency, energy. You apply one optimization, say pruning. You compare the new numbers against the baseline and note what the step cost in accuracy. You look to the research literature and to industry for the next technique. You deploy on the real board to check that the paper numbers survive contact with hardware, because measured latency and energy routinely differ from analytical estimates. Then you measure again, and the loop turns.
الترتيب في الشريحة ليس عشوائيًا، بل هو الترتيب الذي تعمل به فعلًا. تقيس خط الأساس (baseline): الحجم، والذاكرة، والحوسبة، وlatency (زمن الاستجابة)، والطاقة. ثم تطبّق عملية تحسين واحدة، ولتكن pruning (التقليم). ثم تقارن الأرقام الجديدة بخط الأساس وتسجل ما كلّفته هذه الخطوة من الدقة. ثم تبحث في الأدبيات البحثية وفي الصناعة عن التقنية التالية. ثم تُجري deploy (النشر) على اللوحة الحقيقية لتتأكد أن أرقام الورقة البحثية تصمد أمام العتاد الفعلي، لأن زمن الاستجابة والطاقة المقيسين يختلفان عادةً عن التقديرات التحليلية. ثم تقيس من جديد، فتدور الحلقة.
| Pillarالركيزة | Verbالفعل | Question you askالسؤال الذي تطرحه | Deep Compression exampleمثال من Deep Compression |
|---|---|---|---|
| 1 Measure efficiency1 قياس الكفاءة | Measureالقياس | How big, how slow, how hungry is the baseline?ما حجم خط الأساس، وما بطؤه، وما استهلاكه للموارد؟ | AlexNet: 240 MB, 61 M parameters, 32-bit weightsAlexNet: 240 MB، و61 M معامل، وأوزان 32-bit |
| 2 Accelerate2 التسريع | Optimizeالتحسين | Which technique shrinks the cost that hurts most?أي تقنية تقلّص التكلفة الأشد إيلامًا؟ | Prune 9x fewer connections, quantize to 5 bits, Huffman codeتقليم الوصلات إلى أقل بـ9x، والتكميم إلى 5 بتات، وترميز Huffman |
| 3 Analyse trade-offs3 تحليل المفاضلات | Compareالمقارنة | What did each step cost in accuracy or effort?كم كلّفت كل خطوة من الدقة أو الجهد؟ | 35x smaller with no accuracy loss, after retrainingأصغر بـ35x دون خسارة في الدقة، بعد إعادة التدريب |
| 4 Track the frontier4 متابعة أحدث ما وصل إليه البحث | Exploreالاستكشاف | What has research or industry done since?ما الذي أنجزه البحث أو الصناعة منذ ذلك الحين؟ | MCUNet, TinyTL and on-device training under 256 KBMCUNet وTinyTL والتدريب على الجهاز ضمن 256 KB |
| 5 Build and deploy5 البناء والنشر | Deployالنشر | Does it really run on the target hardware?هل يعمل فعلًا على العتاد المستهدف؟ | 3x to 4x layerwise speedup and 3x to 7x energy efficiency measured on hardwareتسريع على مستوى الطبقة من 3x إلى 4x وكفاءة طاقة من 3x إلى 7x مقيسة على العتاد |
Deep Compression is the canonical worked loop. Han, Mao and Dally started from AlexNet at 240 MB and VGG-16 at 552 MB (measure), pruned redundant connections, quantized the survivors from 32 to as few as 5 bits and Huffman coded the result (optimize), reported 35x and 49x reductions with no loss of accuracy (compare), and measured 3x to 4x layerwise speedup and 3x to 7x better energy efficiency on real hardware (deploy). The companion paper on learning both weights and connections had already shown pruning alone cutting AlexNet from 61 M to 6.7 M parameters. Everything after 2016 (MCUNet, TinyTL, on-device training under 256 KB) is the explore step feeding the next turn.
Deep Compression هو المثال النموذجي لحلقة كاملة. بدأ Han وMao وDally من AlexNet بحجم 240 MB وVGG-16 بحجم 552 MB (القياس)، ثم قلّموا الوصلات الزائدة، وكمّموا الوصلات الباقية من 32 بت إلى ما يصل إلى 5 بتات فقط، وطبّقوا ترميز Huffman على الناتج (التحسين)، وأبلغوا عن تقليص بمقدار 35x و49x دون أي خسارة في الدقة (المقارنة)، وقاسوا تسريعًا على مستوى الطبقة من 3x إلى 4x وكفاءة طاقة أفضل من 3x إلى 7x على عتاد حقيقي (النشر). وكانت الورقة المرافقة عن تعلم الأوزان والوصلات معًا قد أظهرت قبل ذلك أن التقليم وحده يخفض AlexNet من 61 M إلى 6.7 M معامل. وكل ما جاء بعد 2016 (MCUNet وTinyTL والتدريب على الجهاز ضمن 256 KB) هو خطوة الاستكشاف التي تغذي الدورة التالية.
A preview of the efficiency metricsلمحة مسبقة عن مقاييس الكفاءة
Slide 11 names the metrics without listing them; the list below previews later lectures and is not slide content. The ordering follows the MIT 6.5940 sequence, which opens with the basics of efficient deep learning before pruning, quantization, neural architecture search, distillation and on-device training. Learn the names now so the loop has something concrete to measure.
تذكر الشريحة 11 المقاييس دون أن تسردها؛ والقائمة أدناه لمحة عن محاضرات لاحقة وليست من محتوى الشرائح. ويتبع الترتيب تسلسل MIT 6.5940، الذي يبدأ بأساسيات التعلم العميق الكفء قبل التقليم، وquantization (التكميم)، وneural architecture search (البحث عن معمارية الشبكة العصبية)، وdistillation (التقطير)، والتدريب على الجهاز. تعلّم الأسماء الآن حتى يكون لدى الحلقة شيء ملموس تقيسه.
| Metricالمقياس | What it countsما الذي يحسبه | Typical unitالوحدة المعتادة |
|---|---|---|
| Parameter countعدد المعاملات | How many learnable weights and biases the model hasكم وزنًا وانحيازًا (bias) قابلًا للتعلم في النموذج | millions (M)ملايين (M) |
| Model sizeحجم النموذج | Bytes needed to store the weights: parameters times bits per weight over 8عدد البايتات اللازمة لتخزين الأوزان: عدد المعاملات مضروبًا في عدد البتات لكل وزن مقسومًا على 8 | MB or KBMB أو KB |
| Peak memoryذروة الذاكرة | The most memory needed at any moment: weights plus the largest activation tensorsأكبر قدر من الذاكرة يُحتاج إليه في أي لحظة: الأوزان مضافًا إليها أكبر موترات التنشيط | MB or KBMB أو KB |
| Computeالحوسبة | Multiply-accumulate operations (MACs) or floating-point operations (FLOPs) per inferenceعدد عمليات الضرب والجمع (MACs) أو عمليات الفاصلة العائمة (FLOPs) لكل استدلال | MMACs or GFLOPsMMACs أو GFLOPs |
| Latencyزمن الاستجابة | Time from one input to its outputالزمن من إدخال واحد حتى مخرجه | msms |
| Throughputالإنتاجية (throughput) | Inferences completed per secondعدد عمليات الاستدلال المكتملة في الثانية | inferences/sاستدلال/ثانية (inferences/s) |
| Energyالطاقة | Joules per inference, or average power while runningالجول لكل استدلال، أو متوسط القدرة أثناء التشغيل | mJ or mWmJ أو mW |
The first two are the easiest to compute by hand, and the calculation is one you will repeat all term. A weight stored in b bits takes b / 8 bytes, so the size of the weights is the parameter count times bits per weight divided by eight.
أول مقياسين هما الأسهل حسابًا باليد، وهذا الحساب ستكرره طوال الفصل. الوزن المخزّن في b بت يشغل b / 8 بايت، لذا فإن حجم الأوزان يساوي عدد المعاملات مضروبًا في عدد البتات لكل وزن مقسومًا على ثمانية.
Worked exampleمثال محلول
A 3 million parameter model at four bit widthsنموذج من 3 ملايين معامل عند أربعة عروض بت
Start from float32ابدأ من float32
3,000,000 × 32 / 8 = 12,000,000 bytes, about 12 MB. This is what PyTorch saves by default.3,000,000 × 32 / 8 = 12,000,000 بايت، أي نحو 12 MB. وهذا ما يحفظه PyTorch افتراضيًا.Halve the bits, halve the bytesنصف البتات يعني نصف البايتات
At 16 bits the same weights take 6 MB; at 8 bits, 3 MB; at 4 bits, 1.5 MB. Nothing else changed: the parameter count is identical.عند 16 بت تشغل الأوزان نفسها 6 MB؛ وعند 8 بتات 3 MB؛ وعند 4 بتات 1.5 MB. لم يتغير شيء آخر: عدد المعاملات هو نفسه تمامًا.Test against two boardsاختبر مقابل لوحتين
The Raspberry Pi Pico has 2 MB of flash, so only the 4-bit version fits. The Arduino Nano 33 BLE Sense Rev2 has 1 MB, so none of the four fit, and quantization alone is not enough.في Raspberry Pi Pico ذاكرة فلاش بحجم 2 MB، لذا لا تتسع إلا نسخة 4-bit. أما Arduino Nano 33 BLE Sense Rev2 ففيها 1 MB، فلا تتسع أي من النسخ الأربع، والتكميم وحده لا يكفي.Resultالنتيجة
Bit width divides size, but the target device decides whether the result is small enough. Below 1 MB this model also needs pruning or a different architecture.bit width (عرض البت) يقسم الحجم، لكن الجهاز المستهدف هو من يقرر هل الناتج صغير بما يكفي. للنزول تحت 1 MB يحتاج هذا النموذج أيضًا إلى التقليم أو إلى معمارية مختلفة.
| Bits per weightعدد البتات لكل وزن | Calculationالحساب | Sizeالحجم | Fits Pico flash (2 MB)?هل يتسع في فلاش Pico (2 MB)؟ | Fits Nano 33 BLE Sense flash (1 MB)?هل يتسع في فلاش Nano 33 BLE Sense (1 MB)؟ |
|---|---|---|---|---|
| 32-bit32-bit | 3,000,000 × 32 / 83,000,000 × 32 / 8 | 12,000,000 B (12 MB)12,000,000 B (12 MB) | Noلا | Noلا |
| 16-bit16-bit | 3,000,000 × 16 / 83,000,000 × 16 / 8 | 6,000,000 B (6 MB)6,000,000 B (6 MB) | Noلا | Noلا |
| 8-bit8-bit | 3,000,000 × 8 / 83,000,000 × 8 / 8 | 3,000,000 B (3 MB)3,000,000 B (3 MB) | Noلا | Noلا |
| 4-bit4-bit | 3,000,000 × 4 / 83,000,000 × 4 / 8 | 1,500,000 B (1.5 MB)1,500,000 B (1.5 MB) | Yesنعم | Noلا |
Try it yourself. The calculator applies the formula for any parameter count and bit width and checks the result against generic device tiers. The device figures are datasheet capacities for one example board per tier (Arduino, Raspberry Pi and NVIDIA product pages), not what is free once the runtime and your code are loaded.
جرّب بنفسك. تطبّق الحاسبة المعادلة على أي عدد معاملات وأي عرض بت، وتختبر الناتج مقابل فئات أجهزة عامة. أرقام الأجهزة هي السعات المذكورة في أوراق البيانات للوحة مثال واحدة لكل فئة (صفحات منتجات Arduino وRaspberry Pi وNVIDIA)، وليست ما يتبقى حرًا بعد تحميل بيئة التشغيل وشيفرتك.
Microcontroller, example board: Arduino Nano 33 BLE Sense Rev2 (nRF52840)Microcontroller، لوحة على سبيل المثال: Arduino Nano 33 BLE Sense Rev2 (nRF52840)
Activations, the runtime and your application code also need memory. These figures are datasheet capacities, not what is free. Model sizes use MB as 10^6 bytes; the microcontroller banks use the datasheet binary figures (1 MiB flash, 256 KiB SRAM), which are slightly larger.التنشيطات (activations) وبيئة التشغيل (runtime) وشيفرة تطبيقك تحتاج إلى ذاكرة أيضًا. هذه الأرقام هي السعات المذكورة في ورقة البيانات (datasheet)، لا الذاكرة المتاحة فعلًا. أحجام النماذج تعتبر MB مساوية لـ 10^6 بايت، أما بنوك ذاكرة المتحكم الدقيق فتستخدم الأرقام الثنائية من ورقة البيانات (1 MiB للذاكرة الوميضية flash، و256 KiB لذاكرة SRAM)، وهي أكبر بقليل.
Three misconceptions the loop correctsثلاثة مفاهيم خاطئة تصححها الحلقة
Quick checkاختبار سريع
You compare pruning and quantization on the same network and report size, latency and accuracy for each. Which takeaway is this?قارنت التقليم والتكميم على الشبكة نفسها وأبلغت عن الحجم وزمن الاستجابة والدقة لكل منهما. أي مُخرج من مخرجات المقرر هذا؟
Quick checkاختبار سريع
A network has 12 million parameters stored as 8-bit integers. What is its weight size?شبكة فيها 12 مليون معامل مخزنة كأعداد صحيحة 8-bit. ما حجم أوزانها؟
Quick checkاختبار سريع
Why can accuracy alone not choose a model for a microcontroller?لماذا لا تكفي الدقة وحدها لاختيار نموذج لمتحكم دقيق؟
Quick checkاختبار سريع
Which memory cost appears in on-device training but not in on-device inference?أي تكلفة ذاكرة تظهر في التدريب على الجهاز ولا تظهر في الاستدلال على الجهاز؟
Recall
Name the five course takeaways in the order of the loop, then say what comes after the fifth.اذكر مخرجات المقرر الخمس بترتيب الحلقة، ثم قل ما الذي يأتي بعد الخامسة.
Recall
A 3 M parameter model with 8-bit weights: how many bytes, and does it fit 1 MB of flash?نموذج من 3 M معامل بأوزان 8-bit: كم بايتًا يشغل، وهل يتسع في 1 MB من ذاكرة الفلاش؟
Recall
Why is on-device training harder than on-device inference?لماذا يكون التدريب على الجهاز أصعب من الاستدلال على الجهاز؟
Slide 12 contains three words: "View on Blackboard". That is the whole syllabus section of the deck. It does not give grading weights, exam dates, project deliverables, a textbook, an office location or office hours. Anything you read elsewhere claiming to know those for this course is not coming from these slides.
تحتوي الشريحة 12 على ثلاث كلمات فقط: "View on Blackboard". وهذا هو قسم الخطة الدراسية كله في الشرائح. فهي لا تذكر أوزان التقييم، ولا مواعيد الامتحانات، ولا مخرجات المشروع، ولا كتابًا مقررًا، ولا موقع المكتب، ولا الساعات المكتبية. وأي مصدر آخر تقرؤه يدّعي معرفة هذه التفاصيل لهذا المقرر لا يستقيها من هذه الشرائح.
What is known so far (meeting details from the course registry, not this deck)ما هو معروف حتى الآن (تفاصيل المحاضرات من سجل المقرر، لا من هذه الشرائح)
- Meetingsالمحاضرات
- Monday and Wednesday, 20:10 to 21:25الاثنين والأربعاء، من 20:10 إلى 21:25
- Roomالقاعة
- Building 59, Room 2004المبنى 59، القاعة 2004
- Syllabus, grading, deliverablesالخطة الدراسية، والتقييم، والمخرجات المطلوبة
- On Blackboard, not in this deckعلى Blackboard، لا في هذه الشرائح
- Textbook, office, office hoursالكتاب المقرر، والمكتب، والساعات المكتبية
- Not stated in this deck; check Blackboardغير مذكورة في هذه الشرائح؛ راجع Blackboard
Plan the project before the syllabus tells you toخطّط للمشروع قبل أن تطلب منك الخطة الدراسية ذلك
Takeaway 5 promises hands-on experience compressing and implementing models on constrained devices, and the MIT counterpart of this course ends in an open-ended design project. Read that as a strong hint that a hardware Deployment is coming, whatever Blackboard eventually calls it. The students who struggle with such projects are rarely short of techniques; they are short of a baseline to compare against and a board that arrives on time. Both are fixed in week one.
يَعِد المُخرج 5 بخبرة عملية في ضغط النماذج وتنفيذها على أجهزة محدودة الموارد، والمقرر المقابل لهذا المقرر في MIT ينتهي بمشروع تصميم مفتوح. اقرأ ذلك تلميحًا قويًا إلى أن deployment (نشرًا) على عتاد حقيقي قادم، أيًا كان الاسم الذي سيطلقه عليه Blackboard لاحقًا. الطلاب الذين يتعثرون في مثل هذه المشاريع نادرًا ما تنقصهم التقنيات؛ بل ينقصهم خط أساس يقارنون به، ولوحة تصل في الوقت المناسب. وكلاهما يُحسم في الأسبوع الأول.
- Pick a device tier first. The memory budget of the tier decides which models are even candidates, so the device is an input to model selection, not an output of it.اختر فئة الجهاز أولًا. ميزانية الذاكرة في الفئة هي التي تحدد أي النماذج يصلح أصلًا أن يكون مرشحًا، لذا فالجهاز مُدخل لاختيار النموذج، لا ناتج عنه.
- Pick a candidate model that already fits, or is within one or two optimizations of fitting, and record its parameter count and float32 size with the formula from the previous concept.اختر نموذجًا مرشحًا يتسع بالفعل، أو يبعد عملية تحسين أو اثنتين عن أن يتسع، وسجّل parameter count (عدد معاملاته) وحجمه بصيغة float32 باستخدام المعادلة من المفهوم السابق.
- Start a metrics log before the first optimization. A baseline recorded after you have started changing things is not a baseline.ابدأ سجل مقاييس قبل أول عملية تحسين. خط الأساس الذي يُسجَّل بعد أن تبدأ في تغيير الأشياء ليس خط أساس.
| Tierالفئة | Example boardلوحة مثال | Memoryالذاكرة | What it is typically asked to runما يُطلب منها تشغيله عادةً |
|---|---|---|---|
| Microcontrollerمتحكم دقيق | Arduino Nano 33 BLE Sense Rev2 (nRF52840)Arduino Nano 33 BLE Sense Rev2 (nRF52840) | 1 MB flash, 256 KB SRAM1 MB ذاكرة فلاش، و256 KB من SRAM | Keyword spotting, gesture and anomaly detection, tiny image classifiersاكتشاف الكلمات المفتاحية، واكتشاف الإيماءات والحالات الشاذة، ومصنّفات صور صغيرة جدًا |
| Microcontrollerمتحكم دقيق | Raspberry Pi Pico and Pico 2Raspberry Pi Pico and Pico 2 | 2 MB flash and 264 KB SRAM; Pico 2 has 4 MB and 520 KB2 MB ذاكرة فلاش و264 KB من SRAM؛ وفي Pico 2 يبلغان 4 MB و520 KB | Same class, a little more headroomالفئة نفسها، مع هامش أوسع قليلًا |
| Single-board computerحاسوب أحادي اللوحة | Raspberry Pi 4 Model BRaspberry Pi 4 Model B | 1 to 8 GB LPDDR4 RAMمن 1 إلى 8 GB من ذاكرة LPDDR4 RAM | Quantized MobileNet-class vision, small detectors, a Linux runtimeرؤية حاسوبية من فئة MobileNet بعد التكميم، وكواشف صغيرة، وبيئة تشغيل Linux |
| GPU moduleوحدة GPU | Jetson Orin Nano Super Developer KitJetson Orin Nano Super Developer Kit | 8 GB LPDDR5 at 102 GB/s, 67 INT8 TOPS8 GB من LPDDR5 بسرعة 102 GB/s، و67 INT8 TOPS | Real-time detection, small transformers, on-device fine-tuningاكتشاف في الزمن الحقيقي، ونماذج transformer صغيرة، وضبط دقيق (fine-tuning) على الجهاز |
The last column is a guide, not a datasheet claim. MCUNet reached over 70% ImageNet top-1 accuracy on a commercial microcontroller, so the microcontroller tier is more capable than its numbers suggest, but only after the whole loop has been applied to a purpose-built architecture. A model chosen for a GPU module and then squeezed onto a microcontroller is the hardest path in the course.
العمود الأخير إرشادي، وليس ادعاءً من ورقة بيانات. فقد بلغ MCUNet دقة top-1 تفوق 70% على ImageNet باستخدام microcontroller (متحكم دقيق) تجاري، لذا ففئة المتحكمات الدقيقة أقدر مما توحي به أرقامها، لكن فقط بعد تطبيق الحلقة كاملة على معمارية مصممة لهذا الغرض. أما النموذج الذي يُختار لوحدة GPU ثم يُعصر ليتسع في متحكم دقيق فهو أصعب مسار في المقرر.
| Whenمتى | What to recordما الذي تسجله |
|---|---|
| Week 1الأسبوع 1 | Target device tier and its flash, SRAM or RAM budget from the datasheetفئة الجهاز المستهدف وميزانية ذاكرة الفلاش أو SRAM أو RAM فيه من ورقة البيانات |
| Week 1الأسبوع 1 | Candidate model, its parameter count and float32 weight sizeالنموذج المرشح، وعدد معاملاته، وحجم أوزانه بصيغة float32 |
| Week 1الأسبوع 1 | Baseline accuracy on a held-out set you will not change laterدقة خط الأساس على مجموعة بيانات محجوزة (held-out) لن تغيّرها لاحقًا |
| First run on hardwareأول تشغيل على العتاد | Latency per inference and peak memory as the runtime reports themlatency (زمن الاستجابة) لكل استدلال وذروة الذاكرة كما تبلغ عنهما بيئة التشغيل |
| Every optimizationكل عملية تحسين | The same four numbers again, next to the baseline, plus what it costالأرقام الأربعة نفسها مجددًا، بجوار خط الأساس، مع ما كلّفته الخطوة |
Keep the log as a plain table with one row per experiment and the same columns every time: accuracy, parameter count, size, peak memory, latency, energy if you can measure it, and a one-line note of what changed. This is the compare step made permanent, and it is the table an examiner or a reviewer will want to see.
احتفظ بالسجل جدولًا بسيطًا فيه صف واحد لكل تجربة والأعمدة نفسها في كل مرة: الدقة، وعدد المعاملات، والحجم، وذروة الذاكرة، وزمن الاستجابة، والطاقة إن استطعت قياسها، وملاحظة من سطر واحد عما تغيّر. هذه هي خطوة المقارنة وقد صارت دائمة، وهو الجدول الذي سيرغب الممتحن أو المراجع في رؤيته.
Quick checkاختبار سريع
Where is the COE 592 grading scheme published, according to the deck?أين يُنشر نظام التقييم في COE 592 بحسب الشرائح؟
Recall
Why does the deck not tell you the grading scheme, and what should you do about it?لماذا لا تخبرك الشرائح بنظام التقييم، وماذا يجب أن تفعل حيال ذلك؟
Recall
What three numbers should be in your metrics log before you run the first optimization?ما الأرقام الثلاثة التي يجب أن تكون في سجل مقاييسك قبل أن تُجري أول عملية تحسين؟
Recapالخلاصة
If you remember nothing elseإن لم تتذكر شيئاً آخر فتذكّر هذا
- Introduce yourself with name, education and work background, and fill in the pre-course survey so the course can be calibrated to the room.عرّف بنفسك باسمك وخلفيتك التعليمية وخلفيتك العملية، واملأ استبيان ما قبل المقرر حتى يُضبط المقرر على مستوى القاعة.
- Five takeaways: measure efficiency, accelerate, analyse trade-offs, track the frontier, build and deploy. Read them as a loop, not a list.المخرجات الخمس: قياس الكفاءة، والتسريع، وتحليل المفاضلات، ومتابعة أحدث ما وصل إليه البحث، والبناء والنشر. اقرأها حلقةً لا قائمة.
- Weight size in bytes equals parameters times bits per weight divided by 8: 3 M parameters is 12 MB at 32-bit and 1.5 MB at 4-bit.حجم الأوزان بالبايت يساوي عدد المعاملات مضروبًا في عدد البتات لكل وزن مقسومًا على 8: نموذج من 3 M معامل حجمه 12 MB عند 32-bit و1.5 MB عند 4-bit.
- Size, peak memory, compute, latency, throughput and energy are separate metrics and can disagree.الحجم، وذروة الذاكرة، والحوسبة، وزمن الاستجابة، والإنتاجية، والطاقة مقاييس منفصلة وقد تتعارض فيما بينها.
- Compression trades accuracy and effort; Deep Compression's 35x came with retraining, not for free.الضغط يقايض على الدقة والجهد؛ وتقليص Deep Compression بمقدار 35x جاء مع إعادة التدريب، لا مجانًا.
- Training on device must hold activations and gradients, far more than inference, and LiteRT for Microcontrollers does not support it.التدريب على الجهاز يتطلب الاحتفاظ بالتنشيطات والتدرجات، وهذا أكثر بكثير من الاستدلال، وLiteRT for Microcontrollers لا يدعمه.
- The syllabus, grading and deliverables are on Blackboard, not in this deck. Class: Mon and Wed 20:10 to 21:25, Building 59, Room 2004.الخطة الدراسية والتقييم والمخرجات المطلوبة موجودة على Blackboard، لا في هذه الشرائح. المحاضرات: الاثنين والأربعاء من 20:10 إلى 21:25، المبنى 59، القاعة 2004.
- Pick a device tier and a candidate model in week one, and start a metrics log before the first optimization.اختر فئة جهاز ونموذجًا مرشحًا في الأسبوع الأول، وابدأ سجل مقاييس قبل أول عملية تحسين.
Sourcesالمصادر
- 6.5940 TinyML and Efficient Deep Learning ComputingDocsMIT Subject ListingCatalogue description, prerequisites and the open-ended design projectوصف المقرر في الدليل، والمتطلبات المسبقة، ومشروع التصميم المفتوح(opens in a new tab)(يفتح في تبويب جديد)
- MIT 6.5940 TinyML and Efficient Deep Learning Computing, Fall 2024DocsMIT HAN Lab (Song Han)Lecture sequence; efficientml.ai redirects to the current offering at hanlab.mit.edu/course, which links past offeringsتسلسل المحاضرات؛ يحوّل efficientml.ai إلى النسخة الحالية على hanlab.mit.edu/course، التي تضم روابط النسخ السابقة(opens in a new tab)(يفتح في تبويب جديد)
- Deep Compression: Compressing Deep Neural Networks with Pruning, Trained Quantization and Huffman CodingPaperHan, Mao and Dally, ICLR 201635x and 49x size reduction, 3x to 4x speedup, 3x to 7x energy efficiencyتقليص الحجم بمقدار 35x و49x، وتسريع من 3x إلى 4x، وكفاءة طاقة من 3x إلى 7x(opens in a new tab)(يفتح في تبويب جديد)
- Learning both Weights and Connections for Efficient Neural NetworksPaperHan, Pool, Tran and Dally, NIPS 2015AlexNet 61 M to 6.7 M parameters by pruningخفض AlexNet من 61 M إلى 6.7 M معامل بالتقليم(opens in a new tab)(يفتح في تبويب جديد)
- MCUNet: Tiny Deep Learning on IoT DevicesPaperLin et al., NeurIPS 2020Microcontroller memory two to three orders of magnitude below phones; over 70% ImageNet top-1 on an MCUذاكرة المتحكم الدقيق أصغر من ذاكرة الهواتف بمرتبتين إلى ثلاث مراتب عشرية؛ ودقة top-1 تفوق 70% على ImageNet على متحكم دقيق(opens in a new tab)(يفتح في تبويب جديد)
- TinyTL: Reduce Memory, Not Parameters for Efficient On-Device LearningPaperCai et al., NeurIPS 2020Activations, not parameters, are the training memory bottleneckالتنشيطات، لا المعاملات، هي عنق الزجاجة في ذاكرة التدريب(opens in a new tab)(يفتح في تبويب جديد)
- On-Device Training Under 256KB MemoryPaperLin et al., NeurIPS 2022Training under 256 KB SRAM and 1 MB flashالتدريب ضمن 256 KB من SRAM و1 MB من ذاكرة الفلاش(opens in a new tab)(يفتح في تبويب جديد)
- LiteRT for MicrocontrollersDocsGoogle for DevelopersC++ 17, 32-bit platforms, 16 KB core runtime, no on-device trainingC++ 17، ومنصات 32-bit، وبيئة تشغيل أساسية بحجم 16 KB، ولا تدريب على الجهاز(opens in a new tab)(يفتح في تبويب جديد)
- Learn the BasicsDocsPyTorchAssumes basic familiarity with Python and deep learning conceptsيفترض إلمامًا أساسيًا بـPython وبمفاهيم التعلم العميق(opens in a new tab)(يفتح في تبويب جديد)
- Deep LearningBookGoodfellow, Bengio and Courville, MIT Press 2016Free online; convolutional networks refresherمتاح مجانًا على الإنترنت؛ مراجعة للشبكات الالتفافية(opens in a new tab)(يفتح في تبويب جديد)
- TinyML: Machine Learning with TensorFlow Lite on Arduino and Ultra-Low-Power MicrocontrollersBookWarden and Situnayake, O'Reilly 2019Practical microcontroller deploymentالنشر العملي على المتحكمات الدقيقة(opens in a new tab)(يفتح في تبويب جديد)
- Arduino Nano 33 BLE Sense Rev2DocsArduinonRF52840, 1 MB flash, 256 KB SRAMnRF52840، و1 MB ذاكرة فلاش، و256 KB من SRAM(opens in a new tab)(يفتح في تبويب جديد)
- Raspberry Pi Pico seriesDocsRaspberry PiPico: 2 MB flash, 264 KB SRAM; Pico 2: 4 MB flash, 520 KB SRAMPico: ذاكرة فلاش 2 MB و264 KB من SRAM؛ Pico 2: ذاكرة فلاش 4 MB و520 KB من SRAM(opens in a new tab)(يفتح في تبويب جديد)
- Raspberry Pi 4 Model B specificationsDocsRaspberry Pi1 to 8 GB LPDDR4من 1 إلى 8 GB من LPDDR4(opens in a new tab)(يفتح في تبويب جديد)
- Jetson Orin Nano Super Developer KitDocsNVIDIA8 GB LPDDR5, 102 GB/s, 67 INT8 TOPS8 GB من LPDDR5، و102 GB/s، و67 INT8 TOPS(opens in a new tab)(يفتح في تبويب جديد)