Tiếp theoHướng dẫn tiếp theo
Định lượng và dược động học chính xác AI
kỹ thuật
HƯỚNG DẪN KỸ THUẬT
Mixed precision uses lower-precision arithmetic for selected operations while retaining precision where needed.
Nghe hướng dẫn nàyAI thuật lại · ~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 của PyTorch gói một vòng đào tạo để giảm gần một nửa bộ nhớ và tăng gấp đôi thông lượng trên một GPU
Đào tạo các mô hình ngôn ngữ lớn như máy biến áp kiểu GPT trong bfloat16 trên TPU để tránh điều chỉnh tỷ lệ mất mát
Điều chỉnh kích thước lô lớn hơn trên GPU RTX dành cho người tiêu dùng bằng cách chuyển đào tạo hình ảnh ResNet từ FP32 sang FP16
Độ chính xác hỗn hợp FP8 trên GPU NVIDIA H100 để cắt giảm chi phí đào tạo trước các mô hình quy mô biên giới
Độ chính xác tiếp tục giảm. Đào tạo FP8, được hỗ trợ trên GPU NVIDIA Hopper và Blackwell, đang trở thành tiêu chuẩn cho các mô hình tiên phong, đồng thời nghiên cứu về FP4 và các định dạng vi mô (MXFP) còn đẩy mạnh hơn nữa. Mong đợi các khung sẽ tự động chọn độ chính xác trên mỗi lớp, phần cứng để xử lý nguyên bản các định dạng ngày càng hẹp hơn và đào tạo nhận thức lượng tử hóa để làm mờ ranh giới giữa đào tạo và suy luận có độ chính xác thấp, giảm chi phí đào tạo các mô hình nghìn tỷ tham số.
Bản tin miễn phí
Ba câu chuyện AI đã được xác minh vào mỗi buổi sáng các ngày trong tuần, được viết bằng tiếng Anh đơn giản. Miễn phí mãi mãi, không có quảng cáo.
Một email mỗi ngày trong tuần. Hủy đăng ký trong một cú nhấp chuột. Chúng tôi không bao giờ bán hoặc chia sẻ địa chỉ của bạn.
Tự kiểm tra
Phản hồi tức thì về mọi câu trả lời và chứng chỉ có thể chia sẻ với ID có thể xác minh sau khi bạn vượt qua khóa học.
Hỗ trợ giáo dục AI miễn phí. AI Understanding là tổ chức phi lợi nhuận 501(c)(3) — không bao giờ có quảng cáo, không có tường phí. Hãy quyên góp
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 có dải động hạn chế nên độ dốc nhỏ có thể làm tròn về 0; nhân số lỗ trước backprop giúp chúng có thể biểu diễn được.
Bfloat16 giữ 8 bit số mũ như FP32 nên dải động của nó lớn và hiếm khi xảy ra hiện tượng tràn gradient.
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.
Tiếp tục học hỏi
Đã chọn thêm hướng dẫn cho chủ đề này
Tiếp theoHướng dẫn tiếp theo
Định lượng và dược động học chính xác AI
kỹ thuật