{"id":44464810,"url":"https://github.com/adrhill/asdex","last_synced_at":"2026-05-26T19:01:09.374Z","repository":{"id":336128258,"uuid":"1148305796","full_name":"adrhill/asdex","owner":"adrhill","description":"Automatic Sparse Differentiation in JAX.","archived":false,"fork":false,"pushed_at":"2026-05-20T15:02:46.000Z","size":2977,"stargazers_count":25,"open_issues_count":14,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-20T15:41:50.635Z","etag":null,"topics":["asd","automatic-differentiation","jacobian","jax","sparsity"],"latest_commit_sha":null,"homepage":"http://adrianhill.de/asdex/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adrhill.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-02T20:14:21.000Z","updated_at":"2026-05-20T14:27:47.000Z","dependencies_parsed_at":"2026-03-02T15:05:02.237Z","dependency_job_id":null,"html_url":"https://github.com/adrhill/asdex","commit_stats":null,"previous_names":["adrhill/detex","adrhill/asdex"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/adrhill/asdex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrhill%2Fasdex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrhill%2Fasdex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrhill%2Fasdex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrhill%2Fasdex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrhill","download_url":"https://codeload.github.com/adrhill/asdex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrhill%2Fasdex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33534563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"ssl_error","status_checked_at":"2026-05-26T15:22:15.568Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asd","automatic-differentiation","jacobian","jax","sparsity"],"created_at":"2026-02-12T19:35:54.746Z","updated_at":"2026-05-26T19:01:09.368Z","avatar_url":"https://github.com/adrhill.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/assets/logo.svg\" alt=\"asdex logo\" width=\"200\"\u003e\n\u003c/p\u003e\n\u003ch1 align=\"center\"\u003easdex\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://iclr-blogposts.github.io/2025/blog/sparse-autodiff/\"\u003eAutomatic Sparse Differentiation\u003c/a\u003e in JAX.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/adrhill/asdex/actions/workflows/ci.yml\"\u003e\u003cimg src=\"https://github.com/adrhill/asdex/actions/workflows/ci.yml/badge.svg\" alt=\"CI\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/adrhill/asdex\"\u003e\u003cimg src=\"https://codecov.io/gh/adrhill/asdex/graph/badge.svg\" alt=\"codecov\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://pypi.org/project/asdex/\"\u003e\u003cimg src=\"https://img.shields.io/pypi/v/asdex\" alt=\"PyPI\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://doi.org/10.5281/zenodo.18788242\"\u003e\u003cimg src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.18788242.svg\" alt=\"DOI\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://adrianhill.de/asdex/\"\u003e\u003cimg src=\"https://img.shields.io/badge/docs-online-blue\" alt=\"Docs\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://adrianhill.de/asdex/dev/bench/\"\u003e\u003cimg src=\"https://img.shields.io/badge/benchmarks-view-blue\" alt=\"Benchmarks\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/adrhill/asdex/blob/main/CHANGELOG.md\"\u003e\u003cimg src=\"https://img.shields.io/badge/news-changelog-yellow\" alt=\"Changelog\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n`asdex` (pronounced _Aztecs_) exploits sparsity structure to efficiently materialize Jacobians and Hessians.\nIt implements a custom [Jaxpr](https://docs.jax.dev/en/latest/jaxpr.html) interpreter\nthat uses [abstract interpretation](https://en.wikipedia.org/wiki/Abstract_interpretation)\nto detect sparsity patterns from the computation graph,\nthen uses graph coloring to minimize the number of AD passes needed.\n\n## Installation\n\n```bash\npip install asdex\n```\n\nOr with [uv](https://docs.astral.sh/uv/):\n\n```bash\nuv add asdex\n```\n\n## Example\n\n```python\nimport asdex\nimport jax\nimport jax.numpy as jnp\n\ndef f(x):\n    return (x[1:] - x[:-1]) ** 2\n\nx_sample = jnp.zeros(50)  # sample input for sparsity pattern detection\njac_fn = jax.jit(asdex.jacobian(f, x_sample))\n# ColoredPattern(49×50, nnz=98, sparsity=96.0%, JVP, 2 colors)\n#   2 JVPs (instead of 49 VJPs or 50 JVPs)\n# ⎡⠙⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⎤   ⎡⣿⎤\n# ⎢⠀⠀⠙⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⎥   ⎢⣿⎥\n# ⎢⠀⠀⠀⠀⠙⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⎥   ⎢⣿⎥\n# ⎢⠀⠀⠀⠀⠀⠀⠙⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⎥   ⎢⣿⎥\n# ⎢⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⎥   ⎢⣿⎥\n# ⎢⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⎥   ⎢⣿⎥\n# ⎢⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⎥ → ⎢⣿⎥\n# ⎢⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⎥   ⎢⣿⎥\n# ⎢⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⠀⠀⠀⠀⠀⠀⎥   ⎢⣿⎥\n# ⎢⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⠀⠀⠀⠀⎥   ⎢⣿⎥\n# ⎢⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⠀⠀⎥   ⎢⣿⎥\n# ⎢⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⎥   ⎢⣿⎥\n# ⎣⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⎦   ⎣⠉⎦\n\nfor x in inputs:\n    J = jac_fn(x)\n```\n\nInstead of 49 VJPs or 50 JVPs,\n`asdex` computes the full sparse Jacobian with just 2 JVPs.\n\n## Documentation\n\n- [Getting Started](https://adrianhill.de/asdex/tutorials/getting-started/): step-by-step tutorial\n- [How-To Guides](https://adrianhill.de/asdex/how-to/jacobians/): task-oriented recipes\n- [Explanation](https://adrianhill.de/asdex/explanation/sparsity-detection/): how and why it works\n- [API Reference](https://adrianhill.de/asdex/reference/): full API documentation\n\n## Acknowledgements\n\nAdrian Hill gratefully acknowledges funding from the German Federal Ministry of Education and Research under the grant BIFOLD26B.\n\nThis package is built with Claude Code based on previous work by [Adrian Hill](https://github.com/adrhill), [Guillaume Dalle](https://github.com/gdalle), and [Alexis Montoison](https://github.com/amontoison) in the [Julia programming language](https://julialang.org):\n\n- [_An Illustrated Guide to Automatic Sparse Differentiation_](https://iclr-blogposts.github.io/2025/blog/sparse-autodiff/), Hill, Dalle, Montoison (2025)\n- [_Sparser, Better, Faster, Stronger: Efficient Automatic Differentiation for Sparse Jacobians and Hessians_](https://openreview.net/forum?id=GtXSN52nIW), Hill \u0026 Dalle (2025)\n- [_Revisiting Sparse Matrix Coloring and Bicoloring_](https://arxiv.org/abs/2505.07308), Montoison, Dalle, Gebremedhin (2025)\n- [_SparseConnectivityTracer.jl_](https://github.com/adrhill/SparseConnectivityTracer.jl), Hill, Dalle\n- [_SparseMatrixColorings.jl_](https://github.com/gdalle/SparseMatrixColorings.jl), Dalle, Montoison\n- [_sparsediffax_](https://github.com/gdalle/sparsediffax), Dalle\n\nThese works in turn stand on the shoulders of giants, notably Andreas Griewank, Andrea Walther, and Assefaw Gebremedhin.\n\nThe asdex logo was designed by [@overripemango](https://instagram.com/overripemango).\n\n## Citation\n\nIf you use asdex in your research, please cite:\n\n```bibtex\n@software{asdex2026,\n  author = {Hill, Adrian},\n  title = {asdex: Automatic Sparse Differentiation in JAX},\n  url = {https://github.com/adrhill/asdex},\n  doi = {10.5281/zenodo.18788242}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrhill%2Fasdex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrhill%2Fasdex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrhill%2Fasdex/lists"}