Majid Al-RaimiAMC: pruning ratios as a reinforcement learning problemAMC: نسب التقليم بوصفها مسألة تعلم معزز

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

AMC: pruning ratios as a reinforcement learning problemAMC: نسب التقليم بوصفها مسألة تعلم معزز

Given an overall compression target, AMC lets a DDPG agent choose each layer's sparsity, rewarded by accuracy under a FLOPs or latency constraint, and beats hand-tuned and uniformly scaled MobileNets on a real phone.بإعطاء هدف ضغط إجمالي، يترك AMC وكيلًا من نوع DDPG يختار تناثر كل طبقة، ويكافئه بالدقة تحت قيد على FLOPs أو زمن الاستجابة، ويتفوق على نماذج MobileNet المضبوطة يدويًا والمصغّرة بانتظام على هاتف حقيقي.

Conceptsالمفاهيم
4
Slidesالشرائح
24-32
Readingمدة القراءة
24 min24 دقيقة
Understoodما فهمته
0/4 conceptsمفاهيم

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

Your research models will have to meet a latency or FLOPs budget on one specific device, and someone has to decide how much of that budget each layer gives up. Part 03 showed the hand method. This part shows the first method that learns the answer, and it is the one the exam will ask you to formulate.

AMC (He et al., ECCV 2018) is the canonical example of turning a hand-tuned hyperparameter search into a learned policy. You will see why the search is hard, how the four ingredients of reinforcement learning map onto pruning, what the agent discovered on ResNet-50 that no expert had written down, and a table of phone measurements that settles the argument between counting FLOPs and measuring time.

ستحتاج نماذجك البحثية إلى الالتزام بميزانية زمن استجابة (latency) أو FLOPs على جهاز محدد، ولا بد أن يقرر أحدٌ ما مقدار ما تتنازل عنه كل طبقة من هذه الميزانية. عرض الجزء 03 الطريقة اليدوية. أما هذا الجزء فيعرض أول طريقة تتعلّم الإجابة بنفسها، وهي الطريقة التي سيطلب منك الامتحان صياغتها.

يُعد AMC (He et al., ECCV 2018) المثال المرجعي على تحويل بحث يدوي عن معامل فائق (hyperparameter) إلى سياسة متعلَّمة (learned policy). سترى لماذا البحث صعب، وكيف تنطبق المكونات الأربعة للتعلم المعزز (reinforcement learning) على التقليم، وما الذي اكتشفه الوكيل في ResNet-50 ولم يكتبه أي خبير من قبل، وجدولًا من قياسات على هاتف يحسم الجدل بين عدّ FLOPs وقياس الزمن فعليًا.

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

  1. Explain why per-layer ratio selection is a combinatorial search and why sensitivity analysis is sub-optimal.أن تشرح لماذا يُعد اختيار النسبة لكل طبقة بحثًا تركيبيًا، ولماذا يعطي تحليل الحساسية نتيجة دون المثلى.
  2. Name AMC's state, action, agent and reward, and say why the action is continuous and the reward is minus error under a constraint.أن تسمّي الحالة والفعل والوكيل والمكافأة في AMC، وأن توضح لماذا الفعل متصل ولماذا المكافأة هي سالب الخطأ تحت قيد.
  3. Describe what DDPG's actor and critic each do in one AMC episode.أن تصف ما يفعله كل من الممثل (actor) والناقد (critic) في DDPG خلال حلقة واحدة من AMC.
  4. Read the ResNet-50 density plot: peaks at 1x1, crests at 3x3, 5x versus 3.4x at equal accuracy.أن تقرأ مخطط الكثافة لـ ResNet-50: قمم عند طبقات 1x1، وقيعان عند طبقات 3x3، و5x مقابل 3.4x عند الدقة نفسها.
  5. Interpret the MobileNet table: measured time versus FLOPs targets, and why both beat uniform 0.75 shrinking.أن تفسّر جدول MobileNet: هدف الزمن المقاس مقابل هدف FLOPs، ولماذا يتفوق كلاهما على التصغير المنتظم 0.75.

Take a ResNet-50 and allow each of its roughly fifty prunable layers to keep one of ten possible fractions of its weights. That is 10^50 ways to spend one overall budget. The Sensitivity analysis of part 03 escapes the explosion by never looking at combinations at all: it prunes one layer at a time, runs 50 x 10 = 500 single-layer experiments, and reads each layer's Pruning ratio off its own curve where it crosses the accuracy threshold.

خذ شبكة ResNet-50 واسمح لكل طبقة من طبقاتها القابلة للتقليم، وعددها نحو خمسين، بأن تحتفظ بواحد من عشرة كسور ممكنة من أوزانها. هذا يعطي 10^50 طريقة لإنفاق ميزانية إجمالية واحدة. أما sensitivity analysis (تحليل الحساسية) في الجزء 03 فيتجنب هذا الانفجار بألا ينظر إلى التركيبات أبدًا: فهو يقلّم طبقة واحدة في كل مرة، ويجري 50 x 10 = 500 تجربة على طبقة منفردة، ويقرأ pruning ratio (نسبة التقليم) لكل طبقة من منحناها الخاص عند النقطة التي يقطع فيها حدّ الدقة.

The saving comes from a hidden assumption: that the accuracy lost by pruning several layers at once is the sum of what each loses alone. The AMC authors tested exactly this and report that the sensitivity approach "assumes that errors of different pruned layers can be summed up linearly, which does not stand according to our experiments" (He et al., 2018). That is the Layer interaction that slide 24 says the analysis ignores. Pruning layer 3 changes what layer 4 receives, so the curve you measured for layer 4 on a dense network is the wrong curve once layer 3 is thin. The ratios are usable, but they are sub-optimal, and they belong to the network they were measured on. Change the architecture and every curve must be measured again.

يأتي هذا التوفير من افتراض خفي: أن الدقة المفقودة عند تقليم عدة طبقات معًا تساوي مجموع ما تفقده كل طبقة وحدها. اختبر مؤلفو AMC هذا الافتراض تحديدًا، وذكروا أن نهج الحساسية "يفترض أن أخطاء الطبقات المقلّمة المختلفة يمكن جمعها خطيًا، وهذا لا يصمد وفق تجاربنا" (He et al., 2018). هذا هو layer interaction (تفاعل الطبقات) الذي تقول الشريحة 24 إن التحليل يتجاهله. تقليم الطبقة 3 يغيّر ما تستقبله الطبقة 4، لذا فإن المنحنى الذي قسته للطبقة 4 على شبكة كثيفة يصبح المنحنى الخطأ بمجرد أن تصبح الطبقة 3 رفيعة. النسب صالحة للاستخدام، لكنها دون المثلى، وهي تخص الشبكة التي قيست عليها. غيّر المعمارية، وسيلزم قياس كل منحنى من جديد.

Worked exampleمثال محلول

Counting the search spaceعدّ فضاء البحث

  1. Combinationsالتركيبات

    Fifty layers, ten candidate ratios each: 10^50 full configurations. No amount of GPU time enumerates that.
    خمسون طبقة، ولكل منها عشر نسب مرشحة: 10^50 إعدادًا كاملًا. لا يكفي أي قدر من وقت GPU لتعدادها كلها.
  2. What sensitivity analysis actually triesما يجرّبه تحليل الحساسية فعليًا

    One layer at a time: 50 x 10 = 500 pruned networks, each with only one layer changed. It then picks the ratios by a threshold, never trying the chosen combination until the very end.
    طبقة واحدة في كل مرة: 50 x 10 = 500 شبكة مقلّمة، في كل منها طبقة واحدة فقط متغيرة. ثم يختار النسب بحدّ عتبة، دون أن يجرّب التركيبة المختارة إلا في النهاية تمامًا.
  3. What is never measuredما لا يُقاس أبدًا

    Any configuration in which two or more layers are pruned together. The compounding of part 03 (both layers at once losing more than either alone) lives entirely in the unmeasured region.
    أي إعداد تُقلَّم فيه طبقتان أو أكثر معًا. فالتراكم الذي رأيناه في الجزء 03 (أن تقليم الطبقتين معًا يُفقد أكثر مما تُفقده أي منهما وحدها) يقع بالكامل في المنطقة غير المقاسة.
  4. A first-order estimate, not an optimumتقدير من الرتبة الأولى، لا حلّ أمثل

    Sensitivity analysis is a valid linear approximation. The per-layer rates it produces are a starting point, not the best allocation of the budget.
    تحليل الحساسية تقريب خطي صالح. المعدلات التي ينتجها لكل طبقة نقطة بداية، وليست أفضل توزيع للميزانية.

The bottleneck is peopleعنق الزجاجة هو البشر

Slide 25 shows the practical consequence. Conventionally the allocation relies on human expertise and trial and error. Three customers with three engineers is a workable shop. Many customers overwhelm even a team of engineers (the red cross and the alarmed manager in the middle column), and every new model, new target device or new budget restarts the trial and error from scratch, because rules such as prune the first layer less and the fully connected layers more are, in the paper's words, "non-optimal, and doesn't transfer from one model to another" (He et al., 2018). The right column serves the same crowd with one engineer and an engine that takes the model and the constraint and returns the compressed network.

تعرض الشريحة 25 النتيجة العملية. تقليديًا، يعتمد توزيع النسب على خبرة البشر وعلى التجربة والخطأ. ثلاثة عملاء مع ثلاثة مهندسين ورشة قابلة للعمل. لكن كثرة العملاء تُغرق حتى فريقًا من المهندسين (العلامة الحمراء والمدير القلق في العمود الأوسط)، وكل نموذج جديد أو جهاز مستهدف جديد أو ميزانية جديدة يعيد التجربة والخطأ من الصفر، لأن قواعد مثل قلّم الطبقة الأولى أقل والطبقات المتصلة بالكامل (fully connected) أكثر هي، بكلمات الورقة، "غير مثلى، ولا تنتقل من نموذج إلى آخر" (He et al., 2018). أما العمود الأيمن فيخدم الحشد نفسه بمهندس واحد ومحرك يأخذ النموذج والقيد ويعيد الشبكة المضغوطة.

Slide 26 names the ambition: a push-the-button solution. Today an efficient network needs someone who is both a machine learning expert and a hardware expert. The goal is that a non-expert plus a hardware-centric AutoML tool reaches the same efficient network. This is the definition of Automated pruning in this lecture: an algorithm, not a person, chooses the per-layer ratios for an overall target, and it does so with the target hardware in the loop.

تسمّي الشريحة 26 الطموح: حلّ بضغطة زر (push-the-button). اليوم تحتاج الشبكة الفعالة إلى شخص خبير في تعلم الآلة وخبير في العتاد معًا. والهدف أن يصل غير الخبير، مع أداة AutoML متمحورة حول العتاد، إلى الشبكة الفعالة نفسها. هذا هو تعريف automated pruning (التقليم المؤتمت) في هذه المحاضرة: خوارزمية، لا شخص، تختار النسب لكل طبقة لتحقيق هدف إجمالي، وتفعل ذلك والعتاد المستهدف داخل الحلقة.

MethodالطريقةWho chooses the ratiosمن يختار النسبCostالتكلفةInteraction modelledهل يُنمذَج التفاعلTransfers to a new modelهل تنتقل إلى نموذج جديد
Human expert rulesقواعد الخبير البشريAn engineer, by trial and errorمهندس، بالتجربة والخطأDays of experiments per modelأيام من التجارب لكل نموذجOnly in the engineer's headفقط في ذهن المهندسNo, rules are written per modelلا، القواعد تُكتب لكل نموذج على حدة
Sensitivity analysisتحليل الحساسيةA curve per layer plus one thresholdمنحنى لكل طبقة مع عتبة واحدةLayers x ratios single-layer runsتجارب على طبقة منفردة بعدد الطبقات x النسبNo, one layer at a timeلا، طبقة واحدة في كل مرةNo, curves belong to one networkلا، المنحنيات تخص شبكة واحدة
Learned policy (AMC)سياسة متعلَّمة (AMC)A DDPG agent, layer by layerوكيل DDPG، طبقة بعد طبقةHundreds of pruned networks, no retrainingمئات الشبكات المقلّمة، دون إعادة تدريبYes, the reward sees the whole networkنعم، المكافأة ترى الشبكة كاملةSame method, new search per model and budgetالطريقة نفسها، مع بحث جديد لكل نموذج وميزانية
Three ways to allocate one budget across layersثلاث طرق لتوزيع ميزانية واحدة على الطبقات

Recall

An overall compression target is given. Why is choosing the per-layer ratios still a hard problem, and what does sensitivity analysis do about it?لديك هدف ضغط إجمالي. لماذا يبقى اختيار النسب لكل طبقة مسألة صعبة، وماذا يفعل تحليل الحساسية حيالها؟

The target fixes only the sum. How to split it across layers is a combinatorial search (10^50 for fifty layers with ten ratios each) whose objective, accuracy after pruning, can only be observed by trying a configuration. Sensitivity analysis sidesteps the search by sweeping one layer at a time and assuming the losses add, which ignores layer interaction and makes its ratios sub-optimal.
الهدف يحدد المجموع فقط. أما طريقة توزيعه على الطبقات فهي بحث تركيبي (10^50 لخمسين طبقة بعشر نسب لكل منها)، ودالة هدفه، أي الدقة بعد التقليم، لا يمكن رؤيتها إلا بتجربة الإعداد. يتجنب تحليل الحساسية البحث بالمسح طبقة واحدة في كل مرة وافتراض أن الخسائر تُجمع، وهذا يتجاهل تفاعل الطبقات ويجعل نسبه دون المثلى.

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

Why do the ratios from sensitivity analysis end up sub-optimal?لماذا تكون النسب الناتجة عن تحليل الحساسية دون المثلى في النهاية؟

Follow one pass of AMC over MobileNet. Layer t-1 has just been pruned at 30%. The agent now looks at layer t: it receives a short vector describing that layer, its index, its channel counts, its kernel size, its FLOPs, how many FLOPs earlier layers already gave up and how many remain in later layers. It answers with one number, say 50%. The environment removes half of that layer's channels by magnitude and presents layer t+1. When the last layer is done, the whole pruned network is evaluated on a held-out set, and a single number comes back: minus the error. That number is the only feedback the agent ever gets, and it arrives once per pass.

تتبّع مرورًا واحدًا لـ AMC على MobileNet. الطبقة t-1 قُلّمت للتو بنسبة 30%. ينظر الوكيل الآن إلى الطبقة t: يستقبل متجهًا قصيرًا يصف تلك الطبقة، فيه رقمها، وعدد قنواتها، وحجم نواتها (kernel)، وFLOPs الخاصة بها، وكم من FLOPs تخلّت عنه الطبقات السابقة، وكم بقي في الطبقات اللاحقة. ويجيب برقم واحد، لنقل 50%. تزيل البيئة نصف قنوات تلك الطبقة بحسب المقدار (magnitude) وتعرض الطبقة t+1. وعند الانتهاء من الطبقة الأخيرة، تُقيَّم الشبكة المقلّمة كاملة على مجموعة محجوزة، ويعود رقم واحد: سالب الخطأ. هذا الرقم هو التغذية الراجعة الوحيدة التي يحصل عليها الوكيل، ويصل مرة واحدة في كل مرور.

One step of the loop: the embedding of layer t feeds both the actor and the critic, the actor emits a ratio that hollows out half of layer t, and after the last layer the reward returns to the critic, which scores Q(s_t, a_t).خطوة واحدة من الحلقة: تضمين الطبقة t يغذّي الممثل والناقد معًا، ويُصدر الممثل نسبة تُفرغ نصف الطبقة t، وبعد الطبقة الأخيرة تعود المكافأة إلى الناقد الذي يقيّم Q(s_t, a_t).

That story contains every ingredient of a reinforcement learning problem, which is what slide 27 means by "pruning as a reinforcement learning problem". The paper's own description: the agent "processes the network in a layer-wise manner", "receives a layer embedding s_t", "outputs a precise compression ratio a_t", and after every layer is compressed the "validation accuracy of the pruned model with all layers compressed is evaluated without fine-tuning, which is an efficient delegate of the fine-tuned accuracy" (He et al., 2018). Only the best network found after the search is fine-tuned.

تحتوي هذه القصة على كل مكونات مسألة تعلم معزز، وهذا ما تعنيه الشريحة 27 بعبارة "التقليم بوصفه مسألة تعلم معزز". وصف الورقة نفسها: الوكيل "يعالج الشبكة طبقة بعد طبقة"، و"يستقبل تضمين الطبقة s_t"، و"يُخرج نسبة ضغط دقيقة a_t"، وبعد ضغط كل الطبقات "تُقيَّم دقة التحقق (validation accuracy) للنموذج المقلّم بكل طبقاته المضغوطة دون ضبط دقيق، وهي بديل فعّال عن الدقة بعد الضبط الدقيق" (He et al., 2018). لا يُضبط ضبطًا دقيقًا إلا أفضل شبكة وُجدت بعد البحث.

The four RL ingredients in AMC, plus two words the exam expects around themمكونات التعلم المعزز الأربعة في AMC، مع مصطلحين إضافيين يتوقعهما الامتحان حولها

Stateالحالة (State)
The Layer embedding of layer t: eleven features (t, n, c, h, w, stride, k, FLOPs[t], reduced, rest, a[t-1]), each scaled to [0, 1]. The slide's [N, C, H, W, i, ...] abbreviates this list.layer embedding (تضمين الطبقة) للطبقة t: إحدى عشرة خاصية (t, n, c, h, w, stride, k, FLOPs[t], reduced, rest, a[t-1])، كل منها مُقيّسة إلى [0, 1]. والصيغة [N, C, H, W, i, ...] في الشريحة اختصار لهذه القائمة.
Actionالفعل (Action)
One continuous number, the sparsity ratio a_t in (0, 1], for the current layer only.رقم متصل واحد، هو نسبة التفرّق a_t ضمن (0, 1]، للطبقة الحالية فقط.
Agentالوكيل (Agent)
DDPG, an actor-critic method: the actor proposes a_t from s_t, the critic estimates the value Q(s_t, a_t) of that choice.DDPG، طريقة من نوع ممثل وناقد (actor-critic): يقترح الممثل a_t انطلاقًا من s_t، ويقدّر الناقد القيمة Q(s_t, a_t) لهذا الاختيار.
Environmentالبيئة (Environment)
Channel pruning of the pretrained network, one layer per step, using magnitude selection inside the layer.channel pruning (تقليم القنوات) للشبكة المدرّبة مسبقًا، طبقة واحدة في كل خطوة، باستخدام الاختيار بالمقدار (magnitude) داخل الطبقة.
Rewardالمكافأة (Reward)
R = -Error when the FLOPs or latency budget holds, effectively minus infinity otherwise (slide 29). For accuracy-guaranteed search, R = -Error x log(FLOPs) (slide 28).R = -Error عندما تتحقق ميزانية FLOPs أو زمن الاستجابة، وسالب ما لا نهاية فعليًا في غير ذلك (الشريحة 29). وللبحث المضمون الدقة (accuracy-guaranteed) تكون R = -Error x log(FLOPs) (الشريحة 28).
Episodeالحلقة (Episode)
One full pass over all layers, producing one pruned network and one reward. The signal is validation accuracy before fine-tuning, on a few thousand training images.مرور كامل واحد على كل الطبقات، ينتج شبكة مقلّمة واحدة ومكافأة واحدة. والإشارة هي دقة التحقق (validation accuracy) قبل الضبط الدقيق، على بضعة آلاف من صور التدريب.

Why the action must be continuous, and why an actor and a criticلماذا يجب أن يكون الفعل متصلًا، ولماذا ممثل وناقد

A pruning ratio is a real number, and the compressed model's accuracy is very sensitive to it. A discrete agent would need a grid fine enough to tell 48% from 52%, which explodes the number of actions, and a grid also throws away the order between neighbouring ratios (He et al., 2018), so the agent could not exploit the fact that neighbouring ratios behave alike. DDPG (Lillicrap et al., 2015) is the standard actor-critic method for continuous control: it concurrently learns a Q-function and a policy and can only be used with continuous action spaces (OpenAI Spinning Up). Sutton and Barto give the naming: when a value function is used "to assess, or criticize, the policy's action selections, then the value function is called a critic and the policy is called an actor". In AMC the critic learns, from replayed transitions, how much reward a state and ratio pair leads to; the actor is then nudged by gradient ascent on that estimate to propose ratios the critic scores higher. The critic judges, the actor proposes, and neither ever sees a gradient of the pruned network itself.

نسبة التقليم عدد حقيقي، ودقة النموذج المضغوط حساسة جدًا لها. سيحتاج وكيل متقطع (discrete) إلى شبكة قيم دقيقة بما يكفي للتمييز بين 48% و52%، وهذا يُفجّر عدد الأفعال، كما أن الشبكة المتقطعة تُضيّع الترتيب بين النسب المتجاورة (He et al., 2018)، فلا يستطيع الوكيل الاستفادة من أن النسب المتجاورة تتصرف بشكل متشابه. DDPG (Lillicrap et al., 2015) هي الطريقة القياسية من نوع ممثل وناقد (actor-critic) للتحكم المتصل: تتعلم دالة Q وسياسة في آنٍ واحد، ولا يمكن استخدامها إلا مع فضاءات أفعال متصلة (OpenAI Spinning Up). ويعطي Sutton وBarto أصل التسمية: عندما تُستخدم دالة قيمة "لتقييم اختيارات السياسة للأفعال، أو نقدها، تُسمّى دالة القيمة ناقدًا وتُسمّى السياسة ممثلًا". في AMC يتعلم الناقد، من انتقالات مُعاد تشغيلها (replayed transitions)، مقدار المكافأة التي يؤدي إليها زوج من الحالة والنسبة؛ ثم يُدفع الممثل بالصعود التدرجي (gradient ascent) على هذا التقدير ليقترح نسبًا يمنحها الناقد درجة أعلى. الناقد يحكم، والممثل يقترح، ولا يرى أي منهما تدرجًا (gradient) للشبكة المقلّمة نفسها أبدًا.

Why the reward is minus error under a constraintلماذا المكافأة هي سالب الخطأ تحت قيد

R={−Errorif the FLOPs or latency constraint is met−∞otherwiseR = \begin{cases} -\text{Error} & \text{if the FLOPs or latency constraint is met} \\ -\infty & \text{otherwise} \end{cases}
Resource-constrained reward (slide 29)المكافأة المقيدة بالموارد (الشريحة 29)

Reinforcement learning maximizes reward, so maximizing -Error is minimizing error. The budget appears as a constraint rather than a bonus on purpose: if the agent were paid for shrinking, it would keep shrinking past the target and lose accuracy for nothing. With a hard constraint there is no reward for finishing under budget, so the agent "can precisely arrive at the target compression ratio" (He et al., 2018). The minus infinity branch is the slide's compact way of saying an infeasible network earns nothing useful.

التعلم المعزز يعظّم المكافأة، لذا فإن تعظيم -Error يعني تقليل الخطأ. تظهر الميزانية كقيد لا كمكافأة إضافية عن قصد: لو كوفئ الوكيل على التصغير، لاستمر في التصغير متجاوزًا الهدف وخسر الدقة بلا مقابل. ومع قيد صارم لا توجد مكافأة على الانتهاء تحت الميزانية، فيستطيع الوكيل "الوصول بدقة إلى نسبة الضغط المستهدفة" (He et al., 2018). وفرع سالب ما لا نهاية هو طريقة الشريحة المختصرة للقول إن الشبكة غير الممكنة (التي تخرق القيد) لا تكسب شيئًا مفيدًا.

Wduty=α Wall−amax⁡Wrest−Wreduced,at←max⁡ ⁣(at,  WdutyWt)W_{\text{duty}} = \alpha\, W_{\text{all}} - a_{\max} W_{\text{rest}} - W_{\text{reduced}}, \qquad a_t \leftarrow \max\!\left(a_t,\; \frac{W_{\text{duty}}}{W_t}\right)
How the paper actually enforces the budget (Algorithm 1)كيف تفرض الورقة الميزانية فعليًا (Algorithm 1)

A wasted episode teaches the critic nothing, so the paper never lets one happen. Before each action it computes the duty: the share of the removal target alpha W_all that this layer must carry, given what earlier layers already removed (W_reduced) and the most the remaining layers could remove at the cap a_max (0.8 for convolutions and 0.98 for fully connected layers in fine-grained pruning; 0.8 for every layer in channel pruning). If the actor's proposal is too timid, it is raised to the duty. The budget is therefore met by construction, and the minus infinity case is a formal backstop, not a common outcome.

الحلقة المهدرة لا تعلّم الناقد شيئًا، لذا لا تسمح الورقة بحدوثها أبدًا. قبل كل فعل تحسب الحصة الواجبة (duty): نصيب هدف الإزالة alpha W_all الذي يجب أن تتحمله هذه الطبقة، بالنظر إلى ما أزالته الطبقات السابقة (W_reduced) وأقصى ما يمكن أن تزيله الطبقات المتبقية عند السقف a_max (0.8 للالتفافات و0.98 للطبقات المتصلة بالكامل في التقليم الدقيق الحبيبات (fine-grained)؛ و0.8 لكل الطبقات في تقليم القنوات). إذا كان اقتراح الممثل متحفظًا أكثر من اللازم، يُرفع إلى الحصة الواجبة. وهكذا تتحقق الميزانية بحكم البناء، وتكون حالة سالب ما لا نهاية صمام أمان شكليًا، لا نتيجة شائعة.

RFLOPs=−Error⋅log⁡(FLOPs)R_{\text{FLOPs}} = -\text{Error} \cdot \log(\text{FLOPs})
Accuracy-guaranteed reward (slide 28)المكافأة المضمونة الدقة (الشريحة 28)

Slide 28 shows the other protocol. When the goal is the smallest model with no accuracy loss, the budget is unknown in advance, so the reward itself must push on size. The bubble chart on the slide (Canziani et al., 2016) shows that top-1 accuracy rises roughly with the logarithm of the operation count, so multiplying -Error by log(FLOPs) gives, in the paper's words, "a small incentive for reducing FLOPs" while staying "sensitive to Error". The ResNet-50 and MobileNet results in the next two concepts use the constrained reward, not this one.

تعرض الشريحة 28 البروتوكول الآخر. عندما يكون الهدف أصغر نموذج دون أي خسارة في الدقة، تكون الميزانية مجهولة مسبقًا، لذا يجب أن تضغط المكافأة نفسها باتجاه الحجم. مخطط الفقاعات في الشريحة (Canziani et al., 2016) يبيّن أن دقة top-1 ترتفع تقريبًا مع لوغاريتم عدد العمليات، لذا فإن ضرب -Error في log(FLOPs) يعطي، بكلمات الورقة، "حافزًا صغيرًا لتقليل FLOPs" مع البقاء "حساسًا للخطأ". نتائج ResNet-50 وMobileNet في المفهومين التاليين تستخدم المكافأة المقيّدة، لا هذه.

The constraint need not be FLOPs. The paper notes that the resource can be "FLOPs or the actual inference time on mobile device", and slide 29 adds the mechanism: a pre-built Latency lookup table of measured per-layer times on the target phone, the same device-in-the-loop idea NetAdapt uses in part 05. Substituting measured time for FLOPs turns a FLOPs-constrained search into a latency-constrained one, and the MobileNet table at the end of this part shows why that matters.

لا يلزم أن يكون القيد FLOPs. تذكر الورقة أن المورد يمكن أن يكون "FLOPs أو زمن الاستدلال الفعلي على الجهاز المحمول"، وتضيف الشريحة 29 الآلية: جدول بحث مُعدّ مسبقًا latency lookup table فيه أزمنة مقاسة لكل طبقة على الهاتف المستهدف، وهي فكرة الجهاز داخل الحلقة نفسها التي يستخدمها NetAdapt في الجزء 05. استبدال FLOPs بالزمن المقاس يحوّل بحثًا مقيدًا بـFLOPs إلى بحث مقيد بزمن الاستجابة، وجدول MobileNet في نهاية هذا الجزء يبيّن لماذا يهم ذلك.

SimulatorمحاكيAMC episode stepper: five layers, one FLOPs budgetمتتبع حلقة AMC: خمس طبقات، وميزانية FLOPs واحدة
  • L1a=0.5020M, 3x3
  • L2?60M, 3x3
  • L3?100M, 3x3
  • L4?80M, 1x1
  • L5?40M, 3x3
Embedding s_t for layer 1 (8 of the 11 features)التمثيل s_t للطبقة 1 (8 من أصل 11 سمة)
FeatureالسمةRawالقيمة الخامScaled to [0, 1]بعد التحجيم إلى [0, 1]
t10.00
n320.13
c30.02
k3x31.00
FLOPs[t]20M0.20
reduced0M0.00
rest280M0.93
a[t-1]none0.00
kept FLOPs so farFLOPs المحتفظ بها حتى الآن290M of 300M290M من 300Mbudget line at 150Mخط الميزانية عند 150M
Layers pruned0of 5one action per layerفعل واحد لكل طبقة
Kept so far0MFLOPsfrom the layers already prunedمن الطبقات التي قُلّمت بالفعل
Budgetالميزانية150MFLOPs50% of 300M50% من 300M
Rewardالمكافأةpendinguntil layer 5arrives once per episodeتصل مرة واحدة في كل حلقة

Toy numbers. Error is 30 + 100 x sum of s_j a_j^2 with sensitivities 0.20, 0.06, 0.04, 0.05, 0.10, so the first and last layers are expensive to prune. The budget bar projects the unpruned layers at full cost until you act on them.أرقام تجريبية. الخطأ يساوي 30 + 100 x sum of s_j a_j^2 بحساسيات 0.20, 0.06, 0.04, 0.05, 0.10، لذا فتقليم الطبقتين الأولى والأخيرة مكلف. يحسب شريط الميزانية الطبقات غير المقلّمة بكامل تكلفتها إلى أن تتخذ فيها فعلًا.

Recall

Name the four RL ingredients of AMC and what each is concretely.سمِّ مكونات التعلم المعزز الأربعة في AMC، وما هو كل منها تحديدًا.

State: the layer embedding of eleven scaled features (index, n, c, h, w, stride, k, FLOPs of the layer, FLOPs reduced so far, FLOPs remaining, previous action). Action: a continuous sparsity ratio a_t in (0, 1]. Agent: DDPG, an actor-critic method. Reward: -Error after all layers are pruned, subject to the FLOPs or latency constraint. The environment is layer-by-layer channel pruning.
الحالة: تضمين الطبقة من إحدى عشرة خاصية مُقيّسة (الرقم، n، c، h، w، stride، k، وFLOPs الطبقة، وFLOPs المُزالة حتى الآن، وFLOPs المتبقية، والفعل السابق). الفعل: نسبة تفرّق متصلة a_t ضمن (0, 1]. الوكيل: DDPG، طريقة من نوع ممثل وناقد. المكافأة: -Error بعد تقليم كل الطبقات، مع الالتزام بقيد FLOPs أو زمن الاستجابة. والبيئة هي تقليم القنوات طبقة بعد طبقة.

Recall

Why is the reward minus error rather than accuracy, and why is it given only at the end of the episode?لماذا المكافأة هي سالب الخطأ لا الدقة، ولماذا تُعطى فقط في نهاية الحلقة؟

RL maximizes reward, so -Error minimizes error. The budget is a constraint, not a bonus, so the agent gains nothing by over-shrinking and lands on the target. Error can only be measured once every layer has been pruned, so one episode is one pass through the network with one reward.
التعلم المعزز يعظّم المكافأة، لذا فإن -Error يقلّل الخطأ. والميزانية قيد لا مكافأة إضافية، فلا يكسب الوكيل شيئًا من التصغير الزائد ويصل إلى الهدف. ولا يمكن قياس الخطأ إلا بعد تقليم كل الطبقات، لذا فالحلقة الواحدة مرور واحد على الشبكة بمكافأة واحدة.

Recall

Why must the action space be continuous?لماذا يجب أن يكون فضاء الأفعال متصلًا؟

Accuracy is very sensitive to the exact ratio, a discrete grid fine enough to matter explodes the number of actions, and discretization loses the ordering between ratios. DDPG supports continuous actions, which is why it was chosen.
الدقة حساسة جدًا للنسبة الدقيقة، والشبكة المتقطعة الدقيقة بما يكفي لتُحدث فرقًا تُفجّر عدد الأفعال، والتقطيع يُضيّع الترتيب بين النسب. وDDPG يدعم الأفعال المتصلة، ولهذا اختير.

Recall

What does AMC not learn?ما الذي لا يتعلمه AMC؟

It does not learn which weights or channels to drop (magnitude or max-response selection inside each layer is fixed) and it does not train from scratch. It learns only the per-layer ratios, then fine-tunes the best network once.
لا يتعلم أي الأوزان أو القنوات يحذف (الاختيار بالمقدار أو بأقصى استجابة داخل كل طبقة ثابت)، ولا يدرّب من الصفر. إنه يتعلم فقط النسب لكل طبقة، ثم يضبط أفضل شبكة ضبطًا دقيقًا مرة واحدة.

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

Which fact makes AMC choose DDPG rather than a discrete-action agent?ما الحقيقة التي تجعل AMC يختار DDPG بدلًا من وكيل بأفعال متقطعة؟

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

Under a FLOPs budget, what reward does the agent get when the pruned model breaks the budget?تحت ميزانية FLOPs، ما المكافأة التي يحصل عليها الوكيل عندما يخرق النموذج المقلّم الميزانية؟

Slide 30 puts the agent up against Song Han's own hand-pruned ResNet-50 from his PhD thesis. The human expert kept 29% of the weights, a 3.4x reduction. The agent kept 20%, a 5x reduction, at the same accuracy: 76.13% top-1 for the original and 76.11% for AMC (He et al., 2018). This experiment uses fine-grained weight pruning, not channel pruning, and it is run as Iterative pruning in four rounds at 50%, 35%, 25% and 20% overall density with 30 fine-tuning epochs after each round, which is the schedule part 06 explains.

تضع الشريحة 30 الوكيل في مواجهة شبكة ResNet-50 التي قلّمها Song Han بيده في أطروحة الدكتوراه. احتفظ الخبير البشري بـ29% من الأوزان، أي تقليل بمقدار 3.4x. واحتفظ الوكيل بـ20%، أي تقليل بمقدار 5x، عند الدقة نفسها: 76.13% في top-1 للأصلية و76.11% لـ AMC (He et al., 2018). تستخدم هذه التجربة تقليم الأوزان الدقيق الحبيبات (fine-grained)، لا تقليم القنوات، وتُنفَّذ بوصفها iterative pruning (تقليمًا تكراريًا) على أربع جولات عند كثافة إجمالية 50% و35% و25% و20%، مع 30 حقبة من fine-tuning (الضبط الدقيق) بعد كل جولة، وهو الجدول الذي يشرحه الجزء 06.

RegionالمنطقةHuman expertالخبير البشريAMCAMC
Conv1Conv150%50%43%43%
ResBlock1ResBlock131%31%28%28%
ResBlock2ResBlock231%31%28%28%
ResBlock3ResBlock330%30%23%23%
ResBlock4ResBlock430%30%19%19%
FCFC20%20%10%10%
Totalالإجمالي29%29%20%20%
ResNet-50 weight density kept, human expert versus AMC (slide 30; lower is better)كثافة الأوزان المحتفظ بها في ResNet-50، الخبير البشري مقابل AMC (الشريحة 30؛ الأقل أفضل)

Worked exampleمثال محلول

From density to compression ratioمن الكثافة إلى نسبة الضغط

  1. Human expertالخبير البشري

    Density 29%, so compression 1 / 0.29 = 3.4x. The thesis records the rules behind it: first layer 50%, residual blocks about 30%, fully connected layer 20% (Han, 2017).
    الكثافة 29%، إذن الضغط 1 / 0.29 = 3.4x. وتسجّل الأطروحة القواعد وراء ذلك: الطبقة الأولى 50%، والكتل المتبقية (residual blocks) نحو 30%، والطبقة المتصلة بالكامل 20% (Han, 2017).
  2. AMCAMC

    Density 20%, so compression 1 / 0.20 = 5.0x, with the biggest gains in the late blocks (30% to 19% in ResBlock4) and the classifier (20% to 10%).
    الكثافة 20%، إذن الضغط 1 / 0.20 = 5.0x، وأكبر المكاسب في الكتل المتأخرة (من 30% إلى 19% في ResBlock4) وفي المصنّف (من 20% إلى 10%).
  3. Same accuracy, 1.5x fewer weightsالدقة نفسها، وأوزان أقل بمقدار 1.5x

    76.13% versus 76.11% top-1, a difference well inside run-to-run noise, for 5x instead of 3.4x.
    76.13% مقابل 76.11% في top-1، وهو فرق يقع ضمن ضجيج التكرار من تشغيل لآخر، مقابل 5x بدلًا من 3.4x.

What the agent noticed inside a residual blockما الذي لاحظه الوكيل داخل الكتلة المتبقية

The per-region bars hide the interesting pattern, which slide 31 shows layer by layer. ResNet-50 is built from bottleneck blocks: a 1x1 convolution that reduces the channel count, a 3x3 convolution, and a 1x1 convolution that restores it (He et al., 2016). Walk along the layer index and the kept density forms a sawtooth. The peaks, where the agent kept more, are the 1x1 layers. The crests, where it cut deep, are the 3x3 layers. The paper draws the conclusion directly: the agent "automatically learns that 3x3 convolution has more redundancy than 1x1 convolution and can be pruned more" (He et al., 2018). Nobody told it about kernel shapes; the kernel size k is just one of the eleven features in the state.

الأعمدة حسب المنطقة تخفي النمط المثير، وتعرضه الشريحة 31 طبقة بطبقة. تتكون ResNet-50 من كتل عنق الزجاجة (bottleneck): التفاف 1x1 يقلّل عدد القنوات، ثم التفاف 3x3، ثم التفاف 1x1 يعيده (He et al., 2016). امشِ على رقم الطبقة وستجد أن الكثافة المحتفظ بها ترسم شكل أسنان المنشار. القمم، حيث احتفظ الوكيل بأكثر، هي طبقات 1x1. والقيعان، حيث قطع بعمق، هي طبقات 3x3. وتستخلص الورقة النتيجة مباشرة: الوكيل "يتعلم تلقائيًا أن التفاف 3x3 فيه تكرار (redundancy) أكثر من التفاف 1x1 ويمكن تقليمه أكثر" (He et al., 2018). لم يخبره أحد عن أشكال الأنوية؛ فحجم النواة k مجرد واحدة من الخصائص الإحدى عشرة في الحالة.

Density kept along the layer index of ResNet-50 forms a sawtooth: 1x1 layers stay denser (peaks), 3x3 layers are pruned harder (crests).الكثافة المحتفظ بها على امتداد رقم الطبقة في ResNet-50 ترسم أسنان منشار: طبقات 1x1 تبقى أكثف (القمم)، وطبقات 3x3 تُقلَّم بقوة أكبر (القيعان).

The finding makes sense once you think about where redundancy lives. A 1x1 kernel mixes channels and has no spatial extent, so every weight is a distinct channel-to-channel connection with nothing next to it to stand in for it. A 3x3 kernel has nine spatial taps per channel pair, many of which are near zero after training, and it also holds most of a block's weights: in a stage-3 bottleneck the 3x3 layer carries about 590K of the block's 1.1M parameters against 262K for each 1x1 layer (Han, 2017). Cutting the 3x3 layers hard is where the compression is, and it is also where accuracy is cheapest to spend, which is exactly the trade the reward rewards.

تصبح النتيجة منطقية حين تفكر في مكان وجود التكرار. نواة 1x1 تمزج القنوات وليس لها امتداد مكاني، فكل وزن فيها اتصال مميز بين قناة وقناة، ولا يوجد بجواره ما ينوب عنه. أما نواة 3x3 ففيها تسع نقاط مكانية لكل زوج من القنوات، وكثير منها قريب من الصفر بعد التدريب، كما أنها تحمل معظم أوزان الكتلة: في كتلة عنق زجاجة من المرحلة 3 تحمل طبقة 3x3 نحو 590K من أصل 1.1M معامل في الكتلة، مقابل 262K لكل طبقة 1x1 (Han, 2017). قطع طبقات 3x3 بقوة هو حيث يوجد الضغط، وهو أيضًا حيث تكون الدقة أرخص ما يمكن إنفاقه، وهذه بالضبط المقايضة التي تكافئها المكافأة.

Recall

What did AMC learn about 3x3 versus 1x1 convolutions in ResNet-50, and what did that buy?ماذا تعلّم AMC عن التفافات 3x3 مقابل 1x1 في ResNet-50، وماذا كسب من ذلك؟

3x3 layers have more redundancy and are pruned harder (crests); 1x1 layers have less and are kept denser (peaks). Overall density fell to 20% against the expert's 29%, 5x versus 3.4x, at the same 76.1% top-1.
طبقات 3x3 فيها تكرار أكثر فتُقلَّم بقوة أكبر (القيعان)؛ وطبقات 1x1 فيها تكرار أقل فتبقى أكثف (القمم). انخفضت الكثافة الإجمالية إلى 20% مقابل 29% للخبير، أي 5x مقابل 3.4x، عند دقة top-1 نفسها البالغة 76.1%.

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

Inside the residual blocks of ResNet-50, which layers did the agent keep densest?داخل الكتل المتبقية في ResNet-50، أي الطبقات أبقاها الوكيل الأكثف؟

The final slide moves from weights to milliseconds. MobileNet is run with TF-Lite on a Samsung Galaxy S7 Edge with a Qualcomm Snapdragon SoC, single core, batch size 1, which is the latency-oriented setting of a phone serving one image at a time. Four models are measured: the full 1.0 MobileNet, two AMC results and the 0.75 MobileNet baseline, which is the same architecture with every layer's width scaled by 75%.

تنتقل الشريحة الأخيرة من الأوزان إلى الميلي ثواني. تُشغَّل MobileNet باستخدام TF-Lite على هاتف Samsung Galaxy S7 Edge بشريحة Qualcomm Snapdragon SoC، على نواة واحدة، وبحجم دفعة 1، وهو الإعداد الموجّه لزمن الاستجابة لهاتف يخدم صورة واحدة في كل مرة. تُقاس أربعة نماذج: 1.0 MobileNet الكاملة، ونتيجتان من AMC، وخط الأساس 0.75 MobileNet، وهي المعمارية نفسها مع تحجيم عرض كل طبقة إلى 75%.

ModelالنموذجMACMACTop-1Top-1Latencyزمن الاستجابةSpeedupالتسريعMemoryالذاكرة
1.0 MobileNet569M70.6%119.0 ms1x20.1 MB
AMC (50% FLOPs)285M70.5%64.4 ms1.8x14.3 MB
AMC (50% Time)272M70.2%59.7 ms2.0x13.2 MB
0.75 MobileNet325M68.4%69.5 ms1.7x14.8 MB
MobileNet on a Samsung Galaxy S7 Edge, TF-Lite, single core, batch size 1 (slide 32)MobileNet على Samsung Galaxy S7 Edge، باستخدام TF-Lite، نواة واحدة، حجم دفعة 1 (الشريحة 32)

Worked exampleمثال محلول

Checking the tableالتحقق من الجدول

  1. Speedupsمعاملات التسريع

    119.0 / 64.4 = 1.85 (shown as 1.8x), 119.0 / 59.7 = 1.99 (2.0x), 119.0 / 69.5 = 1.71 (1.7x).
    119.0 / 64.4 = 1.85 (معروضة 1.8x)، و119.0 / 59.7 = 1.99 (2.0x)، و119.0 / 69.5 = 1.71 (1.7x).
  2. MAC fractionsنسب MAC

    285 / 569 = 0.50, 272 / 569 = 0.48, 325 / 569 = 0.57. The width multiplier scales cost by roughly alpha^2 = 0.5625 (Howard et al., 2017), which matches the 0.57.
    285 / 569 = 0.50، و272 / 569 = 0.48، و325 / 569 = 0.57. مضاعِف العرض (width multiplier) يحجّم التكلفة بنحو alpha^2 = 0.5625 (Howard et al., 2017)، وهذا يطابق 0.57.
  3. Accuracy deltas from 70.6%فروق الدقة عن 70.6%

    -0.1, -0.4 and -2.2 points.
    -0.1 و-0.4 و-2.2 نقطة.
  4. Both AMC rows dominate the uniform baselineكلا صفّي AMC يتفوقان على خط الأساس المنتظم

    Each AMC model has fewer MACs, lower latency, less memory and higher accuracy than 0.75 MobileNet. Halving FLOPs gave 1.85x, not 2x; targeting time came closest, at 1.99x.
    كل نموذج من AMC فيه MACs أقل، وزمن استجابة أقل، وذاكرة أقل، ودقة أعلى من 0.75 MobileNet. تنصيف FLOPs أعطى 1.85x، لا 2x؛ واستهداف الزمن كان الأقرب، عند 1.99x.

Reading the two AMC rows against each otherقراءة صفّي AMC أحدهما مقابل الآخر

Latencyزمن الاستجابة
50% Time is 4.7 ms faster (59.7 versus 64.4 ms)50% Time أسرع بـ4.7 ms (59.7 مقابل 64.4 ms)
Accuracyالدقة
50% Time loses 0.3 points (70.2% versus 70.5%)50% Time يخسر 0.3 نقطة (70.2% مقابل 70.5%)
MACs
272M versus 285M: the time target also ends up slightly smaller272M مقابل 285M: هدف الزمن ينتهي أيضًا بنموذج أصغر قليلًا
Against 0.75 MobileNetمقابل 0.75 MobileNet
Both are at least 1.8 points more accurate, at least 5 ms faster, with fewer MACsكلاهما أدق بـ1.8 نقطة على الأقل، وأسرع بـ5 ms على الأقل، مع MACs أقل
Accuracy against measured latency: the two AMC points sit up and to the left, and the uniformly shrunk 0.75 MobileNet lies inside the region they dominate.الدقة مقابل زمن الاستجابة المقاس: نقطتا AMC تقعان في الأعلى وإلى اليسار، ونموذج 0.75 MobileNet المصغّر بشكل منتظم يقع داخل المنطقة التي تتفوقان عليها.

Two lessons in one tableدرسان في جدول واحد

First, FLOPs are a proxy. Halving the multiply-accumulates bought 1.85x, not 2x, because a phone does not spend time in proportion to arithmetic. MobileNet's depthwise layers have a low ratio of computation to memory traffic, so trimming them saves fewer milliseconds than the MAC count suggests; the paper reports about 2x speedup on the 1x1 convolutions but less on the depthwise ones (He et al., 2018). When the agent is instead constrained by measured time from the lookup table, it removes work where the phone is actually slow, and the search lands at 59.7 ms, a 1.99x speedup that all but hits the 2x target. That allocation is less accuracy-friendly, which is the 0.3 point cost. You choose the target you care about, and you pay in the other currency.

أولًا، FLOPs مجرد بديل تقريبي. تنصيف عمليات الضرب والجمع (multiply-accumulates) أعطى 1.85x، لا 2x، لأن الهاتف لا يقضي وقته بالتناسب مع الحساب. طبقات depthwise في MobileNet نسبة الحساب فيها إلى حركة الذاكرة منخفضة، لذا فتقليصها يوفّر ميلي ثواني أقل مما يوحي به عدد MAC؛ وتذكر الورقة تسريعًا بنحو 2x على التفافات 1x1 وأقل من ذلك على طبقات depthwise (He et al., 2018). وعندما يُقيَّد الوكيل بدلًا من ذلك بالزمن المقاس من جدول البحث، فإنه يزيل العمل حيث يكون الهاتف بطيئًا فعلًا، فيصل البحث إلى 59.7 ms، أي تسريع 1.99x يكاد يصيب هدف 2x. هذا التوزيع أقل رفقًا بالدقة، وهذه هي تكلفة الـ0.3 نقطة. أنت تختار الهدف الذي يهمك، وتدفع بالعملة الأخرى.

Second, non-uniform beats uniform. Uniform shrinking with the width multiplier is a single knob turned on every layer, and the thinner model must be trained from scratch (Howard et al., 2017). AMC prunes a pretrained network with a different ratio per layer, keeps 2.1 (50% FLOPs) or 1.8 (50% Time) more points of accuracy with fewer MACs than 0.75 MobileNet, and does it after a short fine-tune. In the accuracy versus latency plane the AMC points sit above and to the left, which is the definition of a better Pareto frontier.

ثانيًا، غير المنتظم يتفوق على المنتظم. uniform shrinking (التصغير المنتظم) باستخدام مضاعِف العرض مقبض واحد يُدار على كل طبقة، ويجب تدريب النموذج الأرفع من الصفر (Howard et al., 2017). أما AMC فيقلّم شبكة مدرّبة مسبقًا بنسبة مختلفة لكل طبقة، ويحتفظ بـ2.1 (50% FLOPs) أو 1.8 (50% Time) نقطة دقة إضافية مع MACs أقل من 0.75 MobileNet، ويفعل ذلك بعد ضبط دقيق قصير. في مستوى الدقة مقابل زمن الاستجابة تقع نقاط AMC في الأعلى وإلى اليسار، وهذا هو تعريف جبهة Pareto أفضل.

Recall

In the MobileNet table, why does 50% Time beat 50% FLOPs on latency but lose 0.3 points?في جدول MobileNet، لماذا يتفوق 50% Time على 50% FLOPs في زمن الاستجابة لكنه يخسر 0.3 نقطة؟

It is constrained by measured time from a lookup table, so it removes work where the phone is actually slow rather than where FLOPs are counted, reaching 59.7 ms (2.0x) against 64.4 ms (1.8x). That allocation is less accuracy-friendly, so top-1 falls from 70.5% to 70.2%.
لأنه مقيّد بالزمن المقاس من جدول بحث، فيزيل العمل حيث يكون الهاتف بطيئًا فعلًا لا حيث تُعدّ FLOPs، فيصل إلى 59.7 ms (2.0x) مقابل 64.4 ms (1.8x). هذا التوزيع أقل رفقًا بالدقة، لذا تنخفض top-1 من 70.5% إلى 70.2%.

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

Why does AMC (50% Time) run faster than AMC (50% FLOPs) on the Galaxy S7 Edge?لماذا يعمل AMC (50% Time) أسرع من AMC (50% FLOPs) على Galaxy S7 Edge؟

Recapالخلاصة

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

  • An overall compression ratio fixes the sum; allocating it across layers is a search whose objective is only observable by trying it.نسبة الضغط الإجمالية تحدد المجموع فقط؛ أما توزيعها على الطبقات فهو بحث لا يمكن رؤية دالة هدفه إلا بتجربته.
  • Sensitivity analysis assumes per-layer losses add. Layers interact, so its ratios are sub-optimal and do not transfer between models.يفترض تحليل الحساسية أن خسائر الطبقات تُجمع جمعًا. لكن الطبقات تتفاعل، لذا تكون نسبه دون المثلى ولا تنتقل من نموذج إلى آخر.
  • AMC: state = layer embedding of 11 scaled features, action = continuous sparsity ratio, agent = DDPG, reward = minus error once all layers are pruned, budget enforced as a constraint.في AMC: الحالة = تضمين الطبقة من 11 خاصية مُقيّسة، والفعل = نسبة تفرّق (sparsity) متصلة، والوكيل = DDPG، والمكافأة = سالب الخطأ بعد تقليم كل الطبقات، مع فرض الميزانية كقيد.
  • Continuous actions because ratios are real numbers and grids lose ordering; the critic scores Q(s, a), the actor proposes a.الأفعال متصلة لأن النسب أعداد حقيقية والشبكات المتقطعة تُضيّع الترتيب؛ الناقد يقيّم Q(s, a) والممثل يقترح a.
  • AMC learns only the ratios. Magnitude selection inside each layer and one final fine-tune are unchanged.يتعلم AMC النسب فقط. اختيار الأوزان بالمقدار (magnitude) داخل كل طبقة وضبط دقيق (fine-tune) نهائي واحد يبقيان كما هما.
  • ResNet-50: 20% density (5x) versus the expert's 29% (3.4x) at 76.1% top-1; 3x3 layers are pruned harder than 1x1 layers.في ResNet-50: كثافة 20% (5x) مقابل 29% للخبير (3.4x) عند دقة top-1 تساوي 76.1%؛ وتُقلَّم طبقات 3x3 بقوة أكبر من طبقات 1x1.
  • MobileNet on a Galaxy S7 Edge: 50% FLOPs gives 64.4 ms at 70.5%, 50% time gives 59.7 ms at 70.2%, both beating 0.75 MobileNet at 69.5 ms and 68.4%.MobileNet على Galaxy S7 Edge: هدف 50% FLOPs يعطي 64.4 ms عند 70.5%، وهدف 50% Time يعطي 59.7 ms عند 70.2%، وكلاهما يتفوق على 0.75 MobileNet عند 69.5 ms و68.4%.
  • Targeting measured time lands within a whisker of the speed goal; targeting FLOPs is only a proxy.استهداف الزمن المقاس يصل إلى هدف السرعة تقريبًا تمامًا؛ أما استهداف FLOPs فهو مجرد بديل تقريبي (proxy).

Sourcesالمصادر