A future that integrates LLMs and LAMs (Symposium)
Net adapt
1. NetAdapt: Platform-Aware Neural Network
Adaptation for Mobile Applications
Google Inc
Tien-Ju Yang, Andrew Howard, Bo Chen, Xiao Zhang, Alec Go, Mark Sandler, Vivienne Sze, Hartwig Adam
(Submitted on 9 Apr 2018 (v1), last revised 28 Sep 2018 (this version, v2))
[참조] 뉴럴 네트워크 자동 최적화 논문 리뷰: NetAdapt (Google, 2018)|작성자
Donghyun
2. Abstract
This work proposes an algorithm, called NetAdapt, that automatically adapts a
pre-trained deep neural network to a mobile platform given a resource budget.
이 알고리즘은 사전에 훈련 된 심층 신경망을 자원 예산이 주어진 모바일 플랫폼에
자동으로 적응시키는 NetAdapt라는 알고리즘을 제안합니다.
3. Overview(자동으로 최적화!)
Input: Pretrained Network, Budget (constraints)
Output: Platform-optimized network
실용적인 Latency / Energy consumption 과 같은
"Direct Metric"을 기준으로 최적화
4. Problem Formulation
네트워크의 정확도를 최대한 떨어트리지 않으면서, 주어진 Budget을 만족하는 결과를 얻는 것
Net: Net is a simplified network from the initial pretrained network
Acc (·): computes the accuracy
Resj (·): evaluates the direct metric for resource consumption of the j th resource
j : direct metric 제한 조건을 명시
자원은 대기 시간, 에너지, 메모리 일 수 있습니다. 발자국 등 또는 이러한 측정 항목의 조합입니다.
하지만 이를 만족하는 네트워크를 한 번에 찾기란 쉽지 않다.
5. Problem Formulation
이 문제를 여러 개의 Sub-problem으로 나누어, 주어진 Budget 조건을 여러 개로 쪼개어, 한 번에 일정 만큼
만 Budget 조건을 더 타이트하게 만들고,
논문에서는 the constraints gradually become tighter 란 표현을 썼다.
이에 최적화 된 네트워크를 찾는다. 이 네트워크가 다음 단계의 input으로 들어가는 방식!
각 iteration을 표현하는 i가 추가되었다
6. Problem Formulation
Line 3: Output network가 주어진 Budget 조건을 만족 할 때까지 반복
Line 4: Constraints 자원 소비를 조금씩 줄여 타이트하게 만든다.
Line 5-8: Network의 K개 레이어에 대해 각각 다음을 수행
Line 6: 몇 개의 필터를 제거해야 하는지 선택
Line 7: 어떤 필터를 제거할 지 선택
Line 8: Short-term finetuning 진행
Line 9: K개의 레이어를 각각 수정하여 얻은 네트워크 중, Line 8에서 얻은
Accuracy가 가장 높은 네트워크 선택, 이 네트워크는 다음 단계의 Input이
된다.
Line 11: 최종적으로 나온 주어진 Budget을 만족시키는 네트워크에 Long-
term finetuning 을 진행하여 최종 결과물을 얻는다.
8. Algorithm Details
Choose # of Filters: Empirical experiments
이 단계는 경험적 측정에 따라 특정 레이어들을 얼마나 많이 보존할 것인가를 결정
하는 단계이다.
대상 계층의 필터 수를 점차적으로 줄이고 단순화 된 각 네트워크의 자원 소비를 측
정합니다.
변수들 (커널 정보, 채널 수, Input dimension 등)
의 값이 정해지면 해당 레이어의 처리 속도 역시
특정될 수 있다. 이러한 점을 이용해 사전에 실험
을 통해(Empirical Experiments) Layer-wise
Look-up table을 생성해 두고(레이어의 Spatial
정보는 변하지 않으므로!), 주어진 Budget에 따
라 해당 레이어의 필터 수를 조절할 수 있도록 하 - 테이블의 각 정보는 Tensorflow Lite + Pixel Phone 1 을 이용한 실험을 통해 진행되
었다.
역시 구글, 구글은 이런 제약을 "실험을 통해서" 해결해 버렸
다.
9. Algorithm Details
Choose Which Filters
어떤 필터를 제거해야 할 까? 이는 분명 어려운 문제이다.
하지만 이 논문에서는 간단하게 L2-norm magnitude가 작은 순서로 제거하였다.
- Norm은 벡터의 길이 혹은 크기를 측정하는 방법(함수)입니다.
- Norm이 측정한 벡터의 크기는 원점에서 벡터 좌표까지의 거리 혹은 Magnitude라고 합니다.
10. Algorithm Details
Short-/Long-Term Fine-Tune
K개의 레이어에 대해, 모두 Finetuning을 진행하고 결과를 비교하는 것은 시간 소모
의 측면으로 보았을 때 쉽지 않은 일이다.
NetAdapt는 이 문제를 Short- /Long- Term Fine-tune을 구분하는 것으로 해결했다.
- 네트워크 형태를 변형시키는 단계에서의 Fine-tuning은 짧게!
11. Algorithm Details
Short-/Long-Term Fine-Tune
Fig. 8.The accuracy of different short-term fine-tuning
iterations when adapt-ing the small MobileNetV1
(without long-term fine-tuning) on a mobile CPU
ofGoogle Pixel 1. Zero iterations means noshort-term
fine-tuning.
이와 같은 그래프를 보여주며 short-term training iteration
은 40k가 적당하다고 이야기했다.
Fig. 9.The comparison between beforeand after long-
term fine-tuning whenadapting the small MobileNetV1
on a mo-bile CPU of Google Pixel 1. Although
theshort-term fine-tuning preserves the accu-racy well,
the long-term fine-tuning givesthe extra 3.4% on
average (from 1.8% to4.5%)
12. Experiment Results
– Multipliers Two commonly used multipliers are the width multiplier and the
resolution multiplier; they can also be used together. Width multiplier scales: the
number of filters by a percentage across.
We use the notation “50% MobileNetV1 (128)” to denote applying a width
multiplier of 50% on MobileNetV1 with the input image resolution of 128.
– MorphNet is an automatic network simplification algorithm based on sparsifying
regularization.
– ADC(Automated Deep Compression) is an automatic network simplification
algorithm based on reinforcement learning.
13. Experiment Results
Fig. 5. The figure compares NetAdapt (adapting the small MobileNetV1) with the
multipliers and MorphNet on a mobile CPU of Google Pixel 1.
50% MobileNetV1 (128)
14. Experiment Results
100% MobileNetV1 (224)
Fig. 6. The figure compares NetAdapt (adapting the large MobileNetV1) with the
multipliers [9] and ADC [8] on a mobile CPU of Google Pixel 1. Moreover, the
accuracy of the adapted networks can be further increased by up to 1.3% through
using a better training configuration (simply adding dropout and label smoothing).
100% MobileNetV1 (224)
(simply adding dropout and label smoothing)
15. Conclusion
NetAdapt는 대기 시간 및 에너지와 같은 직접 메트릭을 최적화에 통합하여 플랫폼
의 특성에 따라 적응 성능을 최대화 할 수 있습니다. 경험적 측정을 사용하면 원하
는 메트릭을 측정 할 수있는 한 NetAdapt를 모든 플랫폼에 적용 할 수 있습니다.
이 연구에서는 효율적인 네트워크 최적화에 직접 메트릭을 사용하는 것의 중요성
을 강조했습니다.