HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
jax-ml
jax
Python2018–2026
jax-ml / jax

jax

Composable transformations of Python+NumPy programs: differentiate, vectorize, JIT to GPU/TPU, and more

61Distinct people
82Mentions
3Explicit recommenders
36.6KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Composable transformations of Python+NumPy programs: differentiate, vectorize, JIT to GPU/TPU, and more

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

> I love their JAX For those out of loop: https://github.com/google/jax See also: https://news.ycombinator.com/item?id=29682507

ignoramous used a recommendation phrase. 4 indexed comments match. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 9–Nov 16 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/16/2026, 4:43:50 AM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year82 dated mentions

Observed mentions: 2018-11-21 07:26:40 UTC to 2026-04-05 21:15:24 UTC.

0510152018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 4 mentions; 2 submissions, 2 comments20182019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 14 mentions; 1 submissions, 13 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 8 mentions; 1 submissions, 7 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 17 mentions; 4 submissions, 13 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 9 mentions; 1 submissions, 8 comments20222023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 17 mentions; 0 submissions, 17 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 7 mentions; 1 submissions, 6 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC422
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC14113
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC817
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC17413
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC918
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC17017
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC505
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC716
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC110

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
Transformable numerical computing at scale Transformations | Scaling | Install guide | Change logs | Reference docs What is JAX? JAX is a Python library for accelerator-oriented array computation and program transformation, designed for high-performance numerical computing and large-scale machine learning. JAX can automatically differentiate native Python and NumPy functions. It can differentiate through loops, branches, recursion, and closures, and it can take derivatives of derivatives of derivatives. It supports reverse-mode differentiation (a.k.a. backpropagation) via jax.grad as well as forward-mode differentiation, and the two can be composed arbitrarily to any order. JAX uses XLA to compile and scale your NumPy programs on TPUs, GPUs, and other hardware accelerators. You can compile your own pure functions with jax.jit. Compilation and automatic differentiation can be composed arbitrarily. Dig a little deeper, and you'll see that JAX is really an extensible system for composable function transformations at scale. This is a research project, not an official Google product. Expect sharp edges. Please help by trying it out, reporting bugs, and letting us know what you think! import jax import jax.numpy as jnp def predict(params, inputs): for W, b in params: outputs = jnp.dot(inputs, W) + b inputs = jnp.tanh(outputs) # inputs to the next layer return outputs # no activation on last layer def loss(params, inputs, targets): preds = predict(params, inputs) return jnp.sum((preds - targets)**2) grad_loss = jax.jit(jax.grad(loss)) # compiled gradient evaluation function perex_grads = jax.jit(jax.vmap(grad_loss, in_axes=(None, 0, 0))) # fast per-example grads Contents Transformations Scaling Current gotchas Installation Citing JAX Reference documentation Transformations At its core, JAX is an extensible system for transforming numerical functions. Here are three: jax.grad, jax.jit, and jax.vmap. Automatic differentiation with grad Use jax.grad to efficiently compute reverse-mode gradients: import jax import jax.numpy as jnp def tanh(x): y = jnp.exp(-2.0 * x) return (1.0 - y) / (1.0 + y) grad_tanh = jax.grad(tanh) print(grad_tanh(1.0)) # prints 0.4199743 You can differentiate to any order with grad: print(jax.grad(jax.grad(jax.grad(tanh)))(1.0)) # prints 0.62162673 You're free to use differentiation with Python control flow: def abs_val(x): if x > 0: return x else: return -x abs_val_grad = jax.grad(abs_val) print(abs_val_grad(1.0)) # prints 1.0 print(abs_val_grad(-1.0)) # prints -1.0 (abs_val is re-evaluated) See the JAX Autodiff Cookbook and the reference docs on automatic differentiation for more. Compilation with jit Use XLA to compile your functions end-to-end with jit, used either as an @jit decorator or as a higher-order function. import jax import jax.numpy as jnp def slow_f(x): # Element-wise ops see a large benefit from fusion return x * x + x * 2.0 x = jnp.ones((5000, 5000)) fast_f = jax.jit(slow_f) %timeit -n10 -r3 fast_f(x) %timeit -n10 -r3 slow_f(x) Using jax.jit constrains the kind of Python control flow the function can use; see the tutorial on Control Flow and Logical Operators with JIT for more. Auto-vectorization with vmap vmap maps a function along array axes. But instead of just looping over function applications, it pushes the loop down onto the function’s primitive operations, e.g. turning matrix-vector multiplies into matrix-matrix multiplies for better performance. Using vmap can save you from having to carry around batch dimensions in your code: import jax import jax.numpy as jnp def l1_distance(x, y): assert x.ndim == y.ndim == 1 # only works on 1D inputs return jnp.sum(jnp.abs(x - y)) def pairwise_distances(dist1D, xs): return jax.vmap(jax.vmap(dist1D, (0, None)), (None, 0))(xs, xs) xs = jax.random.normal(jax.random.key(0), (100, 3)) dists = pairwise_distances(l1_distance, xs) dists.shape # (100, 100) By composing jax.vmap with jax.grad and jax.jit, we can get efficient Jacobian matrices, or per-example gradients: per_example_grads = jax.jit(jax.vmap(jax.grad(loss), in_axes=(None, 0, 0))) Scaling To scale your computations across thousands of devices, you can use any composition of these: Compiler-based automatic parallelization where you program as if using a single global machine, and the compiler chooses how to shard data and partition computation (with some user-provided constraints); Explicit sharding and automatic partitioning where you still have a global view but data shardings are explicit in JAX types, inspectable using jax.typeof; Manual per-device programming where you have a per-device view of data and computation, and can communicate with explicit collectives. Mode View? Explicit sharding? Explicit Collectives? Auto Global ❌ ❌ Explicit Global ✅ ❌ Manual Per-device ✅ ✅ from jax.sharding import set_mesh, AxisType, PartitionSpec as P mesh = jax.make_mesh((8,), ('data',), axis_types=(AxisType.Explicit,)) set_mesh(mesh) # parameters are sharded for FSDP: for W, b in params: print(f'{jax.typeof(W)}') # f32[512@data,512] print(f'{jax.typeof(b)}') # f32[512] # shard data for batch parallelism: inputs, targets = jax.device_put((inputs, targets), P('data')) # evaluate gradients, automatically parallelized! gradfun = jax.jit(jax.grad(loss)) param_grads = gradfun(params, (inputs, targets)) See the tutorial and advanced guides for more. Gotchas and sharp bits See the Gotchas Notebook. Installation Supported platforms Linux x86_64 Linux aarch64 Mac aarch64 Windows x86_64 Windows WSL2 x86_64 CPU yes yes yes yes yes NVIDIA GPU yes yes n/a no experimental Google TPU yes n/a n/a n/a n/a AMD GPU yes no n/a no experimental Apple GPU n/a no experimental n/a n/a Intel GPU experimental n/a n/a no no Instructions Platform Instructions CPU pip install -U jax NVIDIA GPU pip install -U "jax[cuda13]" Google TPU pip install -U "jax[tpu]" AMD GP
Read the full README on GitHub

What Hacker News says

17 sources
I'm still not totally sure what the issue is. Jax uses program transformations to compile programs to run on a variety of hardware, for example, using XLA for TPUs. It can also run cuda ops for Nvidia gpus without issue: https://jax.readthedocs.io/en/latest/installation.html There is also support for custom cpp and cuda ops if that's what is needed: https://jax.readthedocs.io/en/latest/Custom_Operation_for_GP... I haven't worked with float4, but can imagine that new numerical types would require some special handling. But I assume that's the case for any ml environment. But really you probably mean fixed point 4bit integer types? Looks like that has had at least some work done in Jax: https://github.com/google/jax/issues/8566
In MLPerf training tests put Nvidia ahead, Intel close, and Google well behind
> Python/Numpy: 5360ms (Xeon(R) CPU E5-2698 v4 @ 2.20GHz) CuPy: 10.6ms (A100) MatX: 2.54ms (A100) > Are they even comparing apples to apples to claim that they see these improvements over NumPy? > While the code complexity and length are roughly the same, the MatX version shows a 2100x over the Numpy version, and over 4x faster than the CuPy version on the same GPU. NumPy doesn't use GPU by default unless you use something like Jax [1] to compile NumPy code to run on GPUs. I think more honest comparison will mainly compare MatX running on same CPU like NumPy and for GPU comparison focus to compare vs CuPy. [1] https://github.com/google/jax
In MatX: Efficient C++17 GPU numerical computing library with Python-like syntax
Actually that never changed. The README has always had an example of differentiating through native Python control flow: https://github.com/google/jax/commit/948a8db0adf233f333f3e5f... The constraints on control flow expressions come from jax.jit (because Python control flow can't be staged out) and jax.vmap (because we can't take multiple branches of Python control flow, which we might need to do for different batch elements). But autodiff of Python-native control flow works fine!
In JAX – NumPy on the CPU, GPU, and TPU
One great way to learn about FP is to read the documentation for Ramda.js [0] and tinker with their playground. For even more ideas check out Ramda-adjunct [1] and Fantasyland [2]. [0] - https://ramdajs.com/docs/ [1] https://char0n.github.io/ramda-adjunct/4.0.0/index.html [2] https://github.com/fantasyland/fantasy-land (A bit heavy on jargon) Note there is a python version of Ramda available on pypi and there’s a lot of FP tidbits inside JAX: 3. https://pypi.org/project/ramda/ (Worth making your own version if you want to learn, though) 4. For nested data, JAX tree_util is epic: https://jax.readthedocs.io/en/latest/jax.tree_util.html and also their curry implementation is funny: https://github.com/google/jax/blob/4ac2bdc2b1d71ec0010412a32... Anyway don’t put FP on a pedestal, main thing is to focus on the core principles of avoiding exte
Read the rest
rnal mutation and making helper functions. Doesn’t always work because some languages like Rust don’t have legit support for currying (afaik in 2023 August), but in those cases you can hack it with builder methods to an extent. Finally, if you want to understand the middle of the midwit meme, check out this wiki article and connect the free monoid to the Kleene star (0 or more copies of your pattern) and Kleene plus (1 or more copies of your pattern). Those are also in regex so it can help you remember the regex symbols. https://en.wikipedia.org/wiki/Free_monoid?wprov=sfti1 The simplest example might be {0}^* in which case we find: “”, “0”, “00”, “000” … a language with only one letter in the alphabet could still make all the natural numbers like that. With Boolean alphabet (two variant enum) we have {0,1}^+ which omits the empty monoid by using the + operator: “0”, “1”, “00”, “01”, … note this sequence will eventually yield every possible Turing tape, which is the same thing as listing every possible series of coin flip results assuming no coins land on their side (Turing’s undecidability paradox might be bullshit, but that’s another story) I meekly suggest, FP can save you days of headache if the only thing you do is clone your data and mutate the clone. Yes, that’s inefficient, so is dealing with infinite bugs due to state mutation in multiple places. Also, you can look into HAMTs / immutable / persistent data structures to juggle the pointers and copy-on-write on the storage data structure if you find yourself repeatedly cloning data then it would accelerate your stuff. Options include: Python: Immutables https://pypi.org/project/immutables/ Rust: RPDS https://docs.rs/rpds/latest/rpds/ and Im https://docs.rs/im/latest/im/ Rust isn’t great for letting you do FP things like other languages, but it does have the best type system imho which makes it the leading functional programming language right now imho. If you’re not using too many specialized python packages then I recommend using Rust instead, even for toy demos, as you can be more confident your code works without needing to run it and wait for a crash like you would in debugging python, and the tests also run faster in rust due to the incremental compilation. Use cargo-watch and you can retest your code every time you save your work. https://github.com/watchexec/cargo-watch I usually write a make command to cargo watch and rerun each test file : code file pair independently so then you won’t rerun your tests in other modules when you change the one you work on (faster but might miss stuff if you change API contracts which touch other parts of your codebase)
In Functional Programming 1
What you are saying is fascinating. Unfortunately, my google powers are limited today. All I can see about program transformations in Jax is [1], and it appears to me there are 4, grad, jit, vmap and pmap. It seems to me you are implying that there are ways to create custom transformations, and this has actual use cases. Would you mind giving some more details? Or maybe some links? I can't help but be excited by your enthusiasm, it feels like Jax could be the ultimate programming language. [1] https://github.com/google/jax#transformations
In Training Deep Networks with Data Parallelism in Jax
Thanks for taking the time to explain these. > It's been a bit, but I think the most frustrating errors were around mapping pytrees (like this issue https://github.com/google/jax/issues/9928). We've improved some of these pytree error messages but it seems that vmap one is still not great. Thanks for the ping on it. > Also the barriers where I couldn't disable jit. IIRC pmap automatically jits, so there was no way to avoid staging that part out. That was indeed a longstanding issue in pmap's implementation. And since people came to expect jit to be "built in" to pmap, it wasn't easy to revise. However, we recently (https://github.com/google/jax/pull/11854) made `jax.disable_jit()` work with pmap, in the sense that it makes pmap execute eagerly, so that you can print/pdb/etc to your heart's content. (The pmap successor, shard_map (https://
Read the rest
jax.readthedocs.io/en/latest/jep/14273-shard-map.htm...), is eager by default. Also it has uniformly good error messages from the start!) > Next time I encounter something particularly opaque, I'll share on the github issue tracker. Thank you for the constructive feedback!
In Training Deep Networks with Data Parallelism in Jax
> with jax.disable_jit(): ... That's handy, and I hadn't seen it before, thanks. It's been a bit, but I think the most frustrating errors were around mapping pytrees (like this issue https://github.com/google/jax/issues/9928). I'm not sure the exact solution, but the axis juggling and specifications were where I remember a lot of pain, and the docs (though extensive) were unclear. At times it feels like improvements are punted on in the hopes that xmap eventually fixes everything (and xmap has been in experimental for far longer than I expected). Also the barriers where I couldn't disable jit. IIRC pmap automatically jits, so there was no way to avoid staging that part out. When it came to doing some complex jax.lax.ppermute, it felt more difficult than it needed to be to debug. Next time I encounter something particularly opaque, I'll sh
Read the rest
are on the github issue tracker.
In Training Deep Networks with Data Parallelism in Jax
If you have any particular examples in mind, and time to share them on https://github.com/google/jax/issues, we'd love to try to improve them. Improving error messages is a priority. About introspection tools, at least for runtime value debugging there is to some extent a fundamental challenge: since jax.jit stages computation out of Python (though jax.grad and jax.vmap don't), it means standard Python runtime value inspection tools, like printing and pdb, can't work under a jax.jit as the values aren't available as the Python code is executing. You can always remove the jax.jit while debugging (or use `with jax.disable_jit(): ...`), but that's not always convenient, and we need jax.jit for good performance. We recently added some runtime value debugging tools which work even with jax.jit-staged-out code (even in automatically parallelize
Read the rest
d code!), though they're not the standard introspection tools: see `jax.debug.print` and `jax.debug.breakpoint` on https://jax.readthedocs.io/en/latest/debugging/index.html and https://jax.readthedocs.io/en/latest/debugging/print_breakpo.... If you were thinking about other kinds of introspection tooling, I'd love to hear about it!
In Training Deep Networks with Data Parallelism in Jax

Showing the 15 most recent of 17 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.