บทที่ 1: บทนำ
1.1 การเติบโตของโครงข่ายประสาทเทียมเชิงลึก (The Rise of Deep Neural Networks)
โครงข่ายประสาทเทียมเชิงลึก (Deep Neural Networks – DNNs) ได้กลายเป็นรากฐานที่สำคัญของปัญญาประดิษฐ์ (Artificial Intelligence – AI) สมัยใหม่ โดยเป็นพลังขับเคลื่อนแอปพลิเคชันที่หลากหลาย ตั้งแต่ยานยนต์ไร้คนขับไปจนถึงการจดจำภาพถ่าย ในหลายแอปพลิเคชัน DNNs ได้พิสูจน์แล้วว่ามีความสามารถเทียบเท่าหรือแม้กระทั่งเหนือกว่ามนุษย์ ส่วนนี้จะวางรากฐานเพื่อทำความเข้าใจหลักการพื้นฐานและรูปแบบการทำงานของ DNNs โดยเฉพาะอย่างยิ่งโครงข่ายประสาทเทียมแบบสังวัตนาการ (Convolutional Neural Networks – CNNs)
หัวใจสำคัญของ DNNs คือความสามารถในการสกัดคุณลักษณะระดับสูง (high-level features) จากข้อมูลการฝึกสอนจำนวนมหาศาลได้โดยอัตโนมัติผ่านการเรียนรู้เชิงสถิติ ซึ่งแตกต่างอย่างสิ้นเชิงกับวิธีการในยุคก่อนหน้าที่ต้องอาศัยผู้เชี่ยวชาญในแต่ละสาขามาสร้างคุณลักษณะ (hand-crafted features) ด้วยตนเอง ในบรรดา DNNs ประเภทต่าง ๆ เช่น Multilayer Perceptrons (MLP), Recurrent Neural Networks (RNNs) และ Long Short-Term Memory (LSTM) Networks, CNNs ถือเป็นประเภทที่ใช้กันอย่างแพร่หลายที่สุด โดยเฉพาะอย่างยิ่งสำหรับงานด้านคอมพิวเตอร์วิทัศน์ (computer vision) ซึ่งได้ปฏิวัติวงการและทำให้แอปพลิเคชันจำนวนมากกลายเป็นที่นิยมในกระแสหลัก
กระบวนการประมวลผลของ DNN/CNN โดยทั่วไปแบ่งออกเป็นสองขั้นตอนหลัก ได้แก่ การฝึกสอน (Training) และ การอนุมาน (Inference)
- การฝึกสอน (Training) เป็นกระบวนการที่ต้องใช้พลังการประมวลผลสูงมาก โดยโมเดล DNN จะถูกฝึกด้วยชุดข้อมูลขนาดใหญ่เฉพาะทาง ซึ่งอาจใช้เวลานานหลายสัปดาห์บนโครงสร้างพื้นฐานคลาวด์เพื่อให้ได้ความแม่นยำตามเป้าหมาย
- การอนุมาน (Inference) คือการนำโมเดลที่ผ่านการฝึกสอนแล้วไปใช้งานจริง ซึ่งสามารถทำได้ทั้งบนคลาวด์หรือบนอุปกรณ์ปลายทาง (edge device) เช่น โทรศัพท์มือถือ อุปกรณ์ IoT หรือยานยนต์ไร้คนขับ
ในปัจจุบัน มีแนวโน้มที่ชัดเจนในการย้ายกระบวนการอนุมานมาไว้ที่อุปกรณ์ปลายทางโดยตรง (edge inference) ด้วยเหตุผลเชิงกลยุทธ์หลายประการ:
- ลดต้นทุนการสื่อสารและลดความหน่วง (Reduced Communication Cost and Latency): การประมวลผลข้อมูล ณ จุดที่ข้อมูลถูกสร้างขึ้นช่วยลดความจำเป็นในการส่งข้อมูลจำนวนมากไปยังคลาวด์ ซึ่งช่วยลดทั้งค่าใช้จ่ายและเวลาแฝงในการรับส่งข้อมูล
- เพิ่มความปลอดภัยและความเป็นส่วนตัว (Enhanced Security and Privacy): การเก็บข้อมูลส่วนบุคคล เช่น รูปภาพและวิดีโอ ไว้บนอุปกรณ์โดยตรงช่วยลดความเสี่ยงด้านความปลอดภัยที่เกี่ยวข้องกับการส่งข้อมูลผ่านเครือข่ายไปยังเซิร์ฟเวอร์คลาวด์
- เพิ่มความน่าเชื่อถือ (Improved Reliability): ฟังก์ชันต่าง ๆ ของอุปกรณ์ยังคงทำงานได้แม้ในขณะที่การเชื่อมต่อเครือข่ายถูกรบกวนหรือขาดหายไป
แม้ว่าการประมวลผลบนอุปกรณ์ปลายทางจะมีข้อดีมากมาย แต่ก็มาพร้อมกับความท้าทายที่สำคัญ เนื่องจากอุปกรณ์เหล่านี้มีข้อจำกัดด้านต้นทุนและทรัพยากรที่เข้มงวด ทำให้ความสามารถในการประมวลผลมีจำกัด ดังนั้น การทำให้โมเดล DNN/CNN ที่ต้องใช้การคำนวณและหน่วยความจำสูงสามารถทำงานได้อย่างมีประสิทธิภาพบนอุปกรณ์เหล่านี้จึงกลายเป็นโจทย์ที่สำคัญอย่างยิ่ง การย้ายมายังอุปกรณ์ปลายทางนี้ แม้จะเป็นกลยุทธ์ที่ถูกต้อง แต่ก็ได้สร้างความขัดแย้งโดยตรง กล่าวคือ โมเดลขนาดใหญ่ที่มีความแม่นยำสูงซึ่งขับเคลื่อนแอปพลิเคชันที่ปฏิวัติวงการเหล่านี้ กลับขัดแย้งโดยพื้นฐานกับข้อจำกัดด้านพลังงาน ความร้อน และงบประมาณการคำนวณที่เข้มงวดของอุปกรณ์ปลายทาง
เพื่อที่จะเข้าใจถึงความท้าทายทางวิศวกรรมนี้อย่างถ่องแท้ จำเป็นต้องย้อนรอยเส้นทางประวัติศาสตร์ของโครงข่ายเหล่านี้และสำรวจขอบเขตของการประยุกต์ใช้ที่ขับเคลื่อนความต้องการในการคำนวณนี้
1.2 ประวัติและการประยุกต์ใช้ (History and Applications)
แม้ว่าแนวคิดของโครงข่ายประสาทเทียมจะมีมานานหลายทศวรรษ แต่ความก้าวหน้าอย่างก้าวกระโดดของพลังการประมวลผลและความพร้อมใช้งานของข้อมูลจำนวนมหาศาลในยุคปัจจุบัน ได้กลายเป็นปัจจัยเร่งให้เกิดการเติบโตและการนำไปใช้อย่างแพร่หลายในอุตสาหกรรมต่าง ๆ ส่วนนี้จะสำรวจประวัติศาสตร์และเน้นย้ำถึงขอบเขตการใช้งานที่สำคัญของเทคโนโลยีนี้
โครงข่ายประสาทเทียมมีต้นกำเนิดมาตั้งแต่ช่วงทศวรรษที่ 1940 แต่โครงข่ายแรกที่สามารถนำไปใช้งานได้จริงคือ LeNet ซึ่งถูกนำเสนอในปี 1989 เพื่อแก้ปัญหาการจดจำตัวเลขที่เขียนด้วยลายมือ LeNet ได้ปูทางไปสู่การพัฒนาแอปพลิเคชันที่เกี่ยวข้องกับการรู้จำตัวเลขอีกมากมาย เช่น ตู้เอทีเอ็ม, การรู้จำอักขระด้วยแสง (OCR) และการรู้จำป้ายทะเบียนรถยนต์อัตโนมัติ อย่างไรก็ตาม การเติบโตในช่วงแรกเป็นไปอย่างเชื่องช้าเนื่องจากข้อจำกัดด้านพลังการประมวลผลมหาศาลที่จำเป็นสำหรับการประมวลผล
การเติบโตอย่างก้าวกระโดดของ DNN ในทศวรรษที่ผ่านมาเกิดขึ้นได้จากสองปัจจัยหลัก:
- ความก้าวหน้าของพลังการประมวลผล (Advancements in Processing Power): คอมพิวเตอร์ในปัจจุบันมีความสามารถในการคำนวณสูงขึ้นอย่างมีนัยสำคัญ ทำให้สามารถประมวลผลโครงข่ายประสาทเทียมที่ซับซ้อนได้ภายในเวลาที่สมเหตุสมผล ซึ่งเป็นสิ่งที่ทำไม่ได้ในยุคแรก ๆ
- ความพร้อมใช้งานของชุดข้อมูลขนาดใหญ่ (Availability of Large Datasets): การมีข้อมูลจำนวนมหาศาลสำหรับการฝึกสอนช่วยให้โมเดลมีความแม่นยำสูงขึ้น ตัวอย่างเช่น Meta (บริษัทแม่ของ Facebook) ได้รับรูปภาพจากผู้ใช้เกือบหนึ่งพันล้านภาพต่อวัน ในขณะที่ YouTube มีวิดีโอถูกอัปโหลด 300 ชั่วโมงทุก ๆ นาที [6] ข้อมูลที่หลั่งไหลเข้ามาอย่างมหาศาลนี้ช่วยให้ผู้ให้บริการมีทรัพยากรที่จำเป็นในการฝึกสอนโครงข่ายประสาทเทียมของตนให้มีความแม่นยำสูงเป็นพิเศษ ซึ่งเป็นรากฐานของแอปพลิเคชันต่าง ๆ ที่สร้างรายได้หลายพันล้านดอลลาร์
ปัจจุบัน DNNs ได้สร้างผลกระทบในหลากหลายวงการ โดยมีการประยุกต์ใช้ที่สำคัญดังนี้:
- การประมวลผลคำพูด (Speech Processing): DNNs ช่วยให้สามารถพัฒนาระบบรู้จำคำพูดแบบเรียลไทม์ที่มีความแม่นยำสูงอย่างที่ไม่เคยมีมาก่อน และถูกนำไปใช้ในการแปลภาษา ตัวอย่างเช่น Google ใช้ระบบ Google’s Neural Machine Translation (GNMT) [10] ซึ่งเป็นโมเดลที่ใช้ LSTM สำหรับแอปพลิเคชันการแปลภาษา
- ยานยนต์ไร้คนขับ (Autonomous Driving): การเติบโตอย่างรวดเร็วของเทคโนโลยีขับขี่อัตโนมัติเกิดขึ้นพร้อมกับการได้รับความนิยมของ CNNs ที่มีความแม่นยำสูง บริษัทอย่าง Tesla [11] และ Waymo [12] ต่างก็ใช้ CNNs เป็นเทคโนโลยีหลักในการรับรู้ภาพจากสภาวะบนท้องถนน ซึ่งเป็นหัวใจสำคัญของระบบช่วยเหลือผู้ขับขี่ขั้นสูง (Advanced Driver Assistance Systems – ADAS)
- ปัญญาประดิษฐ์ทางการแพทย์ (Medical AI): DNNs/CNNs ได้กลายเป็นเครื่องมือสำคัญทางการแพทย์ แพทย์สามารถใช้ภาพทางการแพทย์ที่วิเคราะห์โดย AI เพื่อช่วยในการผ่าตัด นอกจากนี้ AI ยังถูกใช้ในสาขาพันธุศาสตร์ (genomics) เพื่อทำความเข้าใจความผิดปกติทางพันธุกรรม เช่น โรคออทิซึม [13, 14] และยังช่วยในการตรวจจับมะเร็งชนิดต่าง ๆ เช่น มะเร็งผิวหนังและมะเร็งสมอง [15, 16]
- ความปลอดภัย (Security): การมาถึงของ AI ได้ท้าทายแนวทางการรักษาความปลอดภัยแบบดั้งเดิม โดยเฉพาะอย่างยิ่งเมื่อมีการใช้อุปกรณ์ IoT เพิ่มขึ้นอย่างมหาศาล ปัจจุบัน AI ถูกนำมาใช้ทั้งในการโจมตีทางไซเบอร์ และในขณะเดียวกันก็เป็นองค์ประกอบที่จำเป็นในการสร้างการป้องกันการโจมตีโต้กลับที่ทันสมัย
โดยรวมแล้ว การใช้งาน DNNs โดยเฉพาะ CNNs ได้เติบโตอย่างก้าวกระโดดในช่วงทศวรรษที่ผ่านมา และแนวโน้มนี้ยังคงเพิ่มสูงขึ้นอย่างต่อเนื่อง การใช้งาน CNNs บนอุปกรณ์ปลายทางที่เพิ่มขึ้นอย่างมหาศาลนี้ จำเป็นต้องมีการพัฒนาสถาปัตยกรรมหน่วยประมวลผลที่มีประสิทธิภาพเพื่อตอบสนองความต้องการในการคำนวณที่สูงขึ้น อย่างไรก็ตาม โมเดลที่ขับเคลื่อนแอปพลิเคชันขั้นสูงเหล่านี้กลับนำมาซึ่งความท้าทายที่สำคัญด้านการคำนวณและพลังงาน
1.3 ข้อเสียของ DNNs/CNNs ที่มีความแม่นยำสูง (Pitfalls of High-Accuracy DNNs/CNNs)
การสร้างโมเดล DNN/CNN ให้มีความแม่นยำสูงนั้นต้องแลกมากับต้นทุนที่สำคัญ ส่วนนี้จะวิเคราะห์ความท้าทายหลักที่เกิดขึ้น ซึ่งได้แก่ปัญหาคอขวดด้านการประมวลผลและพลังงาน รวมถึงความซับซ้อนที่เกิดจากความเบาบางของโมเดล (model sparsity)
1.3.1 ปัญหาคอขวดด้านการประมวลผลและพลังงาน (Compute and Energy Bottleneck)
หนทางสู่การเพิ่มความแม่นยำของ CNNs มักเกี่ยวข้องกับการเพิ่มจำนวนชั้นสังวัตนาการ (Convolution Layers – CONV) ซึ่งส่งผลโดยตรงต่อความต้องการด้านการคำนวณและหน่วยความจำที่สูงขึ้นอย่างมหาศาล การแข่งขัน ImageNet Challenge [2] แสดงให้เห็นถึงการพัฒนาด้านความแม่นยำอย่างชัดเจน จาก AlexNet ที่มีความแม่นยำแบบ Top-1 ที่ 63.3% ในปี 2012 มาสู่ EfficientNetV2 ที่มีความแม่นยำถึง 87.3% ในปี 2021 [4]
ตารางด้านล่างนี้เปรียบเทียบโมเดล CNNs ยอดนิยมบางส่วน ซึ่งแสดงให้เห็นถึงความสัมพันธ์ระหว่างความซับซ้อนและความแม่นยำ
| โมเดล CNN | จำนวนชั้น | ความแม่นยำ Top-1 (%) | ความแม่นยำ Top-5 (%) | พารามิเตอร์ | การคำนวณ (MACs) |
| AlexNet | 8 | 63.3 | 84.6 | 62M | 666M |
| VGG-16 | 16 | 74.3 | 91.9 | 138M | 15.3B |
| GoogleNet | 22 | 68.9 | 88.0 | 6.8M | 1.5B |
| MobileNet | 28 | 70.9 | 89.9 | 4.2M | 569M |
| ResNet-50 | 50 | 75.3 | 92.2 | 25.5M | 3.9B |
จากตารางจะเห็นได้อย่างชัดเจนว่า การเพิ่มจำนวนชั้นจะช่วยเพิ่มความแม่นยำ แต่ก็ส่งผลให้จำนวนพารามิเตอร์ของโมเดลและจำนวนการดำเนินการคูณและบวกสะสม (Multiply-Accumulate – MACs) เพิ่มขึ้นอย่างมหาศาล การแยกแยะระหว่างสองตัวชี้วัดนี้เป็นสิ่งสำคัญ: จำนวนพารามิเตอร์เป็นตัวกำหนด ขนาดของหน่วยความจำ (memory footprint) ของโมเดล ในขณะที่จำนวน MACs เป็นตัวกำหนด ภาระงานในการคำนวณ (computational workload) ซึ่ง MACs ถือเป็นหน่วยการคำนวณพื้นฐานในชั้น CONV
การเพิ่มขึ้นอย่างมหาศาลของพารามิเตอร์นี้ส่งผลกระทบโดยตรงและรุนแรงต่อการใช้พลังงาน โดยเฉพาะบนอุปกรณ์ปลายทาง เมื่อขนาดของโมเดลเพิ่มขึ้นจากหลักล้านเป็นหลายร้อยล้านพารามิเตอร์ ขนาดของโมเดลจะเกินกว่าความจุของ SRAM บนชิปที่มีขนาดเล็กและประหยัดพลังงาน ทำให้ต้องจัดเก็บค่าน้ำหนักของโมเดลไว้ใน DRAM นอกชิปที่สิ้นเปลืองพลังงาน ปัญหาคอขวดด้านหน่วยความจำนี้จึงกลายเป็นปัจจัยหลักที่ส่งผลต่อการใช้พลังงานของระบบ มากกว่าการคำนวณเสียอีก ดังคำกล่าวที่ว่า “ต้นทุนพลังงานต่อการดึงข้อมูล 32 บิตจาก DRAM ประเภท LPDDR2 (low-power double data rate 2) นอกชิปอยู่ที่ประมาณ 640 pJ ซึ่งสูงกว่าต้นทุนพลังงานของการบวกเลขจำนวนเต็ม 32 บิตถึงประมาณ 6,400 เท่า [36]”
[คำอธิบายภาพ: แผนภูมิแท่งแสดงต้นทุนพลังงานสัมพัทธ์ของการดำเนินการต่าง ๆ ในระดับลอการิทึมฐาน 10 โดยการอ่าน DRAM 32 บิตมีต้นทุนสูงสุดอย่างมีนัยสำคัญเมื่อเทียบกับการดำเนินการอื่น ๆ เช่น การบวกหรือการคูณ] Caption: Energy cost (relative to 8 bit Add operation) shown on a log10 scale for a 45 nm process technology. Source: Adapted from [6, 36].
เพื่อแก้ไขปัญหาคอขวดนี้ ได้มีการพัฒนาเทคนิคระดับอัลกอริทึมขึ้นมา เช่น MobileNets [33, 34] ซึ่งออกแบบมาเพื่อลดความต้องการในการคำนวณโดยการแยกการดำเนินการสังวัตนาการ 2 มิติแบบมาตรฐานออกเป็นการสังวัตนาการแบบ depthwise separable และ pointwise ซึ่งใช้การคำนวณน้อยกว่า และส่งผลให้การคำนวณโดยรวมลดลง 8 ถึง 9 เท่า
1.3.2 ความท้าทายจาก Sparsity (Challenges from Sparsity)
การตัดแต่ง (Pruning) เป็นอีกหนึ่งเทคนิคที่ใช้ในการบีบอัดโมเดล DNN โดยการตัดการเชื่อมต่อที่ไม่สำคัญออกไป ซึ่งอ้างอิงจากงานวิจัยของ Han และคณะ [46] กระบวนการนี้ส่งผลให้เกิดสิ่งที่เรียกว่า ความเบาบางสองด้าน (two-sided sparsity) ซึ่งหมายถึงความเบาบางที่เกิดขึ้นทั้งในส่วนของค่าน้ำหนัก (weights) และค่าแอกทิเวชัน (activations) ของโมเดล
เทคนิคการตัดแต่งนี้มีประโยชน์อย่างมาก โดยสามารถลดขนาดโมเดลของ AlexNet ได้ประมาณ 9 เท่า และ VGG-16 ได้ถึง 13 เท่า นอกจากนี้ยังช่วยลดจำนวนการคำนวณที่มีประสิทธิภาพลงได้ 4 ถึง 9 เท่า (ขึ้นอยู่กับโมเดล) อย่างไรก็ตาม แม้ว่าประโยชน์เหล่านี้จะดูน่าสนใจ แต่การออกแบบตัวเร่งความเร็ว (accelerator) ที่สามารถใช้ประโยชน์จากความเบาบางนี้ได้อย่างเต็มที่เป็นเรื่องที่ท้าทายอย่างยิ่ง ความเบาบางที่ไม่สม่ำเสมอและมีลักษณะละเอียด (fine-grained sparsity) นี้เปรียบเสมือนยาพิษสำหรับสถาปัตยกรรมฮาร์ดแวร์แบบขนาน มันนำไปสู่ ความไม่สมดุลของภาระงาน (load imbalance) อย่างรุนแรงระหว่างหน่วยประมวลผล ซึ่งบางหน่วยประมวลผลกำลังทำงานอย่างเต็มที่ ในขณะที่หน่วยอื่น ๆ กลับต้องว่างงานเพื่อรอข้อมูลที่ไม่ใช่ศูนย์ นอกจากนี้ยังสร้าง รูปแบบการเข้าถึงหน่วยความจำที่ไม่มีประสิทธิภาพ (inefficient memory access patterns) ทำลายหลักการ locality ที่แคชของฮาร์ดแวร์ต้องพึ่งพา และนำไปสู่การเข้าถึง DRAM ที่บ่อยครั้งและใช้พลังงานสูง ด้วยเหตุนี้ การออกแบบตัวเร่งความเร็วที่ไม่คำนึงถึงปัจจัยเหล่านี้อาจพบว่าประสิทธิภาพที่คาดว่าจะได้รับนั้นถูกลบล้างไปจนหมดสิ้นโดยการใช้งานฮาร์ดแวร์ที่ไม่เต็มประสิทธิภาพและปัญหาคอขวดของหน่วยความจำ
แม้จะมีปัญหาเหล่านี้ แต่ก็มีสถาปัตยกรรมตัวเร่งความเร็วจำนวนมากที่ถูกนำเสนอขึ้นเพื่อสร้างสมดุลระหว่างความซับซ้อนของทรัพยากรฮาร์ดแวร์และประสิทธิภาพการทำงาน สถาปัตยกรรมที่กล่าวถึงในส่วนที่ 4 ของหนังสือเล่มนี้เป็นการตอบสนองโดยตรงต่อความท้าทายพื้นฐานด้านการประมวลผล พลังงาน และความเบาบางเหล่านี้
1.4 สรุปท้ายบท (Chapter Summary)
บทนี้ได้อภิปรายถึงประวัติและการประยุกต์ใช้ของ DNNs โดยเน้นที่ CNNs นอกจากนี้ยังได้ชี้ให้เห็นถึงปัญหาคอขวดด้านการประมวลผลและพลังงานที่สำคัญ รวมถึงผลกระทบของความเบาบาง (sparsity) ในโมเดล CNN ที่มีความแม่นยำสูง ซึ่งส่งผลต่อปริมาณงาน (throughput) และการใช้ประโยชน์จากฮาร์ดแวร์ของอุปกรณ์ปลายทางอย่างมีนัยสำคัญ
1.1 The Rise of Deep Neural Networks
Deep Neural Networks (DNNs) have become a fundamental pillar of modern Artificial Intelligence (AI), powering a wide range of applications—from autonomous vehicles to image recognition. In many applications, DNNs have already demonstrated performance on par with, or even surpassing, that of humans. This section lays the groundwork for understanding the basic principles and operational patterns of DNNs, with a particular focus on Convolutional Neural Networks (CNNs).
At the heart of DNNs is their ability to automatically extract high-level features from massive amounts of training data through statistical learning. This is in stark contrast to earlier approaches, which relied on domain experts to manually engineer features (hand-crafted features). Among the various types of DNNs—such as Multilayer Perceptrons (MLPs), Recurrent Neural Networks (RNNs), and Long Short-Term Memory (LSTM) Networks—CNNs are the most widely used, especially in computer vision tasks, where they have revolutionized the field and enabled many mainstream applications.
In general, the processing pipeline of DNNs/CNNs can be divided into two main phases: training and inference.
- Training is a highly compute-intensive process. A DNN model is trained on a large, domain-specific dataset and may require weeks of computation on cloud infrastructure to reach the desired accuracy.
- Inference is the deployment phase, where the trained model is used in real-world applications. Inference can be performed either in the cloud or directly on edge devices such as smartphones, IoT devices, or autonomous vehicles.
There is now a clear trend toward moving inference directly onto edge devices (edge inference) for several strategic reasons:
- Reduced communication cost and latency: Processing data where it is generated reduces the need to transmit large volumes of data to the cloud, lowering both communication costs and latency.
- Enhanced security and privacy: Keeping personal data (such as images and videos) on-device reduces security risks associated with sending sensitive data over networks to cloud servers.
- Improved reliability: Device functions can continue to operate even when network connectivity is poor or temporarily unavailable.
However, while edge processing offers many advantages, it also introduces major challenges. Edge devices are subject to strict constraints in terms of cost and resources, which limit their processing capability. Making compute- and memory-hungry DNN/CNN models run efficiently on such devices has therefore become a critical engineering problem. Moving inference to the edge, although strategically sound, creates a direct tension: the large, highly accurate models that power breakthrough applications fundamentally conflict with the tight power, thermal, and compute budgets of edge hardware.
To fully understand this engineering challenge, it is necessary to trace the historical development of these networks and explore the range of applications that drive such demanding computational requirements.
1.2 History and Applications
Although the concept of neural networks has existed for decades, the recent explosive growth in computational power and the availability of massive datasets have been the key catalysts enabling their widespread industrial adoption. This section reviews their history and highlights key application domains.
Neural networks date back to the 1940s, but the first practically deployable network was LeNet, introduced in 1989 for handwritten digit recognition. LeNet paved the way for many digit-related recognition applications, such as ATMs, optical character recognition (OCR), and automatic license plate recognition. However, early growth was slow due to the enormous computational power required.
The dramatic rise of DNNs over the past decade has been driven by two key factors:
- Advances in processing power: Modern computing hardware can perform the vast number of operations required by complex neural networks within reasonable time frames, something that was infeasible in earlier decades.
- Availability of large datasets: Massive training datasets enable models to achieve high accuracy. For example, Meta (Facebook’s parent company) receives nearly one billion user images per day, and YouTube sees 300 hours of video uploaded every minute [6]. This flood of data provides service providers with ample resources to train highly accurate neural networks, which in turn underpin applications generating billions of dollars in revenue.
Today, DNNs have made a significant impact across many fields. Key applications include:
- Speech Processing:
DNNs have enabled highly accurate, real-time speech recognition systems and are used in language translation. For instance, Google’s Neural Machine Translation (GNMT) system [10], based on LSTM networks, powers large-scale translation services. - Autonomous Driving:
The rapid growth of self-driving technology has gone hand-in-hand with the adoption of high-accuracy CNNs. Companies such as Tesla [11] and Waymo [12] use CNNs as core components for visual perception of road environments—an essential part of Advanced Driver Assistance Systems (ADAS). - Medical AI:
DNNs/CNNs have become vital tools in medicine. Physicians can rely on AI-analyzed medical images to assist in surgery. AI is also used in genomics to understand genetic disorders such as autism [13, 14], and to detect various cancers, including skin and brain cancers [15, 16]. - Security:
The advent of AI has challenged traditional security methods, especially as IoT devices proliferate. Today, AI is used both to carry out cyberattacks and as a crucial component in building advanced defensive systems against such attacks.
Overall, the use of DNNs—especially CNNs—has surged over the past decade and continues to grow rapidly. The massive increase in CNN-based applications running on edge devices demands the development of highly efficient processing architectures to support the rising computational load. At the same time, the models powering these advanced applications bring significant challenges in terms of computation and energy consumption.
1.3 Pitfalls of High-Accuracy DNNs/CNNs
Building highly accurate DNN/CNN models comes with considerable costs. This section examines the main challenges, including compute and energy bottlenecks and the complexity introduced by model sparsity.
1.3.1 Compute and Energy Bottleneck
Improving the accuracy of CNNs typically involves increasing the number of convolution layers (CONV), which directly drives up computational and memory requirements. The ImageNet Challenge [2] clearly illustrates this trend in accuracy improvements—from AlexNet, with a Top-1 accuracy of 63.3% in 2012, to EfficientNetV2, with a Top-1 accuracy of 87.3% in 2021 [4].
The following table compares several popular CNN models, highlighting the relationship between model complexity and accuracy:
| CNN Model | # Layers | Top-1 Accuracy (%) | Top-5 Accuracy (%) | Parameters | Compute (MACs) |
|---|---|---|---|---|---|
| AlexNet | 8 | 63.3 | 84.6 | 62M | 666M |
| VGG-16 | 16 | 74.3 | 91.9 | 138M | 15.3B |
| GoogleNet | 22 | 68.9 | 88.0 | 6.8M | 1.5B |
| MobileNet | 28 | 70.9 | 89.9 | 4.2M | 569M |
| ResNet-50 | 50 | 75.3 | 92.2 | 25.5M | 3.9B |
From this table, it is clear that deeper models generally yield higher accuracy, but at the cost of a massive increase in both the number of parameters and the number of Multiply-Accumulate operations (MACs). It is important to distinguish between these two metrics:
- The number of parameters determines the memory footprint of the model.
- The number of MACs determines the computational workload. MACs are the fundamental compute unit in CONV layers.
The explosive growth in parameter count has a direct and severe effect on energy consumption, especially on edge devices. As model sizes grow from millions to hundreds of millions of parameters, they exceed the capacity of small, low-power on-chip SRAM. This forces model weights to be stored in off-chip DRAM, which is much more energy-hungry. The memory bottleneck thus becomes the dominant factor in system energy consumption, even more than computation itself. As has been noted:
“The energy cost of fetching a 32-bit word from off-chip LPDDR2 DRAM is about 640 pJ, which is approximately 6,400 times higher than the energy cost of a 32-bit integer addition [36].”
[Illustration description: A bar chart shows the relative energy cost of various operations on a log10 scale. Reading a 32-bit word from DRAM has by far the highest cost compared to operations such as addition or multiplication.]
Caption: Energy cost (relative to 8-bit Add operation) shown on a log10 scale for a 45 nm process technology. Source: Adapted from [6, 36].
To mitigate this bottleneck, algorithm-level techniques have been developed—for example, MobileNets [33, 34], which are designed to reduce computational demands by factorizing standard 2D convolutions into depthwise separable convolutions and pointwise convolutions. This significantly cuts down the number of operations, reducing overall computation by a factor of 8 to 9.
1.3.2 Challenges from Sparsity
Pruning is another key technique for compressing DNN models by removing unimportant connections. As shown in the work of Han et al. [46], pruning leads to what is known as two-sided sparsity, meaning sparsity in both the model’s weights and its activations.
Pruning can be extremely effective: it can shrink the size of AlexNet by about 9× and VGG-16 by up to 13×, while reducing effective computation by 4× to 9×, depending on the model. However, despite these apparent benefits, designing hardware accelerators that can fully exploit this sparsity is highly challenging.
Fine-grained, irregular sparsity behaves like a poison for parallel hardware architectures:
- It causes severe load imbalance across processing units, where some units are fully utilized while others sit idle waiting for non-zero data.
- It leads to inefficient memory access patterns, undermining the locality that hardware caches rely on, and resulting in frequent, power-hungry DRAM accesses.
As a result, an accelerator design that ignores these factors may see its expected performance gains wiped out by poor hardware utilization and memory bottlenecks.
Despite these issues, many accelerator architectures have been proposed to strike a balance between hardware resource complexity and performance. The architectures discussed in Chapter 4 of this book are direct responses to these fundamental challenges in computation, energy, and sparsity.
1.4 Chapter Summary
This chapter has discussed the history and applications of DNNs, with a focus on CNNs. It has also highlighted major compute and energy bottlenecks, as well as the impact of sparsity in high-accuracy CNN models—which significantly affects throughput and hardware efficiency on edge devices.
第 1 章:导论
1.1 深度神经网络的崛起
深度神经网络(Deep Neural Networks,DNNs)已成为现代人工智能(Artificial Intelligence, AI)的关键基础,驱动着从自动驾驶到图像识别的各种应用。在许多任务中,DNNs 已证明其性能可与人类相媲美,甚至超越人类。本节将为理解 DNNs 的基本原理与工作模式奠定基础,重点介绍卷积神经网络(Convolutional Neural Networks, CNNs)。
DNN 的核心优势是能够通过统计学习,从海量训练数据中 自动提取高层特征(high-level features),这与过去依赖专家手工设计特征(hand-crafted features)的传统方法完全不同。在多种 DNN 架构中,如多层感知机(MLP)、循环神经网络(RNN)、长短期记忆网络(LSTM)等,CNN 是应用最广泛的一种,尤其在计算机视觉领域,它彻底改变了行业格局,使许多原本前沿的 AI 应用走向主流。
通常,DNN/CNN 的处理流程可分为两个主要阶段:**训练(Training)**和 推理(Inference):
- 训练(Training)
是极度耗费算力的过程。模型需使用大型、专门的训练数据集进行训练,可能需要在云端基础设施上持续运行数周,才能达到目标精度。 - 推理(Inference)
是将训练好的模型投入实际应用,可在云端运行,也可在边缘设备(edge device)上运行,如手机、IoT 设备或自动驾驶汽车。
目前出现了一个明显趋势:将推理迁移至边缘设备(edge inference),原因包括:
- 降低通信成本与延迟:在数据产生处进行处理,无需将大量数据传输至云端。
- 增强隐私与安全性:图像、视频等隐私数据直接在设备本地处理,避免网络传输带来的风险。
- 提高可靠性:即使网络连接不稳定或中断,设备功能仍可持续工作。
然而,边缘设备具有严格的成本与资源限制,使其算力受限。要让计算量和存储量巨大的 DNN/CNN 在这些设备上高效运行,成为关键工程挑战。尽管边缘推理是正确战略方向,但它带来了直接矛盾:高精度、大规模模型的计算与能耗需求,与边缘设备有限的功耗、散热和计算资源天然冲突。
要深入理解这一工程难题,需要回顾神经网络的发展历史,并了解推动高计算需求的应用场景。
1.2 历史与应用
虽然神经网络的概念已有数十年历史,但近年来由于计算能力的飞速提升,以及海量数据的可获得性,它们才真正成为工业界的核心技术。本节将回顾其发展历程,并强调当前最重要的应用领域。
神经网络起源于 20 世纪 40 年代,但第一款真正可用的网络是 LeNet(1989),用于手写数字识别。它奠定了 ATM、OCR、车牌识别等应用的基础。然而,由于早期计算能力不足,神经网络的增长速度相对缓慢。
过去十年中 DNN 的爆发式增长主要依靠两个因素:
1. 计算能力的突破
现代硬件的性能足以处理复杂的神经网络,使得曾经无法实现的模型训练变得可行。
2. 大规模数据集的可获得性
海量数据显著提升了模型准确率。例如:
- Meta(Facebook 母公司)每天收到近 10 亿张用户图像
- YouTube 每分钟上传 300 小时视频
这些庞大的数据让服务商拥有大量资源训练精度极高的模型,并支撑起数十亿美元的商业应用。
如今,DNN 在多个领域造成巨大影响,主要应用包括:
● 语音处理(Speech Processing)
DNNs 让实时、高精度语音识别成为可能。
例如:Google 的神经机器翻译系统 GNMT [10] 使用 LSTM 模型实现大规模语言翻译。
● 自动驾驶(Autonomous Driving)
自动驾驶技术的迅速发展伴随高精度 CNN 的普及。
Tesla [11]、Waymo [12] 等公司大量使用 CNN 解析路面视觉信息,这是高级驾驶辅助系统(ADAS)的核心。
● 医学人工智能(Medical AI)
DNN/CNN 是现代医疗的重要工具:
- 医学图像 AI 可辅助外科手术
- AI 在基因组学(genomics)中用于理解自闭症等遗传疾病 [13, 14]
- 可检测皮肤癌、脑瘤等多种癌症 [15, 16]
● 安全(Security)
AI 的到来挑战了传统网络安全方式:
- AI 可用于发动网络攻击
- 也可用于构建现代化的反攻击系统
尤其是在 IoT 爆炸增长的时代,AI 更是安全系统的必要组成部分。
总体而言,特别是 CNN 的应用在过去十年呈爆炸性增长。大量模型在边缘设备上运行,使得开发更高效的处理架构成为必然需求。然而,这些高精度模型也带来了重大的计算与能耗挑战。
1.3 高精度 DNN/CNN 的缺陷
训练高精度的 DNN/CNN 模型必须付出相应代价。本节讨论关键挑战,包括计算与能耗瓶颈、以及模型稀疏性(sparsity)带来的复杂性。
1.3.1 计算与能耗瓶颈
提高 CNN 精度通常意味着增加卷积层(CONV)的数量,从而成倍增加模型的计算量和内存需求。
ImageNet Challenge [2] 的结果显示了精度的快速提升:
- AlexNet(2012)Top-1:63.3%
- EfficientNetV2(2021)Top-1:87.3%
下面的表格展示了流行 CNN 模型的复杂度与精度对比:
| CNN 模型 | 层数 | Top-1 (%) | Top-5 (%) | 参数量 | MACs |
|---|---|---|---|---|---|
| AlexNet | 8 | 63.3 | 84.6 | 62M | 666M |
| VGG-16 | 16 | 74.3 | 91.9 | 138M | 15.3B |
| GoogleNet | 22 | 68.9 | 88.0 | 6.8M | 1.5B |
| MobileNet | 28 | 70.9 | 89.9 | 4.2M | 569M |
| ResNet-50 | 50 | 75.3 | 92.2 | 25.5M | 3.9B |
表中可以清楚地看到:
- 更深的网络 → 更高的精度
- 同时也带来:
- 更大的参数量(决定 memory footprint)
- 更多的 MACs(决定计算工作量)
随着模型的参数量从百万级增长到上亿级,它们无法完全放入低功耗芯片上的 SRAM,只能存放在高能耗的 off-chip DRAM 中。
这导致:
- 能耗瓶颈来自内存访问,而非计算本身
引用典型数据:
从 LPDDR2 DRAM 读取 32 位数据的能量成本约 640 pJ,
是执行一个 32 位整数加法的 6,400 倍 [36]。
[图示说明略,保持原文结构]
解决方案包括算法优化,如 MobileNet [33, 34] 将常规卷积分解为 depthwise separable + pointwise 卷积,总计算量减少 8~9 倍。
1.3.2 稀疏性(Sparsity)带来的挑战
剪枝(Pruning) 是常用的模型压缩技术,通过删除不重要的连接来减少模型规模。根据 Han 等人的研究 [46],剪枝会造成:
- 权重稀疏(weight sparsity)
- 激活稀疏(activation sparsity)
即“双侧稀疏性(two-sided sparsity)”。
剪枝的好处显著:
- AlexNet 模型可缩小 9 倍
- VGG-16 可缩小 13 倍
- 实际计算量减少 4~9 倍
但硬件加速器却难以充分利用这种稀疏性,因为稀疏不规则且细粒度,会导致:
- 负载不平衡(load imbalance):部分处理单元忙碌,部分空闲
- 非连续且低效的内存访问模式 → 导致频繁的 DRAM 访问,功耗更高
因此,如果加速器架构未针对稀疏性设计,实际性能可能远低于预期。
尽管存在这些挑战,仍有许多加速器架构试图在硬件资源复杂度与性能之间取得平衡。本书第 4 章介绍的架构即是为了解决这些基本的计算、能耗与稀疏性问题而提出的。
1.4 本章小结
本章讨论了 DNN,特别是 CNN 的发展历史与主要应用领域。同时指出了高精度模型带来的关键工程挑战,包括:
- 计算瓶颈
- 能耗瓶颈
- 稀疏性导致的硬件利用率下降
这些因素都显著影响边缘设备上的吞吐量与硬件效率。
