RFE: Add support for more floating point low-precision ML data types (`bfloat16`, `fp8`, `nvfp4`)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 15/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- machine-learning
- Lĩnh vực
- ai
Hướng nghiên cứu
The payload names no source files. The spec-level entry point is the MLOperandDataType enum and the buffer compatibility tables that the issue says must be extended. Read the existing comment thread first, since 17 comments with no decision suggests unresolved questions about E4M3 versus E5M2 and the 4-bit block-scaled design. Done would mean a settled proposal for the new types and their backend support, not a patch.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem Statement
Currently, the WebNN API supports standard data types like float32, float16, int8, and uint8. However, the machine learning hardware ecosystem has rapidly migrated toward specialized, low-precision floating-point formats to handle the extreme memory bandwidth and compute demands of modern Large Language Models (LLMs) and diffusion models.
Developers bringing state-of-the-art models to the web are currently forced into a strict dilemma:
- Upcast to keep precision: Converting native
bfloat16orfp8models tofloat32respectivefloat16preserves the model's accuracy and dynamic range, but immediately bloats the memory footprint and exacerbates memory bandwidth bottlenecks, which can be fatal for client-side inference. - Quantize to integer to save memory: Converting to
int8orint4achieves the desired performance and footprint, but sacrifices precision. Integers space values uniformly, which crushes the activation outliers prevalent in LLMs, leading to a degradation in reasoning quality and perplexity.
Without native WebNN support for modern low-precision floating-point formats, the API forces developers to choose between performance and accuracy, losing out on the hardware-accelerated "best of both worlds" that these new formats were designed to provide.
The Case for Each Format
-
bfloat16(Brain Floating Point)- Context: Widely used as the default format for training modern AI models because its 8-bit exponent matches
float32, preventing gradient underflow/overflow. - Issue: Porting a natively
bfloat16-trained model to WebNN currently requires an offline conversion tofloat32(doubling the model size) orfloat16(which requires careful scaling to avoid out-of-bounds errors).
- Context: Widely used as the default format for training modern AI models because its 8-bit exponent matches
-
fp8(OCP 8-bit Floating Point - E4M3 & E5M2)- Context: Now standardized by the Open Compute Project and natively supported by current-gen hardware (NVIDIA Hopper/Blackwell, Ryzen AI, RDNA4, Intel XE2 (Lunar Lake, ARC B-series)).
- Issue:
fp8acts as the perfect middle ground between the two extremes mentioned above. It provides the memory footprint ofint8while maintaining the dynamic range of a floating-point exponent, allowing it to handle activation outliers without precision loss.
-
nvfp4(4-bit Microscaled Floating Point)- Context: Introduced with NVIDIA's Blackwell architecture, this format represents the bleeding edge of sub-byte quantization. It utilizes a two-level microscaling block approach (sharing an FP8 scale across 16 values) to drastically reduce quantization error compared to pure integer 4-bit.
- Issue: Allowing hardware-accelerated 4-bit floating-point inference in the browser would be a massive leap for client-side LLM execution, cutting memory usage by ~3.5x compared to FP16 while maintaining near-baseline accuracy.
Proposed Solution
Update the MLOperandDataType enum and underlying buffer compatibility tables to include:
bfloat16fp8(potentially differentiating between E4M3 and E5M2 variants)nvfp4(or a generic hardware-agnostic equivalent for 4-bit block-scaled floating point)
Use Cases & Benefits
- Quicker Model Porting: Developers can load original weights directly into the graph without complex offline upcasting/re-quantization pipelines.
- Higher Quantization Accuracy: Floating-point quantization (
fp8,nvfp4) retains the dynamic range of activations much better than standard integer quantization, reducing perplexity degradation. - Reduced Memory Pressure: Keeping tensors in their ultra-low precision formats slashes both memory footprint and memory bandwidth bottlenecks during inference on edge devices.
- Ngôn ngữ chính
- Bikeshed
- Star
- 566
- Fork
- 72
- Merge trung bình
- 6 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của webmachinelearning/webnn
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
webmachinelearning/webnn#967 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
webmachinelearning/webnn#966 · 1 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
webmachinelearning/webnn#965 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
webmachinelearning/webnn#964 · 1 bình luận · 1 reaction ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
webmachinelearning/webnn#963 · 2 bình luận · 1 reaction ·
Tất cả issue của webmachinelearning/webnn
Issue tương tự
-
Devstral and Voxtral: section 5 fails in us-east-1 with 400 "Model does not support audio modality"Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
aws-samples/sample-per-model-bedrock#409 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
reproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
anomalyco/opencode#57711 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] Unit tests reach real Bedrock call paths without patching the modelCó thể đã có người làm @proton0210 đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
aws-samples/sample-aws-genai-db-modernizer#1318 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
skillopt: success-reflect prompt omits the edit schema, so every success-only edit is droppedĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
morluto/rea#5840 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày