Skip to content

epic: OpenXLA backend architecture-coverage parity with the MLX engine #493

Description

@inureyes

Problem / Background

The MLX engine supports roughly 90 model_type values (see src/models/detection.rs). The OpenXLA/IREE backend (#449 M3 Stage 2d) currently serves only three text, dense architectures: Llama, Qwen2, and Gemma2, on both the single-sequence CLI path (MLXCEL_BACKEND=xla) and the continuous-batching serve path (mlxcel-server).

The gap is no longer infrastructure. The shared, architecture-agnostic base is already done and must not be re-created:

  • Weight loading: single-file and sharded (index.json), bf16/f16/f32 widening, MLX 4bit/8bit affine dequant.
  • IREE runtime, KV cache, and compile pipeline.
  • Continuous-batching engine: XlaBatchEngine plus the ragged scheduler.
  • Host-side sampling: temperature, top-k, top-p, min-p, seed.
  • History penalties: repetition, frequency, presence, DRY.
  • Streaming-safe stop strings.
  • Server seam: BatchEngine trait, XlaServeWorker, /v1/completions, /metrics.

Goal

Bring the OpenXLA backend toward MLX-engine architecture coverage, planned in release windows. Because the common base is fixed, adding a new family needs only four per-family pieces:

  1. Config::from_json arch detection and fields (emitter/config.rs).
  2. weight_names per-layer order (iree.rs).
  3. The emitter forward (emitter/model.rs).
  4. Token-exact (or reference-exact) validation against an HF oracle on a real checkpoint.

The only exceptions are families that need a new shared graph primitive (MoE FFN, SSM/recurrent mixing); those are scoped as their own foundation issues so the per-family work stays cheap.

Validation pattern

The established gate for every architecture:

  1. Dequant a 4bit/8bit checkpoint offline to f32 (or use a bf16 checkpoint directly).
  2. Run HF fp32 as the oracle.
  3. Run XLA on the quantized/bf16 model.
  4. Compare: single-sequence path token-exact vs the HF fp32 oracle; serve path reference-exact via xla_batch_bench.

tanh-based architectures (soft-capping, GeGLU) may differ only at sub-0.01 logit near-ties; that is acceptable.

Sub-issues

Phase 1: Window A (Foundation)

Phase 2: Window B (Dense decoder-only families)

Phase 3: Window C (Mixture-of-Experts)

Phase 4: Window D (SSM / hybrid / recurrent)

Phase 5: Window E (Multimodal / VLM)

Acceptance Criteria

  • All sub-issues completed and merged.
  • Each new family loads and generates via the CLI MLXCEL_BACKEND=xla path and serves via mlxcel-server.
  • Each new family passes the validation gate: token-exact single-seq vs HF fp32 oracle, reference-exact serve via xla_batch_bench.
  • Windows D and E either land a first reference architecture or record an explicit deferral into a dedicated follow-up epic.

Technical Considerations

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions