Machine Learning on Embedded Systems
تعلّم الآلة على الأنظمة المدمجة
Midterm study guide
دليل المذاكرة للاختبار النصفي
Fifty-eight pages, one concept block each, covering every lecture so far: introduction, NN fundamentals, efficiency metrics, pruning and sparsity, and quantization. Every page has an explanation, a diagram, a worked example with all the arithmetic, and multiple-choice questions at the bottom.
ثمانٍ وخمسون صفحة، كل صفحة لفكرة واحدة، تغطي كل المحاضرات حتى الآن: المقدمة، وأساسيات الشبكات العصبية (NN)، ومقاييس الكفاءة، والتقليم (pruning) والتناثر (sparsity)، والتكميم (quantization). في كل صفحة شرح ورسم توضيحي ومثال محلول بكل خطوات الحساب، وأسئلة اختيار من متعدد في الأسفل.
Wednesday 28 October 2026, in class, 8:10 PM to 10:10 PM, Building 59 Room 2004. Two hours. Worth 25% of the course grade.
الأربعاء 28 أكتوبر 2026، في وقت المحاضرة، من 8:10 PM إلى 10:10 PM، المبنى 59 القاعة 2004. مدته ساعتان، ووزنه 25% من درجة المقرر.
Scope: all lectures so far, from 01 Introduction through 05-3 Quantization III. The syllabus gives the midterm weight and dates ("26th October / 28th October") but does not list its scope; the lectures delivered so far map to syllabus topics 1 (introduction), 2 (NN and deep learning fundamentals) and 4 (efficient inference: pruning and quantization).
النطاق: كل المحاضرات حتى الآن، من 01 المقدمة إلى 05-3 التكميم الثالث (Quantization III). يذكر توصيف المقرر وزن الاختبار النصفي وتاريخيه ("26th October / 28th October") لكنه لا يحدد نطاقه؛ والمحاضرات التي قُدّمت حتى الآن تقابل مواضيع التوصيف 1 (المقدمة) و2 (أساسيات الشبكات العصبية والتعلم العميق) و4 (الاستدلال الفعّال: pruning وquantization).
Syllabus rules that matter on the day: no makeup for a missed exam, and any smart device on you (phone, watch, earbuds) counts as a cheating attempt. Bring a plain calculator for the arithmetic.
قواعد التوصيف المهمة يوم الاختبار: لا اختبار بديل لمن يتغيب، وأي جهاز ذكي معك (هاتف أو ساعة أو سماعات أذن) يُعدّ محاولة غش. أحضر آلة حاسبة عادية للحسابات.
Read in order. Each page ends with questions, so answer them before clicking next: the answer only reveals after you commit to an option. Use the left and right arrow keys to move between pages.
اقرأ بالترتيب. كل صفحة تنتهي بأسئلة، فأجب عنها قبل الانتقال: الإجابة لا تظهر إلا بعد أن تختار. استخدم مفتاحي السهم الأيسر والأيمن للتنقل بين الصفحات.
Every page carries a priority badge. The ranking rests on one assumption: what can be computed by hand is what gets examined. Parameter counts, MACs, output sizes, scale and zero point, effective bit widths and sparsity ratios are the marks. The case studies make good distractors.
كل صفحة تحمل شارة أولوية. والترتيب مبني على افتراض واحد: ما يمكن حسابه باليد هو ما يأتي في الامتحان. عدد المعاملات (parameters)، وMACs، وأحجام المخرجات، والمقياس (scale) ونقطة الصفر (zero point)، وعرض البت الفعّال، ونسب التناثر هي مصدر الدرجات. أما دراسات الحالة فتصلح مشتّتات.
- Fri 23 Oct: Lectures 02 and 03, P1 pages. Output sizes, parameters, MACs, AlexNet by hand, peak activation, batch norm folding.
- Sat 24 Oct: Lectures 04-1 and 04-2, P1 pages. Granularity, magnitude criteria, APoZ, the sensitivity threshold read-off, EIE, 2:4 sparsity.
- Sun 25 Oct: Lectures 05-1 and 05-2, P1 pages. Integer and float formats, K-means storage, S and Z with numbers, the integer matmul.
- Mon 26 Oct: Lecture 05-3 P1 pages, then every P2 page across all lectures.
- Tue 27 Oct: Skim the P3 pages, redo every question you got wrong, and write the formula card below from memory until it is clean.
- Wed 28 Oct: Formula card once in the afternoon, nothing new. Exam at 8:10 PM.
- الجمعة 23 أكتوبر: صفحات P1 من المحاضرتين 02 و03. أحجام المخرجات، والمعاملات، وMACs، وAlexNet باليد، وذروة التنشيطات (peak activation)، ودمج batch norm.
- السبت 24 أكتوبر: صفحات P1 من المحاضرتين 04-1 و04-2. مستويات الدقة (granularity)، ومعايير المقدار (magnitude)، وAPoZ، وقراءة النسب من منحنيات الحساسية بالعتبة، وEIE، وتناثر 2:4.
- الأحد 25 أكتوبر: صفحات P1 من المحاضرتين 05-1 و05-2. صيغ الأعداد الصحيحة والعشرية، وتخزين K-means، وحساب S وZ بالأرقام، وضرب المصفوفات بالأعداد الصحيحة.
- الاثنين 26 أكتوبر: صفحات P1 من المحاضرة 05-3، ثم كل صفحات P2 في جميع المحاضرات.
- الثلاثاء 27 أكتوبر: تصفّح صفحات P3، وأعد كل سؤال أخطأت فيه، واكتب بطاقة المعادلات أدناه من الذاكرة حتى تخلو من الأخطاء.
- الأربعاء 28 أكتوبر: راجع بطاقة المعادلات مرة واحدة بعد الظهر، ولا شيء جديد. الاختبار الساعة 8:10 PM.
Bias convention changes between lectures. Lecture 02 counts co biases per layer; Lecture 03's tables ignore bias. If a question does not say, write your assumption next to the answer and you protect the mark either way.
اصطلاح الانحياز (bias) يختلف بين المحاضرات. المحاضرة 02 تحسب co انحيازاً لكل طبقة، وجداول المحاضرة 03 تتجاهل الانحياز. إذا لم يحدد السؤال ذلك، فاكتب افتراضك بجانب الإجابة لتحفظ الدرجة في الحالتين.
MACs are not FLOPs and parameters are not MACs. One MAC is two FLOPs. A conv kernel is counted once as parameters but reused at every output pixel, so its MACs carry an extra howo. Only for a linear layer do MACs equal parameters.
MACs ليست FLOPs، والمعاملات ليست MACs. عملية MAC واحدة تساوي 2 FLOPs. نواة الالتفاف (conv kernel) تُحسب مرة واحدة كمعاملات لكنها تُعاد عند كل بكسل في المخرج، لذا تحمل MACs الخاصة بها عاملاً إضافياً هو howo. فقط في الطبقة الخطية (linear) يتساوى عدد MACs مع عدد المعاملات.
Lecture 01 · Introduction
المحاضرة 01 · المقدمة
Lecture 02 · NN Fundamentals
المحاضرة 02 · أساسيات الشبكات العصبية
Lecture 03 · NN Efficiency Metrics
المحاضرة 03 · مقاييس كفاءة الشبكات العصبية
Lecture 04-1 · Pruning and Sparsity I
المحاضرة 04-1 · التقليم والتناثر، الجزء الأول
Lecture 04-2 · Pruning and Sparsity II
المحاضرة 04-2 · التقليم والتناثر، الجزء الثاني
Lecture 05-1 · Quantization I
المحاضرة 05-1 · التكميم، الجزء الأول
Lecture 05-2 · Quantization II
المحاضرة 05-2 · التكميم، الجزء الثاني
Lecture 05-3 · Quantization III
المحاضرة 05-3 · التكميم، الجزء الثالث
- Conv output size:
ho = ⌊(hi + 2p − k) / s⌋ + 1 - Conv parameters:
co · ci · kh · kw / g(depthwise:co · kh · kw), pluscobiases if counted - Conv MACs:
co · ho · wo · ci · kh · kw / g, andFLOPs = 2 × MACs - Model size:
#parameters × bit width / 8bytes - Batch norm:
y = γ · x − μ√(σ² + ε) + β - Linear quantization:
r = S(q − Z), withS = rmax − rminqmax − qminandZ = round(qmin − rmin / S) - Symmetric quantization:
Z = 0, full rangeS = |r|max / 2N−1, restricted rangeS = |r|max / (2N−1 − 1) - Attention:
softmax(QKT√dk) V
- حجم مخرج الالتفاف:
ho = ⌊(hi + 2p − k) / s⌋ + 1 - معاملات الالتفاف:
co · ci · kh · kw / g(وفي depthwise:co · kh · kw)، مع إضافةcoمن الـ biases إذا كانت تُحسب - MACs الالتفاف:
co · ho · wo · ci · kh · kw / g، وFLOPs = 2 × MACs - حجم النموذج:
#parameters × bit width / 8بايت - Batch norm:
y = γ · x − μ√(σ² + ε) + β - التكميم الخطي:
r = S(q − Z)، حيثS = rmax − rminqmax − qminوZ = round(qmin − rmin / S) - التكميم المتماثل:
Z = 0، وفي المدى الكاملS = |r|max / 2N−1، وفي المدى المقيّدS = |r|max / (2N−1 − 1) - الانتباه (attention):
softmax(QKT√dk) V