Gemma 2: व्यावहारिक आकार के open language models में सुधार [PDF]
(storage.googleapis.com)- Google DeepMind का Gemma 2 2B·9B·27B आकार वाले हल्के open models का परिवार है, जिसे छोटे models में भी बड़े models से प्रतिस्पर्धा कर सकने वाले प्रदर्शन के लक्ष्य के साथ जारी किया गया
- 2B और 9B में next-token prediction के बजाय knowledge distillation लागू किया गया, जबकि 27B को शुरुआत से train किया गया, यानी scale के हिसाब से training strategy अलग रखी गई
- architecture के स्तर पर, local-global attention alternation, Grouped-Query Attention, logit soft-capping, और pre-norm·post-norm RMSNorm को मिलाकर efficiency और performance दोनों को साधने की कोशिश की गई
- training data मुख्य रूप से अंग्रेज़ी web documents, code और scientific literature है; यह multimodal या अत्याधुनिक multilingual performance के लक्ष्य वाला model नहीं है
- evaluation में समान आकार के open models की तुलना में performance बेहतर रहा, लेकिन वास्तविक deployment से पहले use case-specific safety testing ज़रूरी है
Gemma 2 model overview
- Gemma 2 Gemma परिवार का नया हल्का open model है, जो 2B, 9B और 27B parameter sizes प्रदान करता है
- 2B और 9B models को next-token prediction के बजाय knowledge distillation से train किया गया
- एक बड़े language model को teacher model के रूप में इस्तेमाल करके, student model हर token के संभावित next-token distribution को सीखता है
- 2B और 9B को सिद्धांततः compute-optimal token count से 50 गुना से अधिक tokens पर distillation training दी गई
- 27B model को इस काम के लिए शुरुआत से train किया गया
- समान size के open models की तुलना में performance में काफी सुधार हुआ, और कुछ benchmarks तथा human evaluations में यह 2~3 गुना बड़े models से भी प्रतिस्पर्धा करने योग्य परिणाम दिखाता है
- वास्तविक लागू करने से पहले सभी users को deployment या usage context के अनुसार safety testing करनी चाहिए
Model architecture और design choices
- Gemma 2 पिछले Gemma जैसा decoder-only Transformer architecture इस्तेमाल करता है
- common design elements इस प्रकार हैं
- context length: 8192 tokens
- RoPE positional embeddings
- GeGLU nonlinearity
- 256,128 vocabulary वाला SentencePiece tokenizer
- tied embedding का उपयोग
- मुख्य architecture changes attention और normalization पर केंद्रित हैं
- local sliding window attention और global attention को हर layer में बारी-बारी से रखा गया
- local attention की sliding window 4096 tokens है
- global attention span 8192 tokens है
- attention layer और final layer पर logit soft-capping लागू किया गया
- self-attention layer का soft_cap 50.0 है
- final layer का soft_cap 30.0 है
- हर Transformer sub-layer के input और output पर RMSNorm लागू करके pre-norm और post-norm दोनों का उपयोग किया गया
- ablation में Grouped-Query Attention को ऐसा विकल्प पाया गया जो performance बनाए रखते हुए inference speed बढ़ाता है
- local sliding window attention और global attention को हर layer में बारी-बारी से रखा गया
Training data और infrastructure
- pretraining token count model size के अनुसार अलग है
- Gemma 2 27B: 13 trillion tokens
- Gemma 2 9B: 8 trillion tokens
- Gemma 2 2B: 2 trillion tokens
- training data मुख्य रूप से अंग्रेज़ी है और web documents, code, scientific literature आदि विविध sources से बना है
- model multimodal model नहीं है, और अत्याधुनिक multilingual performance के लक्ष्य से अलग से train नहीं किया गया
- data filtering Gemma 1 जैसी पद्धति से लागू की गई
- अनचाही या unsafe utterances में कमी
- विशिष्ट personal information और sensitive data हटाना
- evaluation set contamination हटाना
- sensitive outputs के दोहराव के जोखिम को कम करना
- training infrastructure TPU-based है
- 2B: TPUv5e 512 chips
- 9B: TPUv4 4096 chips
- 27B: TPUv5p 6144 chips
- pretraining के carbon emissions का अनुमान 1247.61 tCO2eq है
- इसकी गणना TPU datacenter के प्रति घंटे energy usage के आधार पर की गई
- Google datacenters की carbon neutrality energy efficiency, renewable energy purchase और carbon offsets के जरिए हासिल की जाती है
Post-training और conversation format
- post-training, pretrained model को instruction-tuned model में fine-tune करने की प्रक्रिया है
- training stages इस प्रकार हैं
- English text-only synthetic और human-generated prompt-response pairs के साथ SFT किया गया
- English preference data पर train किए गए reward model का उपयोग करके RLHF लागू किया गया
- हर stage में मिले models को average करके overall performance सुधारा गया
- data mix और post-training recipe को helpfulness सुधारने, safety सुनिश्चित करने, और hallucination से संबंधित नुकसान कम करने के आधार पर चुना गया
- Gemma 1.1 के बाद के post-training data को internal data और बाहरी public data मिलाकर expand किया गया
- LMSYS-chat-1M में केवल prompt का उपयोग किया गया, answer का नहीं
- synthetic data पर कई filtering stages लागू किए गए
- personal information
- unsafe या toxic model outputs
- गलत self-identification data
- duplicate examples
- Gemma 2, Gemma 1 जैसे ही control tokens इस्तेमाल करता है, लेकिन formatting schema अलग है
- model generation के अंत में
<end_of_turn><eos>tokens स्पष्ट रूप से output करता है - पहले केवल
<eos>generate होता था
- model generation के अंत में
Knowledge distillation और architecture choice experiments
- 2B model को 500B tokens पर train करने वाली तुलना में distillation training ने शुरुआत से train किए गए model से बेहतर performance दिया
- 3 benchmarks average: from scratch 60.3, distilled 67.7
- 500B, 2B model के compute-optimal token count से 10 गुना अधिक है
- 200M, 400M, 1B models की validation perplexity comparison में भी distilled models की perplexity कम रही
- 200M: from scratch 23, distilled 21
- 400M: from scratch 19, distilled 17
- 1B: from scratch 17, distilled 15
- 9B model में GQA और MHA के performance difference छोटे थे, और GQA को इसलिए चुना गया क्योंकि इसमें parameters कम हैं और inference के दौरान यह तेज़ है
- 4 benchmarks average: MHA 50.3, GQA 50.8
- समान 9B parameter count पर wide architecture की तुलना में deep architecture ने थोड़ा बेहतर performance दिखाया
- 4 benchmarks average: Wide 50.8, Deep 52.0
- inference के समय sliding window size को 4096, 2048, 1024 में बदलने पर भी perplexity पर असर सीमित रहा
- 4096: 1.63
- 2048: 1.63
- 1024: 1.64
Automatic benchmark results
- 27B pretrained model की तुलना HuggingFace evaluation में Qwen1.5 32B और LLaMA-3 70B से की गई
- MMLU: Gemma-2 27B 75.2, Qwen1.5 32B 74.3, LLaMA-3 70B 79.2
- GSM8K: Gemma-2 27B 74.0, Qwen1.5 32B 61.1, LLaMA-3 70B 76.9
- ARC-c: Gemma-2 27B 71.4, Qwen1.5 32B 63.6, LLaMA-3 70B 68.8
- HellaSwag: Gemma-2 27B 86.4, Qwen1.5 32B 85.0, LLaMA-3 70B 88.0
- Winogrande: Gemma-2 27B 83.7, Qwen1.5 32B 81.5, LLaMA-3 70B 85.3
- 2B और 9B models में भी पिछले Gemma models की तुलना में बड़ा सुधार है
- 9B model कुछ benchmarks में पिछले version की तुलना में 10% तक बेहतर हुआ
- Gemma 2 2B को Gemma 1 2B जितने लगभग समान tokens पर train किया गया, लेकिन performance बेहतर हुआ
- कई benchmarks का overall average इस प्रकार है
- Gemma 1 2B: 44.2
- Gemma 2 2B: 48.7
- Gemma 1 7B: 57.9
- Gemma 2 9B: 64.9
- Gemma 2 27B: 69.4
Human evaluation और Chatbot Arena
- Gemma 2 instruction-tuned model का evaluation LMSYS Chatbot Arena में blind side-by-side तरीके से किया गया
- Elo scores इस प्रकार हैं
- gemma-2-27b-it: 1218
- gemma-2-9b-it: 1187
- gemma-2-2b-it: 1126
- comparison results model size के मुकाबले competitiveness दिखाते हैं
- gemma-2-27b-it, llama-3-70b-instruct Elo 1206 से ऊपर है
- gemma-2-9b-it, gpt-4-0314 Elo 1186 के समान है
- gemma-2-2b-it, gpt-3.5-turbo-0613 Elo 1116 से ऊपर है
- अलग human preference evaluation में held-out single-turn prompts से safety और instruction following मापी गई
- instruction following: Gemma 1.1 IT 7B 24.3%, Gemma 2 IT 2B 26.5%, 9B 34.1%, 27B 37.7%
- safety: Gemma 1.1 IT 7B 42.8%, Gemma 2 IT 2B 57.5%, 9B 57.8%, 27B 55%
- multi-turn evaluation 500 held-out scenarios और औसतन 8.4 user turns के साथ की गई
- user satisfaction: Gemma 1.1 IT 7B 3.32, Gemma 2 IT 2B 3.64, 9B 4.04, 27B 4.20
- conversation goal achievement: Gemma 1.1 IT 7B 3.36, Gemma 2 IT 2B 3.88, 9B 4.08, 27B 4.24
Memorization और personal information
- बड़े language models कुछ स्थितियों में training data को ज्यों का त्यों output कर सकते हैं, इसलिए Gemma 2 का verbatim और approximate memorization evaluation किया गया
- evaluation 50-token prompt देकर training data के 50-token memorization को मापने के तरीके से किया गया
- exact match criterion
- edit distance 10% इस्तेमाल करने वाला approximate match criterion
- Gemma 2 का overall exact memorization rate 0.1% से कम है
- data sources के हिसाब से code, wiki और scientific sources में अधिक memorization दिखा, लेकिन overall यह Gemma 1 से कम स्तर पर है
- personal information evaluation के लिए Google Cloud Sensitive Data Protection Tool का उपयोग किया गया
- high-severity personal information output के cases नहीं मिले
- low-severity personal information वाले memorized data का ratio 0.00026% मापा गया
- automated tools context को ध्यान में नहीं रखते, इसलिए false positives हो सकते हैं और results overestimated हो सकते हैं
Responsible deployment और safety
- Gemma 2 development में तीन pillars लागू किए गए: training के दौरान safety mitigations, transparent model evaluation, और Responsible Generative AI Toolkit development
- public models AI technology के benefits फैला सकते हैं, लेकिन deepfake images, AI-generated misinformation, illegal या disturbing material generation जैसे misuse risks का भी साथ में evaluation करना होगा
- Gemma के malicious use की reports अभी नहीं मिली हैं, लेकिन relevant reports मिलने पर investigation करने और community के साथ monitoring करने की योजना है
- यह देखते हुए कि बड़े और अधिक शक्तिशाली public models पहले से मौजूद हैं, Gemma 2 का overall risk landscape पर प्रभाव छोटा माना गया
- safety policy Gemini models जैसी दिशा में harmful content generation रोकने के लिए design की गई
- child sexual abuse और exploitation
- नुकसान पहुंचा सकने वाली personal information disclosure
- hate speech और harassment
- dangerous या malicious content
- sexually explicit content
- scientific/medical consensus के खिलाफ medical advice
- instruction-tuned models को SFT और RLHF के जरिए अवांछित behavior से दूर रहने के लिए adjust किया गया
1 टिप्पणियां
Hacker News की राय
27B वर्ज़न बेहद ताकतवर है
LMSys Chatbot Arena में इसे Llama-3-70B से ज़्यादा स्कोर मिला, और यह OpenAI GPT-4 व Claude-3 Sonnet के स्तर पर है
अगर आप Gemma को local पर evaluate करना चाहते हैं, तो ollama और promptfoo से यह काफ़ी आसानी से किया जा सकता है
Gemma में मुझे हमेशा एक छोटी-सी बात पसंद रही है: यह "Sure, I can help you" जैसे शुरुआती वाक्य के बिना सीधे code पर आ जाता है, और बाद में explanation जोड़ता है
ऐसा लगता है कि training का फोकस response structure और समझने में आसानी पर रहा है
साथ ही, public code को बस याद करने पर निर्भर न रहने वाले evaluations चलाना बेहतर है, इसलिए इन्हें अपने personal tests में बदलकर आज़माना अच्छा रहेगा
[0] https://ollama.com/library/gemma2
[1] https://github.com/promptfoo/promptfoo
ज़्यादा hype में बहने से पहले खुद test करने और Chatbot Arena scores के stable होने तक इंतज़ार करने की सलाह दूंगा
मेरे personal evaluation में AI Studio का gemma-2-27b-it, Llama 3 70B से काफ़ी खराब था, खासकर reasoning और basic world understanding वाले सवालों में फर्क बड़ा था
देर से देखा, लेकिन record के लिए छोड़ रहा हूं: Gemma 2 models को Chat Arena performance के हिसाब से reinforcement learning के जरिए tune किया गया लगता है: https://x.com/natolambert/status/1806384821826109597
paper का संबंधित हिस्सा highlight किया गया है
यह जानने की उत्सुकता है कि इसकी सबसे notable strength क्या है
छोटे models benchmark में तो अच्छा करते हैं, लेकिन अक्सर generalization में fail हो जाते हैं; Phi-2 याद आता है
लगता है English के अलावा दूसरी भाषाओं के training data में सुधार का असर है
मुश्किल English prompts में यह Llama-3-70B से 15 ELO कम है, और सामान्य English में 41 ELO कम
बाद वाला अंतर सच में statistically significant है
Gemma team से फिर नमस्कार
यह release लाकर हमें बहुत खुशी है, और अगर कोई सवाल हों तो जवाब दूंगा
राय मेरी निजी है और Google DeepMind का रुख नहीं है
वहीं Google Cloud Vertex कैसे काम करता है और billing कैसे होती है, यह समझना ज्यादा जटिल है; Azure और AWS भी इस use case के लिए लगभग उतने ही जटिल हैं
अच्छा होगा अगर Google Cloud OpenAI-compatible API और service दे सके
मुझे पता है कि department अलग है, लेकिन इससे models का इस्तेमाल काफी आसान हो जाएगा
Google Cloud अक्सर ऐसा लगता है जैसे उसकी UX या end-user testing बिल्कुल नहीं हुई हो
aistudio.google.com पहले से निश्चित रूप से बेहतर हुआ है
27b को www.aistudio,google.com पर आज़माया जा सकता है, इसलिए अपने अक्सर इस्तेमाल होने वाले prompts डालकर देखें; उम्मीद है response पसंद आएगा
सीधे full 8k या 16k पर जाने के बजाय यह तरीका क्यों चुना गया, यह जानना चाहूंगा
जानना चाहूंगा कि यह मूलभूत architectural difference है, training set का फर्क है, या कोई और वजह है
लगता है 2.6B/9B की तुलना Mistral या Llama-3 से नहीं, बल्कि Microsoft के Phi-3 mini 3.8B से की जानी चाहिए
paper के page 7 table 13 और https://arxiv.org/pdf/2404.14219 के page 6 की तुलना करें तो कुल मिलाकर Phi-3 काफी बेहतर दिखता है
हालांकि knowledge distillation training पर report दिलचस्प है
2.6B, Phi-3 से काफी पीछे रहेगा, इसलिए तुलना नहीं है
2.6B और 3.8B को 2.6 बनाम 3.8 के रूप में देखें तो उतना महसूस नहीं होता, लेकिन 2.6 अरब बनाम 3.8 अरब के रूप में देखें तो size difference काफी बड़ा है, इसलिए ऐसा हो सकता है
लेकिन अब Mistral 7B बनाम Llama 8B बनाम Gemma 9B जैसी parameter inflation शुरू होती दिख रही है
जब Llama 3 ने 8B चुना था, तब मुझे चिंता थी कि parameter numbers के साथ खेल करने का trend शुरू हो सकता है, लेकिन मैंने सोचा था कि शायद यह बेकार की चिंता है
सहमत हूं कि Phi-3 family knowledge extraction/summarization में ज्यादा मजबूत competitor है, इसलिए अच्छा comparison target है
limited VRAM वाले workstation पर इस तरह के कामों के लिए अभी मेरा सबसे पसंदीदा model Phi-3 medium, यानी phi3:14b-instruct है
9B और 27B versions Ollama पर उपलब्ध हैं: https://ollama.com/library/gemma2
27B model AI Studio में भी इस्तेमाल किया जा सकता है
https://aistudio.google.com/app/prompts/new_chat?model=gemma...
अभी तक size के हिसाब से काफी strong लगता है
शानदार रिलीज़ है
अगर आप इसे अच्छे interface के साथ local पर आज़माना चाहते हैं, तो जिस app [1] को मैं बना रहा हूँ उसमें अभी-अभी Gemma2 support update डाला है
1: https://msty.app
msty सच में अच्छा दिख रहा है
मैं इसे bookmark कर रहा हूँ ताकि बाद में देख सकूँ कि क्या यह मेरे local hosted LibreChat instance इस्तेमाल करने के तरीके की जगह ले सकता है
बहुत सारे सवालों में remote model की जगह local model इस्तेमाल करना बड़ा improvement होगा
हालांकि मैं जानना चाहूँगा कि msty को open source न रखकर closed source रखने की कोई वजह है क्या
FAQ में "why should I trust msty" पढ़ा, लेकिन वह अपर्याप्त लगा
यह बिल्कुल identity न दिखाने से काफी बेहतर है, लेकिन code पढ़कर trust verify कर पाने से बहुत दूर है
इसे public न करने की वजह सुनना चाहूँगा
फिर भी मैं इसे एक बार आज़माने वाला हूँ
अच्छा दिखता है, लेकिन closed source है इसलिए सावधान हूँ
Arch Linux पर Anthropic API key save करने की कोशिश करने पर भी कुछ नहीं होता, और message आता है: "If you're experiencing problems saving API keys especially on Linux, contact Discord"
अगर यह इतनी common problem है, तो लगता है संभावित solution का link होना चाहिए
सिर्फ test करने के लिए एक और Discord server जोड़ना और ऐसे सवाल का जवाब खोजना जो साफ़ है कि पहले कई बार पूछा जा चुका होगा, काफी बड़ा barrier है
download करके देखा, अच्छा लग रहा है
synced split view पसंद आया
लेकिन landing page पर announce किए गए Gemma 2 या Claude 3.5 Sonnet दिखाई नहीं दे रहे
जानना चाहूँगा कि Windows download के लिए इसे Chocolatey में add करने की कोई plan है क्या
यह बढ़िया दिख रहा है
समझ नहीं आ रहा कि अब तक इससे कैसे चूक गया, और इसे एक बार चलाकर देखने वाला हूँ
knowledge distillation बहुत दिलचस्प है, लेकिन बड़े teacher model से trillions outputs generate करना बेहद महंगा लगता है
सोच रहा हूँ कि वही compute resources सीधे model training में ज़्यादा data या ज़्यादा epochs के लिए इस्तेमाल करने से यह सच में cost-effective है या नहीं
6 महीने पहले तक लगता था कि सब model collapse से डर रहे थे, और अब synthetic training data generation और teacher models trend में हैं
सोच रहा हूँ कि क्या model collapse की problem solve हो गई है
student model sequences generate करता है, और teacher model logits के रूप में feedback देता है
explicit special tokens इस्तेमाल करने का तरीका curious लग रहा है
अगर user अपने message में ऐसे tokens डाल दे तो क्या होता है, और क्या "previous instructions ignore करो" जैसी चीज़ बनाना आसान हो जाता है
क्या model को देने से पहले input को खुद sanitize करना पड़ेगा
अगर आप tokenizer control कर सकते हैं, तो user input से ऐसे tokens आने से रोक सकते हैं
उदाहरण के लिए special token के बजाय उसे "<", "eos", ">" जैसी उस string की natural encoding बना दें
llama3 tokenizer में special token tokenization को control करने का option है: https://github.com/meta-llama/llama3/blob/bf8d18cd087a4a0b3f...
special tokens और user input को combine करके इस्तेमाल करने का तरीका यहाँ देखा जा सकता है: https://github.com/meta-llama/llama3/blob/bf8d18cd087a4a0b3f...
अगर tokenizer control नहीं कर सकते, तो जैसा आपने कहा, शायद input sanitize करना होगा
distillation से train करने पर किसी given performance तक पहुँचने के लिए ज़रूरी iterations की संख्या के हिसाब से यह कितना तेज़ हो जाता है, यह जानना चाहूँगा
यहाँ unsafe से क्या मतलब है, यह जानना चाहूँगा
क्या यह Phi 3 से दोगुने आकार का है और फिर भी काफी ज़्यादा खराब है?
पता नहीं मैं क्या miss कर रहा हूँ
Phi-3 मुख्य रूप से curriculum learning का breakthrough है
training set को high-quality tokens तक filter करके और synthetic data पर train करके अच्छे नतीजे मिले
Gemma-2 distillation का breakthrough है
एक बड़े teacher LLM की guidance में LLM को train करके अच्छे नतीजे मिले
दोनों करने से रोकने वाली कोई वजह नहीं है
उदाहरण के लिए Phi-3-Medium benchmarks में बेहतर होने पर भी LMSYS Chatbot Arena में Llama-3-8b से काफी पीछे रह जाता है
Gemma की performance बल्कि benchmarks में कम दिखती लगती है
27b अभी Chatbot Arena leaderboard में Llama3-70b से आगे है
LMSYS में phi-3 small 1100 ELO के साथ 52वें स्थान पर है, और Gemma 2 9B का confidence interval 1170~1200 ELO है, यानी 15~25वें स्थान के बीच
इसे यहाँ सीधे इस्तेमाल करके उसी तरह compare कर सकते हैं: https://aistudio.google.com/app/prompts/new_chat?model=gemma...
जानना चाहूँगा कि आपने Phi 3 इस्तेमाल किया है या नहीं
यह smart है इसलिए benchmarks में अच्छा score करता है, लेकिन conversation या chatbot के रूप में उतना अच्छा नहीं है
Gemma 2 ज़्यादातर लोगों के लिए बेहतर general-purpose assistant होगा, और Phi 3 summary, RAG, math learning जैसे ज़्यादा specific use cases के लिए एक मजबूत छोटा LLM लगता है