You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
M3: Bumblebee DistilBERT end-to-end on Emily.Backend
Every Nx op on the transformer critical path now runs natively on MLX;
a full DistilBERT forward pass matches HuggingFace Transformers (PyTorch)
reference values within f32 tolerance across six architecture variants.
Emily.Backend changes
- Native batched dot/7 via permute + 3-D reshape + Native.matmul,
replacing the BinaryBackend bounce. Hits 12x per DistilBERT forward
(2x per attention block x 6 layers).
- Cast binary-op operands to out.type at the backend boundary. MLX's
cross-type promotion for mixed integer widths (e.g. u64+s32) falls
back to float32 and then rejects bitwise ops; Nx.Random.key hits
this transitively via Axon's dropout defn.
- slice starts can now be scalar tensors (dynamic slicing under defn);
materialised to concrete ints on the fly.
- bitcast implemented via mx::view (zero-copy reinterpret between
equal-width dtypes). Removes the hard raise; unblocks Nx.Random.
- argmax/argmin derive keep-axis from out.shape vs input rank so
behaviour is stable across Nx's :keep_axis / :keep_axes drift.
Conformance suite
- test/emily/conformance/distilbert_test.exs ports Bumblebee's own
DistilBERT tests verbatim: :base, :for_masked_language_modeling,
:for_sequence_classification, :for_token_classification,
:for_question_answering, :for_multiple_choice, plus an
Nx.Serving.batched_run smoke test exercising tokenizer -> model ->
postprocess end to end.
- @moduletag :conformance, excluded by default; run explicitly with
mix test --only conformance. CI runs it as a separate step after
mix precommit, with ~/Library/Caches/bumblebee cached across runs.
- Batched-dot property tests added to backend_test.exs covering 1-
and 2-axis batch cases plus scalar-output and multi-free-axis
shapes.
Deps
- bumblebee ~> 0.6 and tokenizers ~> 0.5 added as test-only deps.
- nx pinned ~> 0.10 (down from 0.11) to match Bumblebee's constraint;
Emily's own API is unaffected.
Out of scope for this milestone: native conv translation. PLAN.md lists
it under M3 but DistilBERT and M4's Qwen3 don't use it; the
BinaryBackend fallback remains until a CV model lands on Emily.
0 commit comments