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, 3:59:04 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
As a researcher in RL & ML in a big industry lab, I would say most of my colleagues are moving to JAX [https://github.com/google/jax], which this article kind of ignores. JAX is XLA-accelerated NumPy, it's cool beyond just machine learning, but only provides low-level linear algebra abstractions. However you can put something like Haiku [https://github.com/deepmind/dm-haiku] or Flax [https://github.com/google/flax] on top of it and get what the cool kids are using :)
In PyTorch vs. TensorFlow in 2022
sillysaurusx·Nov 6, 2021Recommendation phrase
> The downside of Jax is it’s not easy to debug. PyTorch, for better or for worse, will actually run your Python code as you wrote it. Hmm. Jax's ease of debugging was the very first thing that caught my attention: https://blog.gpt4.org/jaxtpu#:~:text=pdb.set_trace() > I ran it on the TPU VM, saw the loss curve go down, and it was like an electric shock. "Wow! That actually... worked? Huh. that's weird. Things never work on the first try. I'm impressed." > Then I plopped `import pdb; pdb.set_trace()` in the middle of the `loss` function and ran it again. It dropped me into the Python debugger. > There was a tensor named `X_bt`. I typed `X_bt`. The debugger printed the value of `X_bt`. > I was able to print out all the values of every variable, just like you'd expect Python to be able to do. > There was a tensor named `Y_bt`. I typed `X_bt
Read the rest
+ Y_bt`. I was now staring at exactly what I expected: the sum of those two tensors. > I could write `x + y`, or create new variables, or anything else I wanted. > Now I was real impressed. > If it sounds weird that I'm so easily impressed, it's because, you godda understand: until now, TPUs were a complete pain in the ass to use. I kept my feelings to myself, because I understood that the Cloud TPU team were working hard to improve TPUs, and the TFRC support team was wonderful, and I had so many TPUs to play with. But holy moly, if you were expecting any of the above examples to just work on the first try when using Tensorflow V1 on TPUs, you were in for a rude awakening. And if you thought "Well, Tensorflow v2 is supposedly a lot better, right? Surely I'll be able to do basic things without worrying...." > ... no. Not even close. Not until Jax + TPU VMs. In the subsequent year, it's been nothing but joy. If the problem is that you want to see tensor values in a JIT'ed function, use a host callback. You can run actual Python wherever you want: https://jax.readthedocs.io/en/latest/jax.experimental.host_c... > This module introduces the host callback functions call(), id_tap(), and id_print(), that send their arguments from the device to the host and invoke user-defined Python functions on the host, optionally returning results back to the device computation. The nice part is, there's no "magic" under the hood. If you get a chance, I highly recommend reading through Autodidax: https://jax.readthedocs.io/en/latest/autodidax.html Autodidax is a pure-python implementation of jax. (Literally in one file, on that page.) It walks you through how every aspect of jax works. Delightfully, I found a secret branch where autodidax also implements host callbacks: https://github.com/google/jax/blob/effect-types/docs/autodid... If you scroll to the very bottom of that file, you'll see an example of compiling your own XLA JIT'ed code which subsequently calls back into Python. TPUs do precisely the same thing. Point being: > PyTorch, for better or for worse, will actually run your Python code as you wrote it. ... is also true of jax, to within a rounding error less than "I personally don't mind writing id_print(x) instead of print(x)." :)
In Show HN: How does JAX allocate memory on a TPU? An interactive C++ walkthrough
note that these are not exclusive. you could divide ML into a traditional statistical approach and a probabilistic one that is concerned with deriving the underlying probability distribution. probabilistic programming is kind of like a domain specific language for achieving this. there is also differential programming that works on the same principle. there are certainly industrial usages of this paradigm. look up pyro (http://pyro.ai/examples/intro_part_i.html) for ppl and jax (https://github.com/google/jax) for differential programming
In An Introduction to Probabilistic Programming
sillysaurusx·Jun 24, 2021Recommendation phrase
The fact that you had to say "chill" three times indicates that you're trying to convince yourself, not me. None of what you said is responsive to what I wrote. I think it's an opinion piece, but I'm not sure. The issue here is the scientific method. I've listed the things that are required, as I see it. And I've also listed the reasons why I haven't been able to verify it exists here, despite trying for two years. I'm glad that you like ML hacking, and I like it too. But models aren't a godsend; they're "the most basic, bare-minimum requirements of reproducibility." Your reaction shouldn't be "I'm incredibly grateful you'd be willing to do this." It should be "You're required to do this, because if I can't verify your claims, your claims might be mistaken." To leave it off on a softer note, normally I'd bond with you, ML hacker to ML hac
Read the rest
ker. Because I love ML, and I love hearing what you've been up to in ML. It's the best job in the world, as far as I'm concerned. (Could any other career give you the opportunity to be a developer advocate for high-performance computing in such an interesting way? https://github.com/google/jax/issues/2108#issuecomment-86623... Definitely looking for more examples of "Github Larping," if you know of any.) If you agree that the scientific method is the reason ML moves forward, all I'm doing here is protecting it.
In Alias-Free GAN
(Submitter here.) Thank you for writing up such an accurate analysis. You’re correct on all counts, as far as I can tell. Unfortunately, I ran into a very strange situation with HN, and due to a Series of Unfortunate Events, your insightful comment here won’t ever be seen. However! https://news.ycombinator.com/item?id=27602110 has a chance of being seen. (I resubmitted with the correct url, or at least the most approximately-correct url that can be submitted to HN.) In fact, I’m pretty sure the new submission won’t get any traction either. So how about this: you seem like a capable XLA TPU hacker. I’d like to pretend I submitted https://github.com/google/jax/issues/2108#issuecomment-86623... solely for an audience of you. What do you think of it? Critical feedback welcome — it’s important to me that this suffices as a decent on boarding e
Read the rest
xperience for people interested in Jax + TPUs, but no idea where to start. > I expect that as more people see it's easier to program a simple layer on top of TFRC and XLA, tensorflow will not be as popular. I absolutely agree. My hypothesis is that Jax is such a “simple layer,” which is why I wanted to write something to persuade others it is. So I am especially interested in whether my post persuades you.
In How to Tame Your Jax: Navigating TPU VMs with TFRC in 2021
(Previous attempt: https://news.ycombinator.com/edit?id=27602092) Hiya! Author here. Sorry for submitting my announcement tweet. I think that’s lame; just submit the story, which in this case is https://github.com/google/jax/issues/2108#issuecomment-86623.... But I couldn’t figure out any possible way to submit that url to HN without doing this (see two failed previous attempts) since HN strips the crucial url anchor. Anyway! Enjoy the show, whoever happens to read it. (Is this the first instance of “GitHub larping”? I dunno, but it was weirdly interesting to try to blend fantasy novel elements into a TPU tutorial. If this is a thing, I definitely want to read other instances of it.) By the way, the first submission had an insightful reply about XLA, which was surprising: https://news.ycombinator.com/item?id=27596731
In How to Tame Your Jax: Navigating TPU VMs with TFRC in 2021
(Previous attempt: https://news.ycombinator.com/item?id=27601986) Oh. Right. Umm, so the goal here is for me to submit https://github.com/google/jax/issues/2108#issuecomment-86623... to HN. But there is no possible way to submit that url to HN, because HN strips the anchor. Without that anchor, readers arrive at some ancient boring crap that no one cares about. (Well, TPU nerds might care about the Jax history… but do the set of all coding historians intersect with the set of all TPU nerds?) I was going to submit it, then edit the url to include the hashtag. But I forgot that I can’t edit urls on HN, so there’s literally no way to submit a GitHub issue reply as a submission. The reason I’m trying to submit it, is because it seems intellectually interesting enough. So I wonder if HN has made an executive decision that “it’s fundamentally i
Read the rest
mpossible to write something HN worthy as a GitHub issue reply.” Interesting… I suppose my fallback plan is to submit my tweet announcing this post? https://twitter.com/theshawwn/status/1407412385074270217?s=2... That way readers end up on the tweet, click through to the url, and then wind up at the correct spot. Then I suppose an HN mod might notice, and edit the submitted url to https://github.com/google/jax/issues/2108#issuecomment-86623... Okay, I’ll try that. If an HN mod happens to read this, pls no hurt me for spamming HN; I’m not actually trying to. What’s happening here is that I’m trying to work around a very strange corner case in the HN software, where GitHub issue anchor links are stripped. It’s going to look like I’m spamming though, since this is broken url submission #2. I suppose I could just delete this submission and submit the tweet, but.. maybe there’s value in attracting attention to this? I don’t know. I would email it, but I haven’t emailed HN in years. Meh. Onward to attempt #3: https://news.ycombinator.com/item?id=27602110
In How to Tame Your Jax: Navigating TPU VMs with TFRC in 2021
Oh. I see what happened here. No wonder nobody noticed this… I submitted it and it fell flat like a pancake, because either I screwed up the URL or HN has a rule to automatically remove hashtag anchors. The goal is to submit to HN one of the replies in that thread, not the main page: https://github.com/google/jax/issues/2108#issuecomment-86623... Without that anchor, I see no possible way to submit it to HN, because the anchor is vital. I swear I submitted it correctly, but maybe I derped. Hmm. I should try to submit it again, then if the anchor vanishes, click edit and add the anchor… I bet that would bypass the rule. But, shall I now, or wait until morning? Pfft, I’ll do it now. I always believed the “when should I submit to HN?” analysis posts were dumb. Maybe it matters, but who cares. EDIT: I tried again here, which also failed. http
Read the rest
In How to Tame Your Jax: Navigating TPU VMs with TFRC in 2021
It seems to break down a bunch in real use cases though. For example, we found a differential equation benchmarks the Jax devs were optimizing, where it was still 6x slower than Julia (https://gist.github.com/ChrisRackauckas/62a063f23cccf3a55a4a...). Then the gradient calculations don't mix well with GPUs, at least for ODEs (https://github.com/google/jax/issues/5006). That lack of composability compared to Julia is the main issue that then creeps up in the bigger problems.
In Julia: Faster than Fortran, cleaner than Numpy

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.