# ADR-004: Nx/Axon for ML Inference (No Python Sidecar)

Status: Accepted | Date: 2026-05-21

## Context
Options for ML inference:
  A) Python sidecar (Flask/FastAPI + gRPC)
  B) External ML service (AWS SageMaker, etc.)
  C) Native Elixir: Nx + Axon + EXLA

## Decision
Option C: Nx + Axon + EXLA, served via Nx.Serving.

## Justification
- Python sidecar: adds network hop (5–15ms), process management complexity,
  separate deployment, language boundary serialization.
- External service: adds 20–100ms latency, external dependency, cost.
- Nx.Serving: runs in same BEAM process. Batches concurrent requests into
  single tensor op. EXLA JIT compiles to native CPU/GPU machine code.
  Zero network overhead. Jube equivalent: in-process ML inference.

---