[RFC]: add native float32 support for ML loss functions and activation primitives

Aperta
#16,124 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@AryanSharma48 ci sta già lavorando.

Dal 25/10/2026.

  • #16313 di @AryanSharma48 — aperta
  • #16317 di @AryanSharma48 — aperta
  • #16358 di @Harsh28-raj — aperta
  • #16594 di @devxsubh — aperta

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
12/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c, javascript

Direzione di ricerca

This is a tracking RFC, not a single task, so start by reading the existing float64 loss implementations under ml/base/loss/ and the float32 backlog in #649 to see how a float32 variant is laid out. The blocked activations (math/base/special/siluf, geluf, fast/gelu-tanhf, fast/gelu-quickf) depend on primitives such as erfcf and expitf that do not exist yet. Done means the team has agreed on the scope and each checklist package has its implementation, tests and benchmarks.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Accepted C Feature JavaScript Machine Learning Math RFC
Description

This RFC proposes adding native single-precision (float32) support for the core machine learning loss functions and activation primitives.

Currently, the lack of float32 packages forces the engine to cast Float32Array buffers up to float64 to compute mathematical operations before casting back down. This doubles memory bandwidth usage and hinders SIMD vectorization. These proposed packages rely on standard algebraic arithmetic and can be efficiently implemented via single-precision C kernels without requiring new polynomial derivations.

Core ML Loss Functions (Forward & Gradients)

  • ml/base/loss/float32/epsilon-insensitive
  • ml/base/loss/float32/epsilon-insensitive-gradient #16317
  • ml/base/loss/float32/hinge
  • ml/base/loss/float32/hinge-gradient #16275
  • ml/base/loss/float32/huber
  • ml/base/loss/float32/huber-gradient #16289
  • ml/base/loss/float32/log
  • ml/base/loss/float32/log-gradient
  • ml/base/loss/float32/modified-huber
  • ml/base/loss/float32/modified-huber-gradient #16313
  • ml/base/loss/float32/squared-epsilon-insensitive
  • ml/base/loss/float32/squared-epsilon-insensitive-gradient #16358
  • ml/base/loss/float32/squared-error
  • ml/base/loss/float32/squared-error-gradient #16287
  • ml/base/loss/float32/squared-hinge
  • ml/base/loss/float32/squared-hinge-gradient #16276

ML Activations

  • math/base/special/siluf
  • math/base/special/geluf
  • math/base/special/fast/gelu-tanhf
  • math/base/special/fast/gelu-quickf
Prerequisites

The above ML pipeline relies on the following core single-precision math primitives, which are already being tracked in the #649:

  • math/base/special/erfcf (Required for geluf)
  • math/base/special/expitf (Required for siluf and gelu-tanhf)
  • math/base/special/log1pexpf (Required for log loss functions)
Related Issues

None.

Questions

None.

Other

No.

Checklist
  • I have read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
  • The issue name begins with RFC:.
Lingua principale
JavaScript
Stelle
6k
Fork
1.3k
Merge medio
1g 21h
PR unite (30g)
224

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di stdlib-js/stdlib

Tutte le issue di stdlib-js/stdlib

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.