SelanjutnyaPanduan berikutnya
Dosis dan Farmakokinetik Presisi AI
Teknis
PANDUAN Teknis
Mixed precision uses lower-precision arithmetic for selected operations while retaining precision where needed.
Dengarkan panduan iniDiceritakan oleh AI · ~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.
torch.cuda.amp.autocast PyTorch membungkus loop pelatihan untuk mengurangi separuh memori dan menggandakan throughput pada satu GPU
Melatih model bahasa besar seperti transformator gaya GPT di bfloat16 pada TPU untuk menghindari penyesuaian skala kerugian
Menyesuaikan ukuran batch yang lebih besar pada GPU RTX konsumen dengan mengalihkan pelatihan gambar ResNet dari FP32 ke FP16
FP8 memadukan presisi pada GPU NVIDIA H100 untuk memangkas biaya pra-pelatihan model skala perbatasan
Presisi terus menurun. Pelatihan FP8, yang didukung pada GPU NVIDIA Hopper dan Blackwell, menjadi standar untuk model frontier, dan penelitian terhadap FP4 dan format microscaling (MXFP) semakin berkembang. Harapkan kerangka kerja untuk memilih secara otomatis presisi per lapisan, perangkat keras yang secara alami menangani format yang semakin sempit, dan pelatihan sadar kuantisasi untuk mengaburkan batas antara pelatihan presisi rendah dan inferensi, sehingga mengurangi biaya pelatihan model triliunan parameter.
Buletin gratis
Tiga cerita AI terverifikasi setiap pagi hari kerja, ditulis dalam bahasa Inggris sederhana. Gratis selamanya, tanpa iklan.
Satu email setiap hari kerja. Berhenti berlangganan dalam satu klik. Kami tidak pernah menjual atau membagikan alamat Anda.
Uji diri Anda sendiri
Umpan balik instan untuk setiap jawaban, dan sertifikat yang dapat dibagikan dengan ID yang dapat diverifikasi setelah Anda lulus kursus.
Mendukung pendidikan AI gratis. AI Understanding adalah organisasi nirlaba 501(c)(3) — tanpa iklan, tanpa paywall, selamanya. Berikan sumbangan
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 memiliki rentang dinamis terbatas, sehingga gradien kecil dapat dibulatkan ke nol; mengalikan kerugian sebelum backprop membuat mereka tetap terwakili.
Bfloat16 menyimpan 8 bit eksponen seperti FP32, sehingga rentang dinamisnya besar dan aliran bawah gradien jarang terjadi.
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.
Teruslah belajar
Panduan lainnya dipilih untuk topik ini
SelanjutnyaPanduan berikutnya
Dosis dan Farmakokinetik Presisi AI
Teknis