DOI: https://doi.org/10.18653/v1/2024.acl-long.70
تاريخ النشر: 2024-01-01
المؤلف: Damai Dai وآخرون
الموضوع الرئيسي: نمذجة الموضوعات
نظرة عامة
في هذا القسم، يقدم المؤلفون بنية DeepSeek-MoE، المصممة لتعزيز تخصص الخبراء ضمن نماذج مزيج الخبراء (MoE)، خاصة في سياق نماذج اللغة الكبيرة. تكافح الهياكل التقليدية لمزيج الخبراء، مثل GShard، لضمان أن يطور الخبراء معرفة متميزة ومركزة. لمعالجة ذلك، تستخدم DeepSeek-MoE استراتيجيتين رئيسيتين: أولاً، تقسم الخبراء بدقة إلى \(mN\) وحدة وتفعيل \(mK\) منها، مما يسمح باختيار أكثر تنوعًا للخبراء المفعّلين؛ ثانيًا، تعين \(K_s\) خبراء كمشتركين لالتقاط المعرفة المشتركة وتقليل التكرار بين الخبراء الموجهين.
يظهر المؤلفون أنه حتى عند نطاق متواضع من 2 مليار معلمة، تحقق DeepSeek-MoE أداءً مماثلاً لـ GShard مع 2.9 مليار معلمة، على الرغم من وجود 1.5 مرة أقل من معلمات الخبراء وتكاليف حسابية. علاوة على ذلك، تقترب DeepSeek-MoE من أداء النماذج الكثيفة مع معلمات إجمالية مكافئة، مما يضع معيارًا لهياكل MoE. عند توسيعها إلى 16 مليار معلمة، تحافظ DeepSeek-MoE على أداء تنافسي بالنسبة لكل من DeepSeek 7B و LLaMA2 7B، بينما تستخدم حوالي 40% فقط من الموارد الحسابية. يخطط المؤلفون لإصدار نقطة تفتيش النموذج لـ DeepSeek-MoE 16B لتسهيل المزيد من البحث والتطوير في مجال نماذج اللغة الكبيرة.
مقدمة
تناقش مقدمة ورقة البحث التقدم في توسيع نماذج اللغة، مشيرة إلى أن زيادة المعلمات والموارد الحسابية يمكن أن تعزز بشكل كبير أداء النموذج، كما يتضح من الدراسات الأخيرة (براون وآخرون، 2020؛ OpenAI، 2023؛ توفورون وآخرون، 2023أ؛ هوفمان وآخرون، 2022؛ DeepSeek-AI، 2024). ومع ذلك، فإن التكاليف الحسابية العالية المرتبطة بالتوسع قد دفعت إلى استكشاف بنية مزيج الخبراء (MoE) (جاكوبس وآخرون، 1991؛ جوردان وجاكوبس، 1994؛ شازير وآخرون، 2017) كحل قابل للتطبيق. على الرغم من إمكاناتها، تواجه الهياكل الحالية لمزيج الخبراء، مثل GShard (ليبيكين وآخرون، 2021)، تحديات تتعلق بهجينة المعرفة والتكرار، مما يعيق تخصص الخبراء.
لمعالجة هذه القيود، يقدم المؤلفون DeepSeekMoE، وهي بنية MoE جديدة مصممة لتعزيز تخصص الخبراء من خلال استراتيجيتين رئيسيتين: تقسيم الخبراء بدقة وعزل الخبراء المشتركين. تتضمن الأولى تقسيمًا أكثر دقة للخبراء مع الحفاظ على عدد المعلمات، مما يسمح بتوزيع أكثر دقة للمعرفة بين الخبراء. تركز الاستراتيجية الأخيرة على عزل بعض الخبراء لالتقاط المعرفة المشتركة، مما يقلل من التكرار ويحسن كفاءة المعلمات. تظهر النتائج التجريبية أن DeepSeekMoE، بدءًا من 2 مليار معلمة، تتفوق على GShard 2 مليار وتقترب من أداء النماذج الأكبر ذات عدد المعلمات الأعلى. كما توضح الورقة تجارب واسعة تتحقق من فعالية DeepSeekMoE وتخطط لإصدار النموذج والرمز علنًا.
طرق
في هذا القسم، يوضح المؤلفون إعداد التجارب لتدريب نماذجهم، مع التركيز بشكل خاص على مجموعة بيانات DeepSeek-AI، التي تشمل بيانات باللغة الإنجليزية والصينية. بالنسبة لتجارب التحقق، تم استخدام مجموعة فرعية من 100 مليار رمز، باستخدام مُرمز بايت باير (BPE) بحجم مفردات 8K. تم تكوين النماذج مع 9 طبقات ترانسفورمر وأبعاد مخفية قدرها 1280، مع دمج طبقات مزيج الخبراء (MoE) لتعزيز الأداء. استخدم التدريب مُحسِّن AdamW مع معدل تعلم أقصى قدره $1.08 \times 10^{-3}$، وحجم دفعة قدره 2,000، وإجمالي 25,000 خطوة تدريب، مما أسفر عن حوالي 2 مليار معلمة، منها 0.3 مليار كانت مفعلة.
بالنسبة لنموذج DeepSeekMoE 16B، وسع المؤلفون بيانات التدريب إلى 2 تريليون رمز واستخدموا مُرمز BPE أكبر بحجم مفردات 100K. تميز هذا النموذج بـ 28 طبقة ترانسفورمر وأبعاد مخفية قدرها 2048، مع استبدال طبقات MoE بجميع الشبكات الأمامية باستثناء الأولى. تضمنت التكوين 2 خبير مشترك و64 خبير موجه لكل طبقة MoE، مما أدى إلى إجمالي حوالي 16.4 مليار معلمة، مع 2.8 مليار مفعلة. كان إعداد التدريب مشابهًا لذلك للنموذج السابق ولكن مع تعديلات على معدل التعلم وحجم الدفعة. شملت معايير التقييم لكلا النموذجين مجموعة متنوعة من المهام، بما في ذلك نمذجة اللغة، وفهم القراءة، والتفكير الرياضي، مع استخدام مقاييس مثل خسارة الانتروبيا المتقاطعة، والدقة، ومعدلات المطابقة الدقيقة (EM) لتقييم الأداء عبر مجموعات بيانات مختلفة.
مناقشة
في مناقشة بنية DeepSeekMoE، يقدم المؤلفون نهجًا جديدًا لتعزيز تخصص الخبراء ضمن نماذج مزيج الخبراء (MoE) لمعالجة اللغة باستخدام ترانسفورمر. تتضمن البنية استراتيجيتين رئيسيتين: تقسيم الخبراء بدقة وعزل الخبراء المشتركين. ينطوي تقسيم الخبراء بدقة على تقسيم شبكة التغذية الأمامية لكل خبير إلى مكونات أصغر، مما يزيد من عدد الخبراء المفعّلين مع الحفاظ على الكفاءة الحسابية. يعزز هذا النهج بشكل كبير المرونة التوافقية لتفعيل الخبراء، مما يسمح باكتساب معرفة أكثر تنوعًا. يعالج عزل الخبراء المشتركين مشكلة تكرار المعلمات من خلال تعيين بعض الخبراء لالتقاط المعرفة المشتركة عبر السياقات، مما يقلل من التداخل بين الخبراء الموجهين.
تظهر النتائج التجريبية أن DeepSeekMoE تتفوق على النماذج الحالية، مثل GShard، خاصة من حيث تخصص الخبراء ومقاييس الأداء. تظهر البنية توافقًا وثيقًا مع الحدود العليا النظرية لنماذج MoE، محققة أداءً تنافسيًا مع عدد أقل من المعلمات المفعلة. من الجدير بالذكر أن النموذج يظهر تكرارًا أقل بين الخبراء الموجهين ويبرز عدم قابلية الاستبدال للخبراء المشتركين، الذين يلتقطون المعرفة الأساسية التي لا يمكن الوصول إليها من قبل الخبراء الموجهين. بشكل عام، تؤكد النتائج على فعالية بنية DeepSeekMoE في تحقيق أداء متفوق في مهام نمذجة اللغة على نطاق واسع، مما يشير إلى إمكاناتها لمزيد من التقدم في هذا المجال.
القيود
يسلط قسم القيود الضوء على عدة قيود تم مواجهتها في دراسة DeepSeekMoE 16B. بينما تظهر الأبحاث أن الدقة الأكثر دقة في تقسيم الخبراء تعزز أداء النموذج، اختار المؤلفون دقة معتدلة للحفاظ على الكفاءة الحسابية. تهدف الأعمال المستقبلية إلى وضع قانون توسيع لدقة تقسيم الخبراء والتحقيق في آثار التقسيم الأكثر دقة في النماذج الأكبر.
بالإضافة إلى ذلك، قد يؤدي زيادة اختيار الخبراء في DeepSeekMoE إلى زيادة الحمل الاتصالي، خاصة عندما يتم توزيع الخبراء عبر أجهزة متعددة. لمعالجة هذه المشكلة، يخطط المؤلفون لتطوير خوارزميات محسّنة واستراتيجيات توازي لتقليل تكاليف الاتصال. أخيرًا، تحدد الورقة عدد معلمات الخبراء عند 16 مرة من شبكة التغذية الأمامية القياسية (FFN) وعدد معلمات الخبراء المفعلة عند ضعف عدد FFN القياسية. لا يزال تحديد عدد المعلمات المثلى في تكوينات النماذج الأكبر مجالًا للاستكشاف في المستقبل.
DOI: https://doi.org/10.18653/v1/2024.acl-long.70
Publication Date: 2024-01-01
Author(s): Damai Dai et al.
Primary Topic: Topic Modeling
Overview
In this section, the authors present the DeepSeek-MoE architecture, designed to enhance expert specialization within Mixture-of-Experts (MoE) models, particularly in the context of large language models. Traditional MoE architectures, such as GShard, struggle with ensuring that experts develop distinct and focused knowledge. To address this, DeepSeek-MoE employs two key strategies: first, it finely segments experts into \(mN\) units and activates \(mK\) of them, which allows for a more versatile selection of activated experts; second, it designates \(K_s\) experts as shared to capture common knowledge and reduce redundancy among routed experts.
The authors demonstrate that even at a modest scale of 2 billion parameters, DeepSeek-MoE achieves performance comparable to GShard with 2.9 billion parameters, despite having 1.5 times fewer expert parameters and computational costs. Furthermore, DeepSeek-MoE approaches the performance of dense models with equivalent total parameters, establishing a benchmark for MoE architectures. When scaled to 16 billion parameters, DeepSeek-MoE maintains competitive performance relative to both DeepSeek 7B and LLaMA2 7B, while utilizing only about 40% of the computational resources. The authors plan to release the model checkpoint for DeepSeek-MoE 16B to facilitate further research and development in the field of large language models.
Introduction
The introduction of the research paper discusses the advancements in scaling language models, highlighting that increased parameters and computational resources can significantly enhance model performance, as evidenced by recent studies (Brown et al., 2020; OpenAI, 2023; Touvron et al., 2023a; Hoffmann et al., 2022; DeepSeek-AI, 2024). However, the high computational costs associated with scaling have prompted the exploration of the Mixture-of-Experts (MoE) architecture (Jacobs et al., 1991; Jordan and Jacobs, 1994; Shazeer et al., 2017) as a viable solution. Despite its potential, existing MoE architectures, such as GShard (Lepikhin et al., 2021), face challenges related to knowledge hybridity and redundancy, which hinder expert specialization.
To address these limitations, the authors introduce DeepSeekMoE, a novel MoE architecture designed to enhance expert specialization through two key strategies: Fine-Grained Expert Segmentation and Shared Expert Isolation. The former involves a more granular segmentation of experts while maintaining parameter count, allowing for a more precise distribution of knowledge among experts. The latter strategy focuses on isolating certain experts to capture common knowledge, thereby reducing redundancy and improving parameter efficiency. Empirical results demonstrate that DeepSeekMoE, starting with 2 billion parameters, outperforms GShard 2 billion and approaches the performance of larger models with higher parameter counts. The paper also outlines extensive experiments validating the effectiveness of DeepSeekMoE and plans to release the model and code publicly.
Methods
In this section, the authors detail the experimental setup for training their models, specifically focusing on the DeepSeek-AI corpus, which includes English and Chinese data. For the validation experiments, a subset of 100 billion tokens was utilized, employing a byte pair encoding (BPE) tokenizer with an 8K vocabulary size. The models were configured with 9 Transformer layers and a hidden dimension of 1280, incorporating mixture of experts (MoE) layers to enhance performance. The training utilized the AdamW optimizer with a maximum learning rate of $1.08 \times 10^{-3}$, a batch size of 2,000, and a total of 25,000 training steps, resulting in approximately 2 billion parameters, of which 0.3 billion were activated.
For the DeepSeekMoE 16B model, the authors expanded the training data to 2 trillion tokens and employed a larger BPE tokenizer with a 100K vocabulary size. This model featured 28 Transformer layers and a hidden dimension of 2048, with MoE layers replacing all feedforward networks except the first. The configuration included 2 shared experts and 64 routed experts per MoE layer, leading to a total of approximately 16.4 billion parameters, with 2.8 billion activated. The training setup mirrored that of the previous model but with adjustments to the learning rate and batch size. Evaluation benchmarks for both models encompassed a variety of tasks, including language modeling, reading comprehension, and math reasoning, with metrics such as cross-entropy loss, accuracy, and exact match (EM) rates employed to assess performance across different datasets.
Discussion
In the discussion of the DeepSeekMoE architecture, the authors present a novel approach to enhance expert specialization within Mixture of Experts (MoE) models for Transformer language processing. The architecture incorporates two key strategies: fine-grained expert segmentation and shared expert isolation. Fine-grained expert segmentation involves dividing each expert’s feed-forward network into smaller components, thereby increasing the number of activated experts while maintaining computational efficiency. This approach significantly enhances the combinatorial flexibility of expert activation, allowing for more diverse knowledge acquisition. Shared expert isolation addresses the issue of parameter redundancy by designating certain experts to capture common knowledge across contexts, which reduces overlap among routed experts.
The empirical results demonstrate that DeepSeekMoE outperforms existing models, such as GShard, particularly in terms of expert specialization and performance metrics. The architecture shows a close alignment with the theoretical upper bounds of MoE models, achieving competitive performance with fewer activated parameters. Notably, the model exhibits lower redundancy among routed experts and highlights the irreplaceability of shared experts, which capture essential knowledge not accessible to routed experts. Overall, the findings underscore the effectiveness of the DeepSeekMoE architecture in achieving superior performance in large-scale language modeling tasks, suggesting its potential for further advancements in the field.
Limitations
The section on limitations highlights several constraints encountered in the study of DeepSeekMoE 16B. While the research demonstrates that finer granularity in expert segmentation enhances model performance, the authors opted for a moderate granularity to maintain computational efficiency. Future work aims to establish a scaling law for expert segmentation granularity and to investigate the effects of finer segmentation in larger-scale models.
Additionally, the increased selection of experts in DeepSeekMoE may lead to heightened communication overhead, particularly when experts are distributed across multiple devices. To address this issue, the authors plan to develop improved algorithms and parallelism strategies to reduce communication costs. Lastly, the paper fixes the number of expert parameters at 16 times that of a standard feedforward network (FFN) and the number of activated expert parameters at twice that of a standard FFN. The determination of optimal parameter counts in larger model configurations remains an area for future exploration.
