Skip to content

Add ZAYA1-VL model support - #1159

Merged
Blaizzy merged 19 commits into
mainfrom
pc/add-zaya1-vl
May 10, 2026
Merged

Blaizzy merged 19 commits into
mainfrom
pc/add-zaya1-vl

Conversation

@Blaizzy

@Blaizzy Blaizzy commented May 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds support for Zyphra/ZAYA1-VL-8B in mlx-vlm, including the ZAYA language stack, multimodal wrapper, processor, prompt formatting, and weight sanitization for the upstream Transformers checkpoint layout.

Key pieces:

  • Adds mlx_vlm.models.zaya1_vl with config, language model, processor, and multimodal model wrapper.
  • Reuses the Qwen2.5-VL vision tower path for image embeddings.
  • Implements ZAYA CCA attention, routed expert MLPs, residual scaling, vision LoRA paths, cache handling, and checkpoint key conversion.
  • Uses the mlx-lm RoPE helper for rotary embeddings.
  • Handles ZAYA CCA auxiliary state for cached and batched prefill, including left-padded continuous batching.

Metrics

Zyphra/ZAYA1-VL-8B bf16 on M3 Max 96GB:

  • Prompt: 406 tokens, 495.073 tokens/sec
  • Generation: 186 tokens, 55.607 tokens/sec
  • Peak memory: 20.200 GB

Validation

  • Real ZAYA text forward on local Zyphra/ZAYA1-VL-8B weights: argmax 107.
  • Cached prefill/decode forward: decode argmax 107, decode vs full max abs 0.375.
  • Text parity smoke against Zyphra Transformers reference: ref argmax 107, MLX argmax 107, max abs 0.5, mean abs 0.042481184.
  • Batched left-padded prefill comparison: rows that previously selected EOS/point tokens now match single-request argmaxes.
  • Server validation with max_tokens=1200 through /v1/chat/completions:
    • single text-only and single image+text requests completed coherently
    • concurrent text-only: 4/4 completed coherently
    • concurrent mixed text and image+text: 4/4 completed coherently
    • no leaked box/point/image control tokens
    • no high-repetition responses
    • concurrent text aggregate throughput: ~100.4 completion tok/sec
    • concurrent mixed aggregate throughput: ~72.5 completion tok/sec

@Blaizzy
Blaizzy marked this pull request as ready for review May 9, 2026 11:39
@Blaizzy
Blaizzy requested a review from lucasnewman May 9, 2026 21:47
Blaizzy added 2 commits May 10, 2026 00:13
…suring consistency in normalization layers across the architecture. Update tests to verify the integration of nn.RMSNorm in relevant components.

@lucasnewman lucasnewman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Blaizzy
Blaizzy merged commit af8089f into main May 10, 2026
1 check passed
@kyr0

kyr0 commented May 10, 2026

Copy link
Copy Markdown

Interesting :) @Blaizzy have you seen my impl from 2 days ago? Hope it was able to help this development and that you didn't need to start from scratch https://github.com/ml-explore/mlx-lm/pull/1261/changes

ivan-avramov-rai pushed a commit to ivan-avramov/mlx-vlm that referenced this pull request Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants