Universal components for differentiable scientific computing 📦
Read the docs | API reference | Demos & tutorials | Blog | User Forum | Report an issue | Contribute
Optimize, calibrate, and train through solvers in any language or framework. Tesseract wraps any software behind a typed interface with derivative endpoints, runs it in its own process, and hands it to jax.grad or torch.autograd as a single differentiable operation.
- Define a component in
tesseract_api.py: Pydantic schemas for its inputs and outputs, anapplyfunction, and optional derivative endpoints, computed however you like (autodiff, adjoints, finite differences). - Run it in its own process and environment, build it as a container image, or serve it remotely. Each way exposes the same endpoints.
- Differentiate through it with Tesseract-JAX and Tesseract-Torch, so one gradient can cross languages and frameworks. Overhead is typically a few milliseconds per call (see the performance guide).
- Check every derivative endpoint against finite differences with
check-gradients.
PRISMOA Julia semiconductor solver and a FEniCS optics solver in one JAX gradient, reaching more than five times the optical phase shift of the starting design. |
δSnowSacA PyTorch network learns to calibrate NOAA's operational Fortran models, Snow-17 and SAC-SMA, with gradients flowing through the untouched Fortran. |
Rocket grid finsAnsys SpaceClaim geometry and PyMAPDL structural analysis in one optimization loop, giving a design 24% stiffer than the baseline at the same mass. |
|
Sentaurus TCAD, a closed-source binary driven over SSH, differentiated with finite differences and Broyden updates to tune a transistor for a spiking network. |
NeuroLocateA PyTorch network proposes EEG sources, and JAX refines them with gradients through OpenMEEG, a C++ boundary element solver with no autodiff of its own. |
MosaicSolvers in C++, Julia, JAX, and PyTorch, from deal.II and OpenFOAM to JAX-FEM and XLB, behind one Tesseract interface, so a single harness can compare their gradients and cost on shared tasks. |
Tip
Still unsure whether you need Tesseract? See When to use Tesseract.
You need Python 3.10+ and uv, which Tesseract uses to build an isolated environment for each component.
$ pip install tesseract-core tesseract-jax
$ tesseract init --name my-tesseractReplace the generated tesseract_api.py with this stand-in for a solver:
# tesseract_api.py
from pydantic import BaseModel
from tesseract_core.runtime import Array, Differentiable, Float32, ShapeDType
class InputSchema(BaseModel):
x: Differentiable[Array[(None,), Float32]]
class OutputSchema(BaseModel):
y: Differentiable[Array[(None,), Float32]]
def apply(inputs: InputSchema) -> OutputSchema:
# Call your solver, mesh generator, or surrogate here
return OutputSchema(y=inputs.x**2)
def vector_jacobian_product(inputs, vjp_inputs, vjp_outputs, cotangent_vector):
# Hand-written, autodiff, adjoint solve, finite differences, ...
return {"x": 2 * inputs.x * cotangent_vector["y"]}
def abstract_eval(abstract_inputs):
# Output shapes from input shapes, so JAX can trace without running apply
return {"y": ShapeDType(shape=abstract_inputs.x.shape, dtype="float32")}Run it in its own process and differentiate through it with JAX:
import jax
import jax.numpy as jnp
from tesseract_core import Tesseract
from tesseract_jax import apply_tesseract
with Tesseract.from_source("tesseract_api.py") as solver:
loss = lambda x: apply_tesseract(solver, {"x": x})["y"].sum()
print(jax.grad(loss)(jnp.array([1.0, 2.0, 3.0]))) # [2. 4. 6.]Tesseract-Torch does the same for torch.autograd. Before an optimizer relies on the hand-written VJP, check it against finite differences:
$ pip install "tesseract-core[runtime]"
$ TESSERACT_API_PATH=tesseract_api.py tesseract-runtime check-gradients '{"inputs": {"x": [1.0, 2.0, 3.0]}}'
✅ Gradient check for vector_jacobian_product passed ✅ (0 failures / 1000 checks)To share or deploy the component, build the same folder as a container image, which requires Docker. Tesseract.from_image("my-tesseract") then takes the place of from_source:
$ tesseract build .
$ tesseract run my-tesseract apply '{"inputs": {"x": [1.0, 2.0, 3.0]}}'- Tesseract Core: CLI, Python SDK, and runtime (this repo).
- Tesseract-JAX: embed Tesseracts as JAX primitives, compatible with
jit,grad, andvmap. - Tesseract-Torch: embed Tesseracts as PyTorch operators with
torch.autogradsupport.
Also see Tesseract-Streamlit to generate web apps from Tesseracts, and cookiecutter-tesseract for a multi-Tesseract project template.
- Get started
- Overview: how Tesseracts work and the ways to run them
- Checking gradients
- Differentiable programming guide
- Demos & tutorials
- Deploying Tesseracts
If you use Tesseract in your research, please cite:
@article{TesseractCore,
doi = {10.21105/joss.08385},
url = {https://doi.org/10.21105/joss.08385},
year = {2025},
publisher = {The Open Journal},
volume = {10},
number = {111},
pages = {8385},
author = {Häfner, Dion and Lavin, Alexander},
title = {Tesseract Core: Universal, autodiff-native software components for Simulation Intelligence},
journal = {Journal of Open Source Software}
}Tesseract Core is licensed under the Apache License 2.0 and is free to use, modify, and distribute (under the terms of the license).
Tesseract is a registered trademark of Pasteur Labs, Inc. and may not be used without permission.




