आगेअगली गाइड
एआई प्रिसिजन खुराक और फार्माकोकाइनेटिक्स
तकनीकी
तकनीकी गाइड
Mixed precision uses lower-precision arithmetic for selected operations while retaining precision where needed.
इस गाइड को सुनेंएआई-नैरेटेड · ~2 min
It can reduce memory use and improve throughput on supported hardware, but gains and numerical effects depend on the model, workload, hardware and training recipe.
Traditional training stores weights and runs math in 32-bit floating point (FP32). Mixed precision uses lower-precision FP16 or bfloat16 for eligible operations while retaining FP32 where needed. Some FP16 recipes maintain a separate FP32 master copy to accumulate small weight updates; autocast workflows may instead keep model parameters in FP32 while casting selected operation inputs. Using 16-bit tensors can reduce memory used by eligible operations. Supported accelerators may execute some low-precision operations faster, but end-to-end throughput depends on hardware, workload and which operations autocast selects. FP16 has a narrower range, so tiny gradients can underflow. Loss scaling multiplies the loss before backpropagation and reverses that scale before the optimizer update; tools such as torch.amp.GradScaler can manage this process. Bfloat16 has a wider exponent range than FP16 and often does not need the same loss-scaling strategy, though model and hardware behavior still need testing.
PyTorch का torch.cuda.amp.autocast एक प्रशिक्षण लूप को लपेटकर मेमोरी को लगभग आधा कर देता है और एक ही GPU पर थ्रूपुट को दोगुना कर देता है
हानि-स्केलिंग ट्यूनिंग से बचने के लिए TPU पर bfloat16 में GPT-शैली ट्रांसफार्मर जैसे बड़े भाषा मॉडल का प्रशिक्षण
ResNet छवि प्रशिक्षण को FP32 से FP16 पर स्विच करके उपभोक्ता RTX GPU पर एक बड़ा बैच आकार फ़िट करना
प्रीट्रेनिंग फ्रंटियर-स्केल मॉडल की लागत में कटौती करने के लिए NVIDIA H100 GPU पर FP8 मिश्रित परिशुद्धता
परिशुद्धता गिरती रहती है। एनवीआईडीआईए हॉपर और ब्लैकवेल जीपीयू पर समर्थित एफपी8 प्रशिक्षण, फ्रंटियर मॉडल के लिए मानक बन रहा है, और एफपी4 और माइक्रोस्केलिंग प्रारूप (एमएक्सएफपी) में अनुसंधान आगे बढ़ रहा है। प्रति-परत परिशुद्धता को स्वचालित रूप से चुनने के लिए फ्रेमवर्क की अपेक्षा करें, मूल रूप से संकीर्ण प्रारूपों को संभालने के लिए हार्डवेयर, और कम-परिशुद्धता प्रशिक्षण और अनुमान के बीच की रेखा को धुंधला करने के लिए परिमाणीकरण-जागरूक प्रशिक्षण, ट्रिलियन-पैरामीटर मॉडल के प्रशिक्षण की लागत को कम कर देता है।
मुफ़्त न्यूज़लेटर
हर कार्यदिवस की सुबह तीन सत्यापित एआई कहानियाँ, सादे अंग्रेजी में लिखी गईं। हमेशा के लिए मुफ़्त, कोई विज्ञापन नहीं।
प्रत्येक सप्ताह के दिन एक ईमेल. एक क्लिक में सदस्यता समाप्त करें. हम आपका पता कभी नहीं बेचते या साझा नहीं करते।
स्वयं की जांच करो
प्रत्येक उत्तर पर त्वरित प्रतिक्रिया, और पाठ्यक्रम पास करने के बाद एक सत्यापन योग्य आईडी के साथ एक साझा करने योग्य प्रमाणपत्र।
निःशुल्क एआई शिक्षा का समर्थन करें। AI Understanding एक 501(c)(3) गैर-लाभकारी संस्था है - कोई विज्ञापन नहीं, कोई पेवॉल नहीं। दान करें
Mixed precision uses lower-precision arithmetic for selected operations while retaining precision where needed. It can reduce memory use and improve throughput on supported hardware, but gains and numerical effects depend on the model, workload, hardware and training recipe.
Some FP16 recipes keep an FP32 master weight so small optimizer updates are not lost to low-precision rounding; not every mixed-precision recipe uses a separate copy.
FP16 में एक सीमित गतिशील रेंज है, इसलिए छोटे ग्रेडिएंट शून्य तक घूम सकते हैं; बैकप्रॉप से पहले नुकसान को गुणा करना उन्हें प्रतिनिधित्व योग्य बनाए रखता है।
Bfloat16 FP32 की तरह 8 एक्सपोनेंट बिट्स रखता है, इसलिए इसकी डायनेमिक रेंज बड़ी है और ग्रेडिएंट अंडरफ्लो दुर्लभ है।
Many common Tensor Core operations accumulate in FP32 to reduce rounding error; this does not make the computation exact.
Lower precision can reduce memory and speed supported operations, but total results depend on the model, hardware, and kernels used.
सीखते रहो
इस विषय के लिए अधिक मार्गदर्शिकाएँ चुनी गईं
आगेअगली गाइड
एआई प्रिसिजन खुराक और फार्माकोकाइनेटिक्स
तकनीकी