Majid Al-RaimiAccuracy comes at a costالدقة لها ثمن

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

Accuracy comes at a costالدقة لها ثمن

Deep learning now beats humans on ImageNet, but every accuracy gain was paid for in computation and model size, and efficient design (NAS, MCUNet, on-device training) is what brings it to phones and IoT devices.تتفوق نماذج التعلم العميق اليوم على البشر في ImageNet، لكن كل زيادة في الدقة دُفع ثمنها حسابًا وحجمًا للنموذج، والتصميم الكفء (NAS وMCUNet والتدريب على الجهاز) هو ما يوصلها إلى الهواتف وأجهزة إنترنت الأشياء (IoT).

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

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

Every later part of this lecture, from segmentation and diffusion models to LiDAR, language models, accelerators and microcontrollers, is a response to one trade-off introduced here: accuracy is bought with computation and memory, and the devices you want to deploy on cannot pay the bill.

This part builds that trade-off from the ground up. You will learn to read the two charts that anchor the whole course (top-5 error over the ImageNet years, then top-1 accuracy against MACs and parameters), to compute the reduction ratios that headline efficient-model papers, and to argue why efficiency matters for privacy, cost and connectivity and not only for speed. The exam asks exactly these things, and your own embedded ML research lives on the frontier the last two concepts describe.

كل جزء لاحق في هذه المحاضرة، من نماذج التقسيم (segmentation) ونماذج الانتشار (diffusion) إلى LiDAR ونماذج اللغة والمسرّعات والمتحكمات الدقيقة، هو استجابة لمقايضة واحدة نقدمها هنا: الدقة تُشترى بالحوسبة والذاكرة، والأجهزة التي تريد النشر عليها لا تستطيع دفع هذه الفاتورة.

يبني هذا الجزء تلك المقايضة من الأساس. ستتعلم قراءة المخططين اللذين يرتكز عليهما المقرر كله (خطأ top-5 عبر سنوات ImageNet، ثم دقة top-1 مقابل MACs وعدد المعاملات)، وحساب نسب التقليل التي تتصدر عناوين أوراق النماذج الكفؤة، والدفاع عن أهمية الكفاءة للخصوصية والتكلفة والاتصال وليس للسرعة فقط. الامتحان يسأل عن هذه الأشياء بالضبط، وبحثك أنت في تعلم الآلة المدمج يقع على الحدّ الذي يصفه المفهومان الأخيران.

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

  1. State the course challenge and name the three pillars, with one efficiency lever per pillar.تذكر تحدي المقرر وتسمّي الركائز الثلاث، مع أداة واحدة لتحسين الكفاءة في كل ركيزة.
  2. Define top-5 error and top-1 accuracy precisely and explain why they cannot be compared directly.تعرّف خطأ top-5 ودقة top-1 تعريفًا دقيقًا، وتشرح لماذا لا يمكن مقارنتهما مباشرة.
  3. Read a bubble chart of top-1 accuracy versus MACs and parameters, and quantify diminishing returns.تقرأ مخطط الفقاعات لدقة top-1 مقابل MACs وعدد المعاملات، وتقيس تناقص العائد بالأرقام.
  4. Compute a computation reduction ratio and explain the Pareto frontier shift produced by architecture search.تحسب نسبة تقليل الحوسبة، وتشرح انزياح حدّ باريتو (Pareto frontier) الذي ينتجه البحث عن المعماريات.
  5. Explain why TinyML and on-device training are hard, using the memory tiers and the cost of backpropagation.تشرح لماذا يصعب TinyML والتدريب على الجهاز، مستخدمًا مستويات الذاكرة وتكلفة الانتشار العكسي (backpropagation).

Open the camera on your phone and it finds faces before you press anything. Ask a speaker a question and a language model answers. Paste a screenshot into a chatbot and it reads the text and the picture together. Vision, language and multimodal tasks are all served today by deep networks, and every one of those answers costs billions of arithmetic operations. Classifying a single image with ResNet-50 takes about 3.9 billion multiply-accumulate operations (Sze et al., 2017), and that is a model from 2015 doing the easiest of the three tasks.

افتح كاميرا هاتفك وستجد أنها تكتشف الوجوه قبل أن تضغط أي زر. اسأل مكبّر صوت ذكيًا سؤالًا فيجيبك نموذج لغة. الصق لقطة شاشة في روبوت محادثة فيقرأ النص والصورة معًا. مهام الرؤية واللغة والمهام متعددة الوسائط تخدمها اليوم كلها الشبكات العميقة، وكل إجابة من هذه الإجابات تكلّف مليارات العمليات الحسابية. تصنيف صورة واحدة بـ ResNet-50 يحتاج نحو 3.9 billion عملية ضرب وجمع تراكمي (multiply-accumulate) (Sze et al., 2017)، وهذا نموذج من عام 2015 يؤدي أسهل المهام الثلاث.

That is the whole tension of this course, and slide 2 states it in one line. Machine learning (ML) and deep learning are applied everywhere, they are computationally expensive, and the challenge is to make them lightweight and fast without losing accuracy. Every technique you will learn, from pruning and quantization to architecture search, hardware accelerators and tiny Inference engines, is one answer to that single question. It helps to write the question the way an optimization course would: keep accuracy as high as possible while staying under whatever budget the target device imposes.

هذا هو التوتر الأساسي في المقرر كله، والشريحة 2 تلخصه في سطر واحد. Machine learning (ML) والتعلم العميق يُطبَّقان في كل مكان، وهما مكلفان حسابيًا، والتحدي هو جعلهما خفيفين وسريعين دون خسارة الدقة. كل تقنية ستتعلمها، من التقليم (pruning) والتكميم (quantization) إلى البحث عن المعماريات والمسرّعات العتادية ومحركات Inference الصغيرة، هي إجابة واحدة عن هذا السؤال الوحيد. ومن المفيد أن نكتب السؤال بالطريقة التي يكتبه بها مقرر في التحسين الرياضي (optimization): أبقِ الدقة أعلى ما يمكن مع البقاء تحت أي ميزانية يفرضها الجهاز المستهدف.

max⁡θ, A Acc(θ,A)s.t.MACs≤C,  Memory≤M,  Latency≤T,  Energy≤E\max_{\theta,\ \mathcal{A}}\ \text{Acc}(\theta, \mathcal{A}) \quad \text{s.t.}\quad \text{MACs} \le C,\ \ \text{Memory} \le M,\ \ \text{Latency} \le T,\ \ \text{Energy} \le E
Efficient deep learning as a budgeted problem: weights and architecture are chosen under compute, memory, latency and energy limitsالتعلم العميق الكفء بوصفه مسألة ذات ميزانية: تُختار الأوزان والمعمارية تحت قيود الحوسبة والذاكرة وزمن الاستجابة والطاقة

The budgets are what change from device to device. A cloud GPU has a generous C and M; a phone has a tight Latency T and a battery; a sensor node has a memory M measured in kilobytes. The accuracy you can afford depends on which row of that constraint list binds, and part 03 puts real numbers on each row.

الميزانيات هي ما يتغير من جهاز إلى آخر. وحدة GPU سحابية لديها C وM سخيّان، والهاتف لديه قيد صارم على Latency T وبطارية، وعقدة الاستشعار لديها ذاكرة M تقاس بالكيلوبايت. الدقة التي تستطيع تحمّلها تعتمد على أي سطر من قائمة القيود هذه هو الذي يقيّدك فعلًا، والجزء 03 يضع أرقامًا حقيقية لكل سطر.

Three pillars, one lens for the whole courseثلاث ركائز، عدسة واحدة للمقرر كله

Slide 3 gives you the lens to organize everything that follows: deep learning advances when three things improve together. Its three pillars are the algorithm (the model and how it is trained), the hardware it runs on, and the data it learns from. None of them is enough alone. The 2012 breakthrough on ImageNet, which the next concept quantifies, needed all three at once: a new deep convolutional architecture, two GPUs able to run it for a week, and a dataset of about 1.2 million labeled images (Krizhevsky et al., 2012).

تعطيك الشريحة 3 العدسة التي تنظّم بها كل ما يأتي: يتقدم التعلم العميق عندما تتحسن ثلاثة أشياء معًا. الركائز الثلاث هي الخوارزمية (النموذج وطريقة تدريبه)، والعتاد الذي يعمل عليه، والبيانات التي يتعلم منها. لا تكفي أي منها وحدها. اختراق عام 2012 على ImageNet، الذي يقيسه المفهوم التالي بالأرقام، احتاج الثلاث في آن واحد: معمارية التفافية عميقة جديدة، ووحدتي GPU قادرتين على تشغيلها لمدة أسبوع، ومجموعة بيانات من نحو 1.2 million صورة موسومة (Krizhevsky et al., 2012).

PillarالركيزةContribution to AlexNet in 2012إسهامها في AlexNet عام 2012Efficiency lever in this courseأداة الكفاءة في هذا المقرر
AlgorithmالخوارزميةA deep CNN with ReLU units and dropout, trained with SGD on two GPUsشبكة CNN عميقة بوحدات ReLU وأسلوب dropout، دُرِّبت بـ SGD على وحدتي GPUPruning, quantization, distillation, neural architecture search (pruning starts in lecture 04)التقليم والتكميم والتقطير والبحث عن المعمارية العصبية (يبدأ التقليم في المحاضرة 04)
HardwareالعتادTwo GTX 580 GPUs, 3 GB each, running the convolutions for about six daysوحدتا GTX 580، في كل منهما 3 GB، تشغّلان الالتفافات لمدة ستة أيام تقريبًاAccelerators from cloud GPUs to phone NPUs and microcontrollers (part 03)المسرّعات، من وحدات GPU السحابية إلى وحدات NPU في الهواتف والمتحكمات الدقيقة (الجزء 03)
DataالبياناتImageNet: about 1.2 million labeled training images in 1000 classesImageNet: نحو 1.2 million صورة تدريب موسومة في 1000 صنفData that stays on the device and drives local, private learning (slide 8)بيانات تبقى على الجهاز وتقود تعلمًا محليًا يحفظ الخصوصية (الشريحة 8)
The three pillars, what each contributed to the 2012 break, and what efficient deep learning does with itالركائز الثلاث، وما قدّمته كل منها لاختراق 2012، وما يفعله التعلم العميق الكفؤ بها

The same three words tell you where efficiency work happens. Compressing, quantizing and searching for architectures are algorithm-pillar work: the model changes, the chip does not. Building accelerators, from data-center GPUs down to the Hexagon DSP and the Neural Engine, is hardware-pillar work: the chip changes so that the same model runs faster or cooler. The deck returns to this exact slide as slide 17 to open the hardware section, so treat slide 3 as the introduction of the framework and slide 17 as the pivot to its second pillar. The data pillar makes its own appearance on slide 8, where data that cannot leave a device forces learning to happen on the device.

الكلمات الثلاث نفسها تخبرك أين يحدث عمل الكفاءة. الضغط والتكميم والبحث عن المعماريات عمل في ركيزة الخوارزمية: النموذج يتغير والشريحة لا تتغير. بناء المسرّعات، من وحدات GPU في مراكز البيانات نزولًا إلى Hexagon DSP وNeural Engine، عمل في ركيزة العتاد: الشريحة تتغير كي يعمل النموذج نفسه أسرع أو بحرارة أقل. تعود المحاضرة إلى هذه الشريحة نفسها بوصفها الشريحة 17 لتفتتح قسم العتاد، فاعتبر الشريحة 3 مقدمة الإطار والشريحة 17 نقطة الانتقال إلى ركيزته الثانية. أما ركيزة البيانات فتظهر بنفسها في الشريحة 8، حيث تجبر البيانات التي لا يمكنها مغادرة الجهاز التعلمَ على أن يحدث على الجهاز.

Why efficiency matters beyond speedلماذا تهم الكفاءة لما هو أبعد من السرعة

Speed is the obvious reason to want small models, but the exam will ask for more, and the deck gives you at least four. Privacy: a model that fits on the device can process a face or a voice without uploading it. Cost: training and serving large models is billed in GPU hours and, increasingly, in carbon. The Once-for-All paper notes that training a separate specialized network for every deployment target emits as much CO2 as five cars over their lifetimes (Cai et al., 2020). Connectivity: sensors in fields, mines and rural clinics may have no network at all, and MCUNet argues that on-device processing extends AI to areas without Internet access (Lin et al., 2020). Energy: a battery-powered node has a milliwatt budget, and every unnecessary multiply drains it.

السرعة هي السبب الواضح لطلب نماذج صغيرة، لكن الامتحان سيطلب أكثر، والمحاضرة تعطيك أربعة أسباب على الأقل. الخصوصية: النموذج الذي يتسع في الجهاز يستطيع معالجة وجه أو صوت دون رفعه. التكلفة: تدريب النماذج الكبيرة وتشغيلها يُحاسَب بساعات GPU، وبالكربون بشكل متزايد. تذكر ورقة Once-for-All أن تدريب شبكة متخصصة منفصلة لكل هدف نشر يطلق من CO2 ما تطلقه خمس سيارات طوال عمرها (Cai et al., 2020). الاتصال: أجهزة الاستشعار في الحقول والمناجم والعيادات الريفية قد لا يكون لديها أي شبكة، ويحتج MCUNet بأن المعالجة على الجهاز توصل الذكاء الاصطناعي إلى المناطق التي لا يتوفر فيها الإنترنت (Lin et al., 2020). الطاقة: العقدة التي تعمل بالبطارية لديها ميزانية بالمللي واط، وكل عملية ضرب غير ضرورية تستنزفها.

  • Privacy: raw data stays where it was collected.الخصوصية: البيانات الخام تبقى حيث جُمعت.
  • Cost: fewer GPU hours, smaller cloud bills, less carbon.التكلفة: ساعات GPU أقل، وفواتير سحابية أصغر، وكربون أقل.
  • Connectivity: the model works where the network does not.الاتصال: النموذج يعمل حيث لا تعمل الشبكة.
  • Energy: milliwatt devices need models sized for milliwatts.الطاقة: الأجهزة التي تعمل بالمللي واط تحتاج نماذج على مقاس المللي واط.

Recall

State the three pillars and name one efficiency lever for each.اذكر الركائز الثلاث وسمِّ أداة كفاءة واحدة لكل منها.

Algorithm (pruning, quantization, distillation or neural architecture search), hardware (accelerators such as the Hexagon DSP, the Apple Neural Engine or NVIDIA Jetson), data (locally collected data that enables on-device learning; historically, larger datasets such as ImageNet raised accuracy).
الخوارزمية (التقليم، أو التكميم، أو التقطير distillation، أو البحث عن المعمارية العصبية neural architecture search)، والعتاد (مسرّعات مثل Hexagon DSP أو Apple Neural Engine أو NVIDIA Jetson)، والبيانات (بيانات تُجمع محليًا وتمكّن التعلم على الجهاز، وتاريخيًا رفعت مجموعات البيانات الأكبر مثل ImageNet الدقة).

Look at the left panel of slide 4 before the bar chart. It shows six test images (a crop of the eight in the AlexNet paper) with the five classes AlexNet ranked highest for each. For the mushroom photo the top guess is "agaric" and the true label "mushroom" sits second. For the cherry photo the top guess is "dalmatian", followed by grape, elderberry, a bull terrier and currant; "cherry" is nowhere in the list. Under one scoring rule the mushroom counts as correct and the cherry does not; under another rule both are wrong. Which rule you use decides every number on the right of the slide.

انظر إلى اللوحة اليسرى من الشريحة 4 قبل المخطط العمودي. تعرض ست صور اختبار (مقتطعة من الثماني الموجودة في ورقة AlexNet) ومع كل منها الأصناف الخمسة التي رتّبها AlexNet في الأعلى. في صورة الفطر يكون التخمين الأول "agaric" ويأتي الوسم الصحيح "mushroom" في المرتبة الثانية. في صورة الكرز يكون التخمين الأول "dalmatian"، يليه grape وelderberry وbull terrier وcurrant، ولا يظهر "cherry" في القائمة أبدًا. وفق قاعدة تقييم معينة تُحسب صورة الفطر صحيحة وصورة الكرز خاطئة، ووفق قاعدة أخرى تكون الاثنتان خاطئتين. القاعدة التي تستخدمها هي التي تحدد كل رقم على يمين الشريحة.

The rule the contest used is Top-5 error rate. The ImageNet challenge (ILSVRC) let each algorithm return five labels per image and counted the image as correct if any one of them matched the single ground-truth label; the error is the fraction of test images with no match (Russakovsky et al., 2015, Eq. 1). The organizers allowed five guesses because ImageNet photos often contain several objects but carry only one label, and a system that names a visible second object should not be punished. From 2012 the contest reported only top-5 error, since all their measures ranked entries the same way.

القاعدة التي استخدمتها المسابقة هي Top-5 error rate. سمحت مسابقة ImageNet (ILSVRC) لكل خوارزمية بأن تعيد خمسة وسوم لكل صورة، وعدّت الصورة صحيحة إذا طابق أيٌّ منها الوسم الحقيقي الوحيد، والخطأ هو نسبة صور الاختبار التي لا يوجد لها أي تطابق (Russakovsky et al., 2015, Eq. 1). سمح المنظمون بخمسة تخمينات لأن صور ImageNet تحتوي غالبًا على عدة أجسام لكنها تحمل وسمًا واحدًا فقط، والنظام الذي يسمّي جسمًا ثانيًا ظاهرًا في الصورة لا ينبغي أن يُعاقَب. ومنذ عام 2012 لم تعد المسابقة تعلن إلا خطأ top-5، لأن كل مقاييسها كانت ترتب المشاركات بالترتيب نفسه.

errtop-5=1N∑i=1Nmin⁡j∈{1,…,5}1[cij≠Ci]\text{err}_{\text{top-5}} = \frac{1}{N}\sum_{i=1}^{N} \min_{j \in \{1,\dots,5\}} \mathbb{1}\big[c_{ij} \ne C_i\big]
Top-5 error: image i counts as wrong only if none of its five returned labels c_ij equals the true label C_iخطأ Top-5: تُحسب الصورة i خاطئة فقط إذا لم تساوِ أيٌّ من تسمياتها الخمس المعادة c_ij التسميةَ الصحيحة C_i

The other rule, Top-1 accuracy, keeps only the single highest-scoring class and counts the fraction of images where it matches. It is stricter, so the same model always scores worse on top-1 than on top-5. Slides 5 and 6 use top-1 accuracy; slide 4 uses top-5 error. Keeping the two apart is the single most common slip in reading this part of the deck.

القاعدة الأخرى، Top-1 accuracy، تحتفظ فقط بالصنف صاحب أعلى درجة، وتحسب نسبة الصور التي يطابق فيها الوسم الصحيح. هي أشد صرامة، ولذلك يحصل النموذج نفسه دائمًا على نتيجة أسوأ في top-1 منها في top-5. الشريحتان 5 و6 تستخدمان دقة top-1، والشريحة 4 تستخدم خطأ top-5. الفصل بين الاثنين هو أهم ما يجب الانتباه له، فالخلط بينهما أكثر زلة شيوعًا عند قراءة هذا الجزء من الشرائح.

The same AlexNet predictions under both rulesتنبؤات AlexNet نفسها وفق القاعدتين

Mushroom (top guess agaric, mushroom second)الفطر (التخمين الأول agaric، وmushroom في المرتبة الثانية)
Top-5 hit, top-1 missإصابة في top-5، وإخفاق في top-1
Cherry (top guess dalmatian, cherry absent)الكرز (التخمين الأول dalmatian، وcherry غائب)
Top-5 miss, top-1 missإخفاق في top-5، وإخفاق في top-1
Container ship (top guess container ship)سفينة الحاويات (التخمين الأول container ship)
Top-5 hit, top-1 hitإصابة في top-5، وإصابة في top-1

Eight years of the winning entryثماني سنوات من المشاركة الفائزة

With the metric fixed, the bar chart reads as a history. The winning top-5 error went from 28.2% in 2010 and 25.8% in 2011 to 16.4% in 2012, when SuperVision, the entry now called AlexNet, was the first deep convolutional network to win. The error kept falling as the networks deepened: Clarifai at 11.7% in 2013, GoogLeNet at 6.7% in 2014, ResNet at 3.57% in 2015 with an ensemble of residual networks up to 152 layers deep (He et al., 2016), Trimps-Soushen at 2.99% in 2016 and SENet at 2.25% in 2017 (Hu et al., 2018). The slide rounds those to one decimal.

بعد تثبيت المقياس يُقرأ المخطط العمودي كتاريخ. انتقل خطأ top-5 الفائز من 28.2% في 2010 و25.8% في 2011 إلى 16.4% في 2012، عندما كانت SuperVision، المشاركة التي تسمى الآن AlexNet، أول شبكة التفافية عميقة تفوز. واستمر الخطأ في الانخفاض مع ازدياد عمق الشبكات: Clarifai بنسبة 11.7% في 2013، وGoogLeNet بنسبة 6.7% في 2014، وResNet بنسبة 3.57% في 2015 بمجموعة (ensemble) من الشبكات المتبقية (residual) يصل عمقها إلى 152 طبقة (He et al., 2016)، وTrimps-Soushen بنسبة 2.99% في 2016، وSENet بنسبة 2.25% في 2017 (Hu et al., 2018). الشريحة تقرّب هذه القيم إلى منزلة عشرية واحدة.

Winning top-5 error by year. The 2012 bar marks the deep learning break (9.4 points below 2011), and from 2015 the winners sit under the 5.1% human line.خطأ top-5 الفائز حسب السنة. عمود 2012 يمثل اختراق التعلم العميق (أقل بـ 9.4 نقطة من 2011)، ومنذ 2015 يقع الفائزون تحت خط الأداء البشري عند 5.1%.
YearالسنةWinnerالفائزTop-5 error (%)خطأ top-5 (%)Sourceالمصدر
20102010NECNEC28.228.2Russakovsky et al., Table 5Russakovsky et al.، الجدول 5
20112011XRCEXRCE25.825.8Russakovsky et al., Table 5Russakovsky et al.، الجدول 5
20122012SuperVision (AlexNet)SuperVision (AlexNet)16.416.4Russakovsky et al., Table 5Russakovsky et al.، الجدول 5
20132013ClarifaiClarifai11.711.7Russakovsky et al., Table 6Russakovsky et al.، الجدول 6
20142014GoogLeNetGoogLeNet6.76.7Russakovsky et al., Table 7Russakovsky et al.، الجدول 7
20152015ResNet (ensemble of six models, deepest 152 layers)ResNet (مجموعة من ست نماذج، أعمقها 152 طبقة)3.6 (3.57)3.6 (3.57)He et al., 2016He et al., 2016
20162016Trimps-SoushenTrimps-Soushen3.0 (2.99)3.0 (2.99)ILSVRC 2016 resultsنتائج ILSVRC 2016
20172017SENet (WMW)SENet (WMW)2.3 (2.25)2.3 (2.25)Hu et al., 2018Hu et al., 2018
HumanالإنسانOne trained annotatorمُوسِّم واحد مدرَّب5.15.1Russakovsky et al., Sec. 6.4Russakovsky et al.، القسم 6.4
ILSVRC winning entries, top-5 error on the test setالمشاركات الفائزة في ILSVRC، وخطأ top-5 على مجموعة الاختبار

Worked exampleمثال محلول

Reading the dropقراءة الانخفاض

  1. The deep learning breakاختراق التعلم العميق

    2011 to 2012: 25.8 - 16.4 = 9.4 percentage points, a relative reduction of 9.4 / 25.8 = 36% in one year, after the previous year had removed only 2.4 points.
    من 2011 إلى 2012: 25.8 - 16.4 = 9.4 نقطة مئوية، أي انخفاض نسبي قدره 9.4 / 25.8 = 36% في سنة واحدة، بعد أن أزالت السنة السابقة 2.4 نقطة فقط.
  2. Two more years of depthسنتان أخريان من العمق

    2012 to 2014: 16.4 / 6.7 = 2.45x lower error with GoogLeNet, a 22-layer network (Szegedy et al., 2015).
    من 2012 إلى 2014: خطأ أقل بـ 16.4 / 6.7 = 2.45x مع GoogLeNet، وهي شبكة من 22 طبقة (Szegedy et al., 2015).
  3. Crossing the human lineعبور الخط البشري

    ResNet's 3.57% in 2015 is the first winning entry below the 5.1% human estimate, and by 2017 the gap is 5.1 - 2.25 = 2.85 points in the machine's favor.
    نسبة 3.57% التي حققها ResNet في 2015 هي أول مشاركة فائزة تقل عن التقدير البشري البالغ 5.1%، وبحلول 2017 صارت الفجوة 5.1 - 2.25 = 2.85 نقطة لصالح الآلة.
  4. Resultالنتيجة

    Over eight years the winning error fell from 28.2% to 2.3%, about 12x lower, and nearly all of it came after the switch to deep networks.
    على مدى ثماني سنوات انخفض الخطأ الفائز من 28.2% إلى 2.3%، أي أقل بنحو 12x، وجاء كله تقريبًا بعد التحول إلى الشبكات العميقة.

What "super-human" actually means hereماذا يعني "أفضل من البشر" هنا فعلًا

The human bar is not an average person. It is one expert annotator who trained on 500 images and then labeled 1500 test images at roughly one per minute, reaching 5.1% top-5 error; a second annotator with less training scored 12.0%, and GoogLeNet scored 6.8% on the same sample (Russakovsky et al., 2015, Sec. 6.4). So "DNNs achieve super-human accuracy" means that from 2015 the winning network beats a well-trained, patient human on the top-5 rule for 1000 fine-grained classes, many of them dog breeds. It says nothing about general vision, and it says nothing about top-1.

العمود البشري لا يمثل شخصًا عاديًا. إنه مُوسِّم خبير واحد تدرّب على 500 صورة ثم وسم 1500 صورة اختبار بمعدل صورة في الدقيقة تقريبًا، فوصل إلى خطأ top-5 قدره 5.1%. ومُوسِّم ثانٍ بتدريب أقل حصل على 12.0%، وحصل GoogLeNet على 6.8% على العينة نفسها (Russakovsky et al., 2015, Sec. 6.4). إذن عبارة "DNNs achieve super-human accuracy" تعني أن الشبكة الفائزة منذ 2015 تتفوق على إنسان مدرَّب جيدًا وصبور وفق قاعدة top-5 على 1000 صنف دقيق التفاصيل، كثير منها سلالات كلاب. ولا تقول شيئًا عن الرؤية العامة، ولا تقول شيئًا عن top-1.

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

In ILSVRC top-5 evaluation, when does one image count as correctly classified?في تقييم top-5 لمسابقة ILSVRC، متى تُحسب الصورة الواحدة مصنفة تصنيفًا صحيحًا؟

Recall

Define top-5 error precisely. Is the mushroom image, with top guess agaric and mushroom second, a top-5 hit? Is the cherry image?عرّف خطأ top-5 بدقة. هل صورة الفطر، التي تخمينها الأول agaric وmushroom في المرتبة الثانية، إصابة في top-5؟ وماذا عن صورة الكرز؟

Top-5 error is the fraction of test images whose true label does not appear among the five highest-scoring predicted classes. The mushroom is a top-5 hit (and a top-1 miss). The cherry is a miss under both rules, because cherry is not among its five labels.
خطأ top-5 هو نسبة صور الاختبار التي لا يظهر وسمها الحقيقي بين الأصناف الخمسة المتنبأ بها صاحبة أعلى الدرجات. صورة الفطر إصابة في top-5 (وإخفاق في top-1). صورة الكرز إخفاق وفق القاعدتين، لأن cherry ليس بين وسومها الخمسة.

Take two models from the same family. ResNet-50 needs about 3.8 billion multiply-adds per image and ResNet-101 about 7.6 billion, twice as many (He et al., 2016, Table 1). On slide 5 they sit at about 75.3% and 76.4% top-1 accuracy. Doubling the work bought about one percentage point. That one pair is the message of the slide: high accuracy comes at the cost of high computation, and the exchange rate gets worse as you climb.

خذ نموذجين من العائلة نفسها. يحتاج ResNet-50 نحو 3.8 billion عملية ضرب وجمع لكل صورة، وResNet-101 نحو 7.6 billion، أي الضعف (He et al., 2016, Table 1). في الشريحة 5 يقعان عند دقة top-1 تقارب 75.3% و76.4%. مضاعفة العمل اشترت نحو نقطة مئوية واحدة. هذا الزوج وحده هو رسالة الشريحة: الدقة العالية تأتي على حساب حوسبة عالية، وسعر الصرف يسوء كلما صعدت.

To read the chart you need its currency. The horizontal axis counts MACs, multiply-accumulate operations: one multiplication of an input by a weight, immediately added into a running sum. Sze and colleagues call the MAC "the fundamental component" of both convolutional and fully connected layers (Sze et al., 2017). Counting MACs gives a hardware-neutral cost: the number is a property of the model and the input size, not of the chip, unlike latency or energy which change with every device. A convolutional layer's count follows directly from its shape.

لكي تقرأ المخطط تحتاج إلى عملته. المحور الأفقي يعدّ MACs، أي عمليات الضرب والجمع التراكمي: ضرب مدخل واحد في وزن، ثم إضافة الناتج فورًا إلى مجموع جارٍ. يسمي Sze وزملاؤه عملية MAC "المكوّن الأساسي" (the fundamental component) للطبقات الالتفافية والطبقات المتصلة بالكامل معًا (Sze et al., 2017). عدّ MACs يعطي تكلفة مستقلة عن العتاد: الرقم خاصية للنموذج وحجم المدخل، لا للشريحة، بخلاف زمن الاستجابة أو الطاقة اللذين يتغيران مع كل جهاز. وعدد عمليات الطبقة الالتفافية ينتج مباشرة من أبعادها.

MACsconv=Hout⋅Wout⋅Cout⋅Cin⋅kh⋅kw\text{MACs}_{\text{conv}} = H_{\text{out}} \cdot W_{\text{out}} \cdot C_{\text{out}} \cdot C_{\text{in}} \cdot k_h \cdot k_w
Every output value needs one MAC per input channel per kernel positionكل قيمة مخرجة تحتاج MAC واحدة لكل قناة إدخال ولكل موضع في النواة

Worked exampleمثال محلول

One 3 by 3 layerطبقة واحدة بحجم 3 في 3

  1. Shapeالأبعاد

    A 3 x 3 convolution with 64 input and 64 output channels producing a 56 x 56 map.
    طبقة التفاف 3 x 3 بـ 64 قناة دخل و64 قناة خرج تنتج خريطة بحجم 56 x 56.
  2. Multiply outاضرب الأبعاد

    56 x 56 x 64 x 64 x 9 = 115,605,504 MACs.
    56 x 56 x 64 x 64 x 9 = 115,605,504 عملية MAC.
  3. Resultالنتيجة

    About 0.116 GMACs for a single layer. ResNet-50 has dozens of such layers, which is how it reaches 3.9 GMACs per image.
    نحو 0.116 GMACs لطبقة واحدة فقط. ويحتوي ResNet-50 على عشرات الطبقات المشابهة، وهكذا يصل إلى 3.9 GMACs لكل صورة.

How to read a bubble chartكيف تقرأ مخطط الفقاعات

Three quantities share the chart. Horizontal position is cost in billions of MACs, so left is cheaper. Vertical position is Top-1 accuracy on ImageNet, so up is better. Bubble area is Model size, the number of parameters, from 2 M to 64 M according to the legend. Parameters measure storage (how many bytes the weights occupy) and MACs measure work (how many operations each input triggers), and the two are related but not the same. Circles are handcrafted architectures and stars are found by AutoML, which becomes important on the next slide. The goal region is the upper left: high accuracy at low cost.

ثلاث كميات تتشارك المخطط. الموضع الأفقي هو التكلفة بمليارات MACs، فاليسار أرخص. الموضع العمودي هو Top-1 accuracy على ImageNet، فالأعلى أفضل. ومساحة الفقاعة هي Model size، أي عدد المعاملات، من 2 M إلى 64 M وفق مفتاح الرسم. عدد المعاملات يقيس التخزين (كم بايتًا تشغل الأوزان)، وMACs تقيس العمل (كم عملية يطلقها كل مدخل)، والاثنان مرتبطان لكنهما ليسا الشيء نفسه. الدوائر معماريات مصممة يدويًا، والنجوم وجدها AutoML، وهذا يصبح مهمًا في الشريحة التالية. المنطقة المطلوبة هي الزاوية العليا اليسرى: دقة عالية بتكلفة منخفضة.

Slide 5 as geometry: handcrafted bubbles sized by parameters. The staircase is the best accuracy available at each MAC budget; the stars and the second staircase preview slide 6.الشريحة 5 في صورة هندسية: فقاعات النماذج المصممة يدويًا بحجم يتناسب مع عدد المعاملات. الدرج هو أفضل دقة متاحة عند كل ميزانية MACs، والنجوم والدرج الثاني تمهيد للشريحة 6.
ModelالنموذجMACs (B)MACs (B)Top-1 (%)Top-1 (%)ParametersالمعاملاتWhere the number comes fromمصدر الرقم
MobileNetV1MobileNetV10.570.5770.670.64.2 M4.2 Mpaper (Howard et al.)الورقة (Howard et al.)
IGCV3-DIGCV3-D0.30.372.372.3about 3.5 Mنحو 3.5 Mchartالمخطط
InceptionV2InceptionV22.02.074.874.8about 11 Mنحو 11 Mchartالمخطط
DenseNet-121DenseNet-1212.92.975.075.0about 8 Mنحو 8 Mchartالمخطط
DenseNet-169DenseNet-1693.43.476.276.2about 14 Mنحو 14 Mchartالمخطط
ResNet-50ResNet-503.93.975.375.325.5 M25.5 MMACs and params from Sze et al., accuracy from the chartMACs والمعاملات من Sze et al.، والدقة من المخطط
ResNeXt-50ResNeXt-504.24.277.877.8about 25 Mنحو 25 Mchartالمخطط
DenseNet-264DenseNet-2645.75.777.877.8about 33 Mنحو 33 Mchartالمخطط
InceptionV3InceptionV35.75.778.878.8about 24 Mنحو 24 Mchartالمخطط
DPN-92DPN-926.56.579.379.3about 38 Mنحو 38 Mchartالمخطط
ResNet-101ResNet-1017.67.676.476.444.5 M44.5 MMACs from He et al. (Table 1); parameters from torchvisionMACs من He et al. (الجدول 1)، والمعاملات من torchvision
ResNeXt-101ResNeXt-1018.08.078.978.9about 44 Mنحو 44 Mchartالمخطط
XceptionXception8.48.479.079.0about 23 Mنحو 23 Mparams from Cholletالمعاملات من Chollet
The handcrafted models on slide 5 (values marked chart are read from the figure and approximate)النماذج المصممة يدويًا في الشريحة 5 (القيم الموسومة بـ chart مقروءة من الشكل وتقريبية)

Diminishing returnsتناقص العائد

Trace the chart from the cheapest model upward and the exchange rate collapses. For each step, divide the accuracy gained by the extra MACs spent. MobileNetV1 is the cheap starting point at 70.6% for 0.57 B MACs (Howard et al., 2017); every other number below is read from the chart.

تتبّع المخطط من أرخص نموذج صعودًا وستجد أن سعر الصرف ينهار. في كل خطوة، اقسم الدقة المكتسبة على MACs الإضافية المنفقة. MobileNetV1 هو نقطة البداية الرخيصة عند 70.6% مقابل 0.57 B MACs (Howard et al., 2017)، وكل رقم آخر أدناه مقروء من المخطط.

points per billion=Top-1new−Top-1oldMACsnew−MACsold\text{points per billion} = \frac{\text{Top-1}_{\text{new}} - \text{Top-1}_{\text{old}}}{\text{MACs}_{\text{new}} - \text{MACs}_{\text{old}}}
The marginal accuracy bought by each extra billion MACsالدقة الحدّية المكتسبة مقابل كل مليار MAC إضافية
UpgradeالترقيةExtra MACs (B)MACs إضافية (B)Extra top-1 (points)زيادة top-1 (نقاط)Points per billion MACsالنقاط لكل مليار MACs
MobileNetV1 to ResNet-50من MobileNetV1 إلى ResNet-503.9 - 0.57 = 3.333.9 - 0.57 = 3.3375.3 - 70.6 = 4.775.3 - 70.6 = 4.74.7 / 3.33 = 1.414.7 / 3.33 = 1.41
ResNet-50 to Xceptionمن ResNet-50 إلى Xception8.4 - 3.9 = 4.58.4 - 3.9 = 4.579.0 - 75.3 = 3.779.0 - 75.3 = 3.73.7 / 4.5 = 0.823.7 / 4.5 = 0.82
ResNet-50 to ResNet-101من ResNet-50 إلى ResNet-1017.6 - 3.9 = 3.77.6 - 3.9 = 3.776.4 - 75.3 = 1.176.4 - 75.3 = 1.11.1 / 3.7 = 0.301.1 / 3.7 = 0.30
Three upgrades on slide 5, cheapest firstثلاث ترقيات في الشريحة 5، الأرخص أولًا

The marginal value of computation falls almost fivefold across the chart, from 1.41 to 0.30 points per billion, and the worst trade is inside a single family. Notice also that Xception is itself dominated: DPN-92 is more accurate (79.3%) with fewer MACs (6.5 B).

تنخفض القيمة الحدّية للحوسبة نحو خمسة أضعاف عبر المخطط، من 1.41 إلى 0.30 نقطة لكل مليار، وأسوأ صفقة تقع داخل عائلة واحدة. ولاحظ أيضًا أن Xception نفسه مُهيمَن عليه (dominated): DPN-92 أدق منه (79.3%) وبعدد أقل من MACs (6.5 B).

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

On slide 5, which quantity does the area of each bubble encode?في الشريحة 5، ما الكمية التي تمثلها مساحة كل فقاعة؟

Now put the stars back on the chart. Once-for-All (OFA) reaches 80.0% top-1 with 595 M MACs (Cai et al., 2020). Xception, the most expensive handcrafted model on the previous slide and within 0.3 points of the most accurate (DPN-92), needed about 8.4 B for 79.0%. Divide and you get 8400 / 595 = 14.1: the same accuracy, or one point more, for one fourteenth of the computation. That is the dashed arrow at the top of slide 6, and it is drawn straight from Figure 2 of the Once-for-All paper.

الآن أعد النجوم إلى المخطط. يصل Once-for-All (OFA) إلى دقة top-1 تبلغ 80.0% بـ 595 M MACs (Cai et al., 2020). أما Xception، أغلى نموذج مصمم يدويًا في الشريحة السابقة والذي يبعد 0.3 نقطة فقط عن الأدق (DPN-92)، فقد احتاج نحو 8.4 B للوصول إلى 79.0%. اقسم فتحصل على 8400 / 595 = 14.1: الدقة نفسها، أو نقطة أكثر، مقابل جزء من أربعة عشر من الحوسبة. هذا هو السهم المتقطع في أعلى الشريحة 6، وهو مرسوم مباشرة من الشكل 2 في ورقة Once-for-All.

Worked exampleمثال محلول

Reduction ratiosنسب التقليل

  1. Convert to one unitحوّل إلى وحدة واحدة

    Xception 8.4 B = 8400 M MACs; ResNet-50 3.9 B = 3900 M; Once-for-All 595 M.
    Xception: 8.4 B = 8400 M MACs، وResNet-50: 3.9 B = 3900 M، وOnce-for-All: 595 M.
  2. Divide reference by newاقسم المرجع على الجديد

    8400 / 595 = 14.1 and 3900 / 595 = 6.6.
    8400 / 595 = 14.1 و3900 / 595 = 6.6.
  3. Resultالنتيجة

    Once-for-All needs 14x less computation than Xception and 6.6x less than ResNet-50 while being more accurate than both.
    يحتاج Once-for-All إلى حوسبة أقل بـ 14x من Xception وأقل بـ 6.6x من ResNet-50، وهو مع ذلك أدق من الاثنين.
ModelالنموذجMACs (B)MACs (B)Top-1 (%)Top-1 (%)Reduction relative to OFAالتقليل نسبةً إلى OFA
MobileNetV1MobileNetV10.5690.56970.670.60.96x (about the same budget)0.96x (الميزانية نفسها تقريبًا)
ResNet-50ResNet-503.93.975.375.36.6x6.6x
XceptionXception8.48.479.079.014.1x14.1x
Once-for-AllOnce-for-All0.5950.59580.080.01x (reference)1x (المرجع)
Once-for-All against three handcrafted references (reduction is reference MACs divided by 595 M)Once-for-All مقارنة بثلاثة نماذج مرجعية مصممة يدويًا (التقليل هو MACs المرجع مقسومة على 595 M)

The MobileNetV1 row makes the point from the other side: at essentially the same budget, the searched model is 9.4 points more accurate. The stars are all products of Neural architecture search (NAS): rather than a person choosing kernel sizes, widths and depths, an algorithm searches over them under an explicit MAC or latency budget. EfficientNet, NASNet-A, MobileNetV3, ProxylessNAS, AmoebaNet, PNASNet and DARTS all sit inside the boxed region below about 2.5 B MACs, next to two efficient handcrafted models, MobileNetV2 and ShuffleNet. Once-for-All adds one more idea: train a single large network once, then cut specialized sub-networks out of it for each device, which is what makes the 80.0% at 595 M affordable to produce as well as to run.

صف MobileNetV1 يوضح الفكرة من الجهة الأخرى: عند الميزانية نفسها تقريبًا، النموذج الناتج عن البحث أدق بـ 9.4 نقطة. النجوم كلها نتاج Neural architecture search (NAS): بدلًا من أن يختار شخصٌ أحجام النوى والعرض والعمق، تبحث خوارزمية فيها تحت ميزانية صريحة من MACs أو زمن الاستجابة. EfficientNet وNASNet-A وMobileNetV3 وProxylessNAS وAmoebaNet وPNASNet وDARTS كلها تقع داخل المنطقة المحاطة بإطار تحت نحو 2.5 B MACs، بجانب نموذجين كفؤين مصممين يدويًا هما MobileNetV2 وShuffleNet. ويضيف Once-for-All فكرة أخرى: درّب شبكة كبيرة واحدة مرة واحدة، ثم اقتطع منها شبكات فرعية متخصصة لكل جهاز، وهذا ما يجعل 80.0% عند 595 M ميسورة التكلفة في إنتاجها وليس في تشغيلها فقط.

The frontier and why it moves leftالحدّ ولماذا يتحرك نحو اليسار

The two arrows on the slide, "the higher the better" and "the lower the better", state the accuracy-efficiency trade-off as a partial order. Model A dominates model B if A is at least as accurate and at most as costly, with one of the two strictly better. The models nobody dominates form the Pareto frontier, the staircase you saw in the last visual. Every point below or to the right of it is a worse deal than something already available. Architecture search did not just add good models; it moved the entire staircase left, so that the best accuracy at 0.6 B MACs today exceeds the best at 8 B a few years earlier.

السهمان في الشريحة، "the higher the better" (الأعلى أفضل) و"the lower the better" (الأقل أفضل)، يعبّران عن مقايضة الدقة والكفاءة بوصفها ترتيبًا جزئيًا. النموذج A يهيمن على النموذج B إذا كان A بالدقة نفسها على الأقل وبالتكلفة نفسها على الأكثر، مع تفوّق صارم في أحد الاثنين. النماذج التي لا يهيمن عليها أحد تشكّل حدّ باريتو، وهو الدرج الذي رأيته في الشكل الأخير. كل نقطة تحته أو إلى يمينه صفقة أسوأ من شيء متاح بالفعل. البحث عن المعماريات لم يكتفِ بإضافة نماذج جيدة، بل نقل الدرج كله نحو اليسار، بحيث صارت أفضل دقة عند 0.6 B MACs اليوم تتجاوز أفضل دقة عند 8 B قبل بضع سنوات.

A≻B  ⟺  AccA≥AccB ∧ MACsA≤MACsB, with at least one strictA \succ B \iff \text{Acc}_A \ge \text{Acc}_B \ \wedge\ \text{MACs}_A \le \text{MACs}_B,\ \text{with at least one strict}
Dominance on the accuracy versus MACs plane; the frontier is the set of undominated modelsالهيمنة على مستوى الدقة مقابل MACs؛ والحد (frontier) هو مجموعة النماذج غير المهيمَن عليها
ExplorerمستكشفAccuracy versus MACsالدقة مقابل MACs
Showاعرض
012345678969717375777981MACs (billion), lower is bettertop-1 (%), higher is betterIGCV3-D
Reduction ratio13xless3.900 ÷ 0.300 B MACs
Accuracy changeتغير الدقة-3.0points72.3 minus 75.372.3 ناقص 75.3
Points per extra B MACsنقاط الدقة لكل مليار MACs إضافية+0.83accuracy change divided by MACs changeتغير الدقة مقسومًا على تغير MACs
Selectedالمختار
IGCV3-D
Baselineخط الأساس
ResNet-50
Parametersالمعاملات
3.5 M
Sourceالمصدر
read from the chartمقروءة من الرسم البياني

The dashed staircase is the Pareto frontier of the visible set: a point stays on it only when no other visible model has both higher accuracy and fewer MACs. Switch from Handcrafted to AutoML and watch the frontier jump left. Values marked as read from the chart are approximate.الدرج المتقطع هو حد باريتو (Pareto frontier) للنماذج الظاهرة: تبقى النقطة عليه فقط إذا لم يوجد نموذج ظاهر آخر يجمع بين دقة أعلى وعدد أقل من MACs. انتقل من Handcrafted إلى AutoML وراقب الحد يقفز إلى اليسار. القيم الموسومة بأنها مقروءة من الرسم البياني تقريبية.

The slide names the payoff in two lines. Efficient deep learning enables daily-life applications on mobile phones, which is why the Once-for-All paper defines a "mobile setting" as anything under 600 M MACs and reports being the first to reach 80% inside it. And it enables private on-device Inference and training, the theme of the last concept in this part. Both follow from the same fact: a model that costs fourteen times less can live on a device that has fourteen times less to spend.

تسمّي الشريحة المكسب في سطرين. التعلم العميق الكفء يمكّن تطبيقات الحياة اليومية على الهواتف المحمولة، ولهذا تعرّف ورقة Once-for-All "البيئة المحمولة" (mobile setting) بأنها أي شيء تحت 600 M MACs، وتذكر أنها أول من وصل إلى 80% داخلها. ويمكّن كذلك Inference والتدريب على الجهاز بخصوصية، وهو موضوع المفهوم الأخير في هذا الجزء. كلاهما ينتج من الحقيقة نفسها: النموذج الذي يكلّف أقل بأربع عشرة مرة يمكنه أن يعيش على جهاز لديه أقل بأربع عشرة مرة لينفقه.

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

Xception needs about 8.4B MACs for 79.0% top-1 and Once-for-All 595M MACs for 80.0%. By what factor is computation reduced?يحتاج Xception إلى نحو 8.4B MACs لدقة top-1 تبلغ 79.0%، ويحتاج Once-for-All إلى 595M MACs لدقة 80.0%. بأي معامل تقل الحوسبة؟

Recall

ResNet-50 needs 3.9B MACs, Xception 8.4B, and Once-for-All 595M. Compute both reduction ratios.يحتاج ResNet-50 إلى 3.9B MACs، وXception إلى 8.4B، وOnce-for-All إلى 595M. احسب نسبتي التقليل.

3900 / 595 = 6.6x and 8400 / 595 = 14.1x.
3900 / 595 = 6.6x و8400 / 595 = 14.1x.

Slide 7 shows two photographs of a small camera board on a desk. In one it reports whether the person in front of it wears a face mask; in the other it detects people in an office. There is no phone, no laptop and no network cable in the picture. The board is an OpenMV Cam, whose processor is an ARM Cortex-M7 Microcontroller (MCU), and the software is MCUNet, a framework from the same lab as Once-for-All (Lin et al., 2020).

تعرض الشريحة 7 صورتين للوحة كاميرا صغيرة على مكتب. في إحداهما تخبر اللوحة إن كان الشخص الذي أمامها يرتدي كمامة، وفي الأخرى تكتشف الأشخاص في مكتب. لا يوجد في الصورة هاتف ولا حاسوب محمول ولا كابل شبكة. اللوحة هي OpenMV Cam، ومعالجها Microcontroller (MCU) من نوع ARM Cortex-M7، والبرمجيات هي MCUNet، وهو إطار عمل من المختبر نفسه الذي أنتج Once-for-All (Lin et al., 2020).

This is TinyML: machine learning on devices with kilobytes of memory. MCUNet's reference target, the STM32F746, has 320 kB of SRAM and 1 MB of flash, and its Table 1 lines that up against a phone and a cloud GPU. The OpenMV Cam H7 in the photos is a somewhat larger sibling: STM32H743 at 480 MHz, with 1 MB of RAM in total, of which MCUNet's experiments use the 512 kB main SRAM block, and 2 MB flash (OpenMV). Both are bare-metal devices with no operating system and no DRAM. Slide 23 returns to these exact numbers as the tiny AI column of the hardware tiers. Its cloud and mobile columns are updated to an 80 GB GPU and a 256 GB phone, so expect those two cells to differ from the table below while the microcontroller column stays the same.

هذا هو TinyML: تعلم الآلة على أجهزة ذاكرتها بالكيلوبايت. الهدف المرجعي لـ MCUNet، وهو STM32F746، فيه 320 kB من SRAM و1 MB من flash، والجدول 1 في الورقة يضعه في مقابل الهاتف ووحدة GPU السحابية. لوحة OpenMV Cam H7 في الصور شقيقة أكبر قليلًا: STM32H743 بتردد 480 MHz، مع 1 MB من RAM إجمالًا، تستخدم تجارب MCUNet منها كتلة SRAM الرئيسية البالغة 512 kB، و2 MB من flash (OpenMV). كلا الجهازين يعمل مباشرة على العتاد (bare-metal) بلا نظام تشغيل وبلا DRAM. تعود الشريحة 23 إلى هذه الأرقام نفسها بوصفها عمود الذكاء الاصطناعي الصغير في مستويات العتاد. لكن عموديها للسحابة والهاتف محدّثان إلى GPU بسعة 80 GB وهاتف بسعة 256 GB، فتوقع أن تختلف هاتان الخانتان عن الجدول أدناه بينما يبقى عمود المتحكم الدقيق كما هو.

TierالمستوىMemoryالذاكرةStorageالتخزينGap from the tier aboveالفجوة عن المستوى الأعلى
Cloud AI (NVIDIA V100)ذكاء اصطناعي سحابي (NVIDIA V100)16 GB16 GBTB to PBمن TB إلى PBreferenceالمرجع
Mobile AI (iPhone 11)ذكاء اصطناعي في الهاتف (iPhone 11)4 GB4 GBmore than 64 GBأكثر من 64 GB4x less memory, 1000x less storageذاكرة أقل بـ 4x، وتخزين أقل بـ 1000x
Tiny AI (STM32F746)ذكاء اصطناعي صغير (STM32F746)320 kB320 kB1 MB1 MBtable prints 3100x less memory, 64000x less storageيطبع الجدول ذاكرة أقل بـ 3100x، وتخزينًا أقل بـ 64000x
MCUNet Table 1: memory and storage across three tiers of AI hardwareالجدول 1 في MCUNet: الذاكرة والتخزين عبر ثلاثة مستويات من عتاد الذكاء الاصطناعي
Memory on a log scale: 16 GB, 4 GB and 320 kB. Even an int8 MobileNetV2 at 1.7 MB overshoots the microcontroller's SRAM by 5.3x.الذاكرة على مقياس لوغاريتمي: 16 GB و4 GB و320 kB. حتى MobileNetV2 بتكميم int8 بحجم 1.7 MB يتجاوز SRAM المتحكم الدقيق بـ 5.3x.

Why nothing off the shelf fitsلماذا لا يتسع أي نموذج جاهز

The paper gives three failures. ResNet-50's weight storage is about 102 MB, 100x the flash. MobileNetV2 needs about 6.8 MB of peak activation memory, 22x the SRAM (the paper rounds up). Even the int8-quantized MobileNetV2 peaks at 1.7 MB, still 5.3x over, and that is before the runtime's own buffers. Reaching the board required designing the network and the inference engine together: TinyNAS searches architectures under the exact memory limits and TinyEngine executes them without interpreter overhead, and MCUNet as a whole uses 3.5x less SRAM and 5.7x less flash than int8 MobileNetV2 and ResNet-18 at similar accuracy. The result is 70.7% ImageNet top-1 on an STM32H743 (the OpenMV H7 chip, which MCUNet evaluates under a 512 kB SRAM and 2 MB flash budget, although the board has 1 MB of SRAM in total), the first time that bar was reached on an off-the-shelf microcontroller, and about 62% inside the 320 kB / 1 MB budget of the F746 (Lin et al., 2020, Table 4, 4-bit).

تذكر الورقة ثلاثة إخفاقات. تخزين الأوزان في ResNet-50 نحو 102 MB، أي 100x من سعة flash. ويحتاج MobileNetV2 نحو 6.8 MB من ذاكرة التنشيط القصوى، أي 22x من SRAM (الورقة تقرّب إلى الأعلى). وحتى MobileNetV2 المكمَّم بـ int8 تبلغ ذروته 1.7 MB، أي ما زال أكبر بـ 5.3x، وهذا قبل حساب المخازن المؤقتة الخاصة ببيئة التشغيل نفسها. الوصول إلى اللوحة تطلّب تصميم الشبكة ومحرك الاستدلال معًا: TinyNAS يبحث عن المعماريات تحت حدود الذاكرة الدقيقة، وTinyEngine ينفذها دون عبء المفسِّر، وMCUNet ككل يستخدم SRAM أقل بـ 3.5x وflash أقل بـ 5.7x مقارنة بـ MobileNetV2 وResNet-18 المكمَّمين بـ int8 بدقة مماثلة. والنتيجة دقة top-1 على ImageNet قدرها 70.7% على STM32H743 (شريحة OpenMV H7، التي يقيّمها MCUNet تحت ميزانية 512 kB من SRAM و2 MB من flash، مع أن في اللوحة 1 MB من SRAM إجمالًا)، وهي أول مرة يُبلغ فيها هذا المستوى على متحكم دقيق جاهز من السوق، ونحو 62% داخل ميزانية 320 kB / 1 MB الخاصة بـ F746 (Lin et al., 2020, Table 4, 4-bit).

Worked exampleمثال محلول

Does ResNet-50 fit?هل يتسع ResNet-50؟

  1. Weights in FP32الأوزان بصيغة FP32

    25.5 M parameters times 4 bytes is 102 MB, matching the paper.
    25.5 M معامل مضروبة في 4 بايت تساوي 102 MB، وهذا يطابق الورقة.
  2. Against 1 MB of flashمقابل 1 MB من flash

    102 / 1 = 102x too large.
    102 / 1 = 102x أكبر من اللازم.
  3. Even at 8 bitsحتى بـ 8 بت

    25.5 MB, still 25x too large; quantization alone cannot save it.
    25.5 MB، أي ما زال أكبر من اللازم بـ 25x، فالتكميم وحده لا يستطيع إنقاذه.
  4. Resultالنتيجة

    Fitting a microcontroller needs a different architecture, not a compressed copy of a server model.
    ملاءمة متحكم دقيق تحتاج إلى معمارية مختلفة، لا إلى نسخة مضغوطة من نموذج خوادم.

The reasons to bother are the same four from the first concept, now at their most extreme. MCUNet points out that there are around 250 billion microcontrollers in the world, that processing raw sensor data at the source protects privacy because nothing is transmitted, and that inference on the node works in places without Internet access (Lin et al., 2020). A mask detector on a camera board costs a few dollars, runs on milliwatts and never uploads a face.

أسباب تحمّل هذا العناء هي الأسباب الأربعة نفسها من المفهوم الأول، لكنها الآن في أقصى صورها. يشير MCUNet إلى أن في العالم نحو 250 billion متحكم دقيق، وأن معالجة بيانات الاستشعار الخام عند مصدرها تحمي الخصوصية لأنه لا يُرسَل شيء، وأن الاستدلال على العقدة يعمل في أماكن بلا إنترنت (Lin et al., 2020). كاشف الكمامات على لوحة كاميرا يكلّف بضعة دولارات، ويعمل بالمللي واط، ولا يرفع وجهًا أبدًا.

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

What memory gap does MCUNet's Table 1 print between a phone and the microcontroller?ما فجوة الذاكرة التي يطبعها الجدول 1 في MCUNet بين الهاتف والمتحكم الدقيق؟

Recall

What memory and storage does the MCU that MCUNet targets have, and how far is that from a cloud GPU?ما الذاكرة والتخزين في المتحكم الدقيق الذي يستهدفه MCUNet، وكم يبعد ذلك عن GPU سحابية؟

320 kB SRAM and 1 MB flash. A V100 has 16 GB of memory, five orders of magnitude more, and terabytes to petabytes of storage; the paper prints the tiers as 4x then 3100x for memory and 1000x then 64000x for storage.
320 kB من SRAM و1 MB من flash. لدى V100 16 GB من الذاكرة، أي أكثر بخمس رتب عشرية، وتخزين من التيرابايت إلى البيتابايت. وتطبع الورقة المستويات على أنها 4x ثم 3100x للذاكرة، و1000x ثم 64000x للتخزين.

A smart speaker slowly gets better at recognizing the voices in one house. A phone learns its owner's face after the first enrollment. Both need data that arrives after the product shipped, and both kinds of data (a voice, a face) are exactly what users least want uploaded. The figure on slide 8 draws the consequence: new and sensitive data flows from the user to the Edge device, the arrow from the device to the cloud is crossed out for privacy, and a small loop above the device shows the model updating itself where the data is.

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

Data reaches the device and stops. The update loop closes locally; the arrow to the cloud is drawn and then crossed out.البيانات تصل إلى الجهاز وتتوقف عنده. حلقة التحديث تُغلق محليًا، والسهم إلى السحابة مرسوم ثم مشطوب.

That loop is On-device training (learning). The slide lists four benefits. Better privacy, because nothing leaves the device. Lower cost, because there is no upload and no cloud training bill. Customization, because the model adapts to this user, this room, this camera angle. Life-long learning, because the adaptation never has to stop; AI systems, as the slide puts it, need to continually adapt to new data collected locally. Lin and colleagues summarize the goal as letting users benefit from customized models without transferring their data to the cloud (Lin et al., 2022).

هذه الحلقة هي On-device training (learning). تسرد الشريحة أربع فوائد. خصوصية أفضل، لأن لا شيء يغادر الجهاز. تكلفة أقل، لأنه لا يوجد رفع ولا فاتورة تدريب سحابي. التخصيص، لأن النموذج يتكيف مع هذا المستخدم، وهذه الغرفة، وزاوية الكاميرا هذه. التعلم مدى الحياة، لأن التكيف لا يجب أن يتوقف أبدًا، فأنظمة الذكاء الاصطناعي، كما تقول الشريحة، تحتاج إلى التكيف باستمرار مع البيانات الجديدة المجموعة محليًا. ويلخص Lin وزملاؤه الهدف بأنه تمكين المستخدمين من الاستفادة من نماذج مخصصة دون نقل بياناتهم إلى السحابة (Lin et al., 2022).

Why training is so much more expensive than inferenceلماذا التدريب أغلى بكثير من الاستدلال

The third line of the slide is the catch: training is more expensive than Inference, hard to fit in edge memory, and limited by power. All three follow from how backpropagation works. Inference is one forward pass through the layers, and each layer's activations can be discarded as soon as the next layer has consumed them. Training runs the same forward pass, then a backward pass that costs about twice as much: propagating the gradient through each layer is one multiply by the transposed weights, which Goodfellow, Bengio and Courville note has the same cost as the forward multiply (Goodfellow et al., 2016, Sec. 6.5.7), and computing the weight gradient is a second multiply of the same size. So one training step is roughly three times the arithmetic of one inference pass, the convention behind the 6N versus 2N per-token estimate used in scaling studies (Kaplan et al., 2020). The backward pass also needs the activations that the forward pass produced. Goodfellow and colleagues put it directly: the input to each hidden nonlinearity must be stored from the moment it is computed until the backward pass has returned to the same point, so memory grows with the number of examples in the batch and the width of the layers. On top of that, the optimizer keeps its own state: a momentum buffer, or two moment estimates for Adam, each the size of the model.

السطر الثالث في الشريحة هو العقبة: التدريب أغلى من Inference، ويصعب احتواؤه في ذاكرة الحافة، ومحدود بالطاقة. والثلاثة تنتج من طريقة عمل الانتشار العكسي (backpropagation). الاستدلال تمرير أمامي واحد عبر الطبقات، ويمكن التخلص من تنشيطات كل طبقة بمجرد أن تستهلكها الطبقة التالية. أما التدريب فيجري التمرير الأمامي نفسه، ثم تمريرًا عكسيًا يكلّف نحو الضعف: نشر التدرج عبر كل طبقة هو عملية ضرب واحدة في الأوزان المنقولة (transposed)، ويذكر Goodfellow وBengio وCourville أن تكلفتها تساوي تكلفة الضرب الأمامي (Goodfellow et al., 2016, Sec. 6.5.7)، وحساب تدرج الأوزان عملية ضرب ثانية بالحجم نفسه. إذن خطوة تدريب واحدة تساوي تقريبًا ثلاثة أضعاف الحساب في تمرير استدلال واحد، وهذا هو الاصطلاح وراء تقدير 6N مقابل 2N لكل رمز (token) المستخدم في دراسات التوسع (Kaplan et al., 2020). ويحتاج التمرير العكسي أيضًا إلى التنشيطات التي أنتجها التمرير الأمامي. يقولها Goodfellow وزملاؤه صراحة: مدخل كل لاخطية مخفية يجب تخزينه من لحظة حسابه حتى يعود التمرير العكسي إلى النقطة نفسها، فتنمو الذاكرة مع عدد الأمثلة في الدفعة (batch) ومع عرض الطبقات. وفوق ذلك يحتفظ المُحسِّن (optimizer) بحالته الخاصة: مخزن للزخم (momentum)، أو تقديران للعزوم في حالة Adam، كلٌّ منها بحجم النموذج.

ResourceالموردInferenceالاستدلالTrainingالتدريب
Compute per exampleالحوسبة لكل مثالOne forward passتمرير أمامي واحدForward plus backward, about 3x the multiply-adds (backward is about 2x forward)تمرير أمامي ثم خلفي، أي نحو 3x من عمليات الضرب والجمع (التمرير الخلفي يكلّف نحو 2x الأمامي)
ActivationsالتنشيطاتFreed layer by layer as the input flows throughتُحرَّر طبقةً بعد طبقة مع مرور المدخلEvery layer's activations kept until the backward pass returnsتُحفظ تنشيطات كل طبقة حتى يعود التمرير الخلفي إليها
Extra stateالحالة الإضافيةWeights onlyالأوزان فقطWeights, gradients and optimizer state (momentum, Adam moments)الأوزان والتدرجات وحالة المُحسِّن (الزخم، وعزوم Adam)
Memory scalingنمو الذاكرةLargest single layerأكبر طبقة منفردةGrows with depth and batch sizeتنمو مع العمق وحجم الدفعة
What inference and training each have to payما يجب أن يدفعه كل من الاستدلال والتدريب

Worked exampleمثال محلول

Training MobileNetV1 on a microcontroller, naivelyتدريب MobileNetV1 على متحكم دقيق بطريقة ساذجة

  1. Weightsالأوزان

    4.2 M parameters in FP32 is 16.8 MB.
    4.2 M معامل بصيغة FP32 تساوي 16.8 MB.
  2. Gradients and momentumالتدرجات والزخم

    One gradient per weight and one momentum value per weight: two more copies, another 33.6 MB.
    تدرج واحد لكل وزن وقيمة زخم واحدة لكل وزن: نسختان إضافيتان، أي 33.6 MB أخرى.
  3. Total before activationsالمجموع قبل التنشيطات

    50.4 MB of state, against 320 kB of SRAM.
    50.4 MB من الحالة، مقابل 320 kB من SRAM.
  4. Resultالنتيجة

    About 157x over budget before a single activation is stored. Lin et al. (2022) get training under 256 kB by updating only a sparse subset of weights and by training directly on quantized values, using less than a thousandth of the memory of PyTorch or TensorFlow on the same task.
    تجاوز للميزانية بنحو 157x قبل تخزين تنشيط واحد. ويصل Lin et al. (2022) بالتدريب إلى أقل من 256 kB بتحديث مجموعة جزئية متفرقة (sparse) فقط من الأوزان وبالتدريب مباشرة على القيم المكمَّمة، مستخدمين أقل من جزء من الألف من ذاكرة PyTorch أو TensorFlow في المهمة نفسها.

Power is the last constraint. A training step roughly triples the arithmetic of every example, and a device that runs on a battery or a solar cell cannot run it continuously. So on-device learning is not merely inference plus a little bookkeeping; it is a harder problem than the one MCUNet solved, and the course treats it as its own topic.

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

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

Why does the slide 8 figure cross out the arrow from the edge device to the cloud?لماذا يشطب شكل الشريحة 8 السهم من جهاز الحافة إلى السحابة؟

Recall

Give three reasons training is more expensive than inference on a device, and the four benefits of doing it anyway.اذكر ثلاثة أسباب تجعل التدريب أغلى من الاستدلال على الجهاز، والفوائد الأربع للقيام به رغم ذلك.

Costs: the backward pass costs about twice the forward pass, so a training step is roughly three times an inference pass; every layer's activations must be stored until the backward pass returns, scaling with batch size and depth; optimizer state adds extra copies of every parameter. Plus limited power. Benefits: better privacy, lower cost, customization, life-long learning.
التكاليف: التمرير العكسي يكلّف نحو ضعف التمرير الأمامي، فتكون خطوة التدريب نحو ثلاثة أضعاف تمرير الاستدلال، وتنشيطات كل طبقة يجب تخزينها حتى يعود التمرير العكسي، وتتزايد مع حجم الدفعة والعمق، وحالة المُحسِّن تضيف نسخًا إضافية من كل معامل. إضافة إلى الطاقة المحدودة. الفوائد: خصوصية أفضل، وتكلفة أقل، والتخصيص، والتعلم مدى الحياة.

Recapالخلاصة

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

  • Machine learning and deep learning are everywhere and computationally expensive; the course asks how to make them lightweight and fast without losing accuracy.التعلم الآلي والتعلم العميق موجودان في كل مكان ومكلفان حسابيًا، والمقرر يسأل كيف نجعلهما خفيفين وسريعين دون أن نخسر الدقة.
  • Progress rides on three pillars, algorithm, hardware and data; efficiency work in this course lives mainly in the first two.يقوم التقدم على ثلاث ركائز: الخوارزمية والعتاد والبيانات، وعمل الكفاءة في هذا المقرر يقع أساسًا في الركيزتين الأوليين.
  • ImageNet top-5 error fell from 28.2% (2010) to 2.3% (2017); AlexNet cut 9.4 points in 2012; ResNet (3.57%) was the first winner below the 5.1% human estimate.انخفض خطأ top-5 على ImageNet من 28.2% (عام 2010) إلى 2.3% (عام 2017)، وخفّضه AlexNet بمقدار 9.4 نقطة في 2012، وكان ResNet (3.57%) أول فائز يقل عن التقدير البشري البالغ 5.1%.
  • Top-5 error and top-1 accuracy are different metrics: slide 4 uses the first, slides 5 and 6 the second.خطأ top-5 ودقة top-1 مقياسان مختلفان: الشريحة 4 تستخدم الأول، والشريحتان 5 و6 تستخدمان الثاني.
  • MACs count multiply-accumulates per input, a hardware-neutral cost; parameters count storage. More of both buys accuracy with diminishing returns (ResNet-101 doubles the MACs of ResNet-50 for about 1 point).تعدّ MACs عمليات الضرب والجمع التراكمي لكل مدخل، وهي تكلفة مستقلة عن العتاد، بينما يعدّ عدد المعاملات التخزين. زيادة الاثنين تشتري الدقة بعائد متناقص (ResNet-101 يضاعف MACs مقارنة بـ ResNet-50 مقابل نقطة واحدة تقريبًا).
  • Once-for-All (595M MACs, 80.0% top-1) beats Xception with 14x less computation, shifting the Pareto frontier to the upper left.يتفوق Once-for-All (595M MACs، ودقة top-1 تبلغ 80.0%) على Xception بحوسبة أقل بـ 14 مرة، فينزاح حدّ باريتو نحو الأعلى واليسار.
  • MCUNet runs mask and person detection on a Cortex-M7 camera board; its reference MCU has 320 kB SRAM and 1 MB Flash, three to four orders of magnitude below a phone.يشغّل MCUNet كشف الكمامات وكشف الأشخاص على لوحة كاميرا بمعالج Cortex-M7، ومتحكمه المرجعي فيه 320 kB من SRAM و1 MB من Flash، أي أقل من الهاتف بثلاث إلى أربع رتب عشرية.
  • On-device learning gives privacy, lower cost, customization and life-long learning, but a training step costs roughly three times the compute of an inference pass plus stored activations and optimizer state, on limited memory and power.التعلم على الجهاز يمنح الخصوصية وتكلفة أقل والتخصيص والتعلم مدى الحياة، لكن خطوة التدريب تكلّف نحو ثلاثة أضعاف حوسبة تمرير الاستدلال، إضافة إلى تخزين التنشيطات وحالة المُحسِّن، على ذاكرة وطاقة محدودتين.

Sourcesالمصادر