{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/equinox-neural-networks-in-jax-via-callable","title":"Equinox: neural networks in JAX via callable PyTrees and filtered transformations","arxiv_id":"2111.00254","date":"2021-10-30","proceeding":null,"authors":["Patrick Kidger","Cristian Garcia"],"abstract":"JAX and PyTorch are two popular Python autodifferentiation frameworks. JAX is based around pure functions and functional programming. PyTorch has popularised the use of an object-oriented (OO) class-based syntax for defining parameterised functions, such as neural networks. That this seems like a fundamental difference means current libraries for building parameterised functions in JAX have either rejected the OO approach entirely (Stax) or have introduced OO-to-functional transformations, multiple new abstractions, and been limited in the extent to which they integrate with JAX (Flax, Haiku, Objax). Either way this OO/functional difference has been a source of tension. Here, we introduce `Equinox', a small neural network library showing how a PyTorch-like class-based approach may be admitted without sacrificing JAX-like functional programming. We provide two main ideas. One: parameterised functions are themselves represented as `PyTrees', which means that the parameterisation of a function is transparent to the JAX framework. Two: we filter a PyTree to isolate just those components that should be treated when transforming (`jit', `grad' or `vmap'-ing) a higher-order function of a parameterised function -- such as a loss function applied to a model. Overall Equinox resolves the above tension without introducing any new programmatic abstractions: only PyTrees and transformations, just as with regular JAX. Equinox is available at \\url{https://github.com/patrick-kidger/equinox}.","url_abs":"https://arxiv.org/abs/2111.00254v1","url_pdf":"https://arxiv.org/pdf/2111.00254v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"equinox-neural-networks-in-jax-via-callable","repo_url":"https://github.com/patrick-kidger/equinox","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"jax","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"equinox-neural-networks-in-jax-via-callable","repo_url":"https://github.com/homerjed/sbiax","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"jax","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2111.00254","atlas_url":"https://app.syntology.ai/?focus=2111.00254","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2111.00254"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"deterministic:regex_extraction","url":"https://github.com/patrick-kidger/equinox","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/homerjed/sbiax","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":4,"ran_draft_wrong":1,"unverified":6},"by_repo_kind":{"official":{"samples":10,"ran":4,"repositories":1},"community":{"samples":1,"ran":1,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"cf6b80e4dc6b6baf","entry":"doc_repr","repo":"patrick-kidger/equinox","repo_kind":"official","path":"equinox/_doc_utils.py","file_url":"https://github.com/patrick-kidger/equinox/blob/HEAD/equinox/_doc_utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cf6b80e4dc6b6baf"}},{"code_sha256_prefix":"e7b19a731b5d767d","entry":"hashable_combine","repo":"patrick-kidger/equinox","repo_kind":"official","path":"equinox/_compile_utils.py","file_url":"https://github.com/patrick-kidger/equinox/blob/HEAD/equinox/_compile_utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e7b19a731b5d767d"}},{"code_sha256_prefix":"cbca56882036eaeb","entry":"hashable_filter","repo":"patrick-kidger/equinox","repo_kind":"official","path":"equinox/_compile_utils.py","file_url":"https://github.com/patrick-kidger/equinox/blob/HEAD/equinox/_compile_utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cbca56882036eaeb"}},{"code_sha256_prefix":"506ef344879884ae","entry":"hashable_partition","repo":"patrick-kidger/equinox","repo_kind":"official","path":"equinox/_compile_utils.py","file_url":"https://github.com/patrick-kidger/equinox/blob/HEAD/equinox/_compile_utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"506ef344879884ae"}},{"code_sha256_prefix":"54f9a104e7d281e8","entry":"update_pytree","repo":"ntt123/pax","repo_kind":"community","path":"pax/_src/core/module.py","file_url":"https://github.com/ntt123/pax/blob/HEAD/pax/_src/core/module.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"54f9a104e7d281e8"}},{"code_sha256_prefix":"efceb379a99dcddf","entry":"cached_filter_eval_shape","repo":"patrick-kidger/equinox","repo_kind":"official","path":"equinox/_eval_shape.py","file_url":"https://github.com/patrick-kidger/equinox/blob/HEAD/equinox/_eval_shape.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"efceb379a99dcddf"}},{"code_sha256_prefix":"513f172fd9630525","entry":"filter_eval_shape","repo":"patrick-kidger/equinox","repo_kind":"official","path":"equinox/_eval_shape.py","file_url":"https://github.com/patrick-kidger/equinox/blob/HEAD/equinox/_eval_shape.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"513f172fd9630525"}},{"code_sha256_prefix":"e27c4a46bd1b284b","entry":"filter_jvp","repo":"patrick-kidger/equinox","repo_kind":"official","path":"equinox/_ad.py","file_url":"https://github.com/patrick-kidger/equinox/blob/HEAD/equinox/_ad.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e27c4a46bd1b284b"}},{"code_sha256_prefix":"7296149eeed77a64","entry":"filter_pure_callback","repo":"patrick-kidger/equinox","repo_kind":"official","path":"equinox/_callback.py","file_url":"https://github.com/patrick-kidger/equinox/blob/HEAD/equinox/_callback.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"7296149eeed77a64"}},{"code_sha256_prefix":"e96c8fa148dc699e","entry":"is_array_like","repo":"patrick-kidger/equinox","repo_kind":"official","path":"equinox/_filters.py","file_url":"https://github.com/patrick-kidger/equinox/blob/HEAD/equinox/_filters.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e96c8fa148dc699e"}},{"code_sha256_prefix":"35fd3f64c43e53b3","entry":"is_inexact_array","repo":"patrick-kidger/equinox","repo_kind":"official","path":"equinox/_filters.py","file_url":"https://github.com/patrick-kidger/equinox/blob/HEAD/equinox/_filters.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"35fd3f64c43e53b3"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}