Skip to content

Add Qwen3.8 MLX image input support - #64

Closed
di37 wants to merge 4 commits into
ashhart:mainfrom
di37:feat/qwen38-mlx-image-support
Closed

di37 wants to merge 4 commits into
ashhart:mainfrom
di37:feat/qwen38-mlx-image-support

Conversation

@di37

@di37 di37 commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add one-image OpenAI image_url support for Qwen3.8-27B on MLX through pinned mlx-vlm
  • preserve the existing exact text path while using fused visual embeddings and multimodal RoPE for image requests
  • add bounded HTTPS/data-URL ingestion with SSRF, format, byte, pixel, redirect, deadline, logging, and queue safeguards
  • disable token-only prefix caching and drafting for image requests, and account for vision memory during admission
  • document the MLX-only image contract and OpenAI-compatible usage

Validation

  • 67 passed across image ingestion/HTTP, cancellation, request-policy, and OpenAI compatibility tests
  • real Vontra/Qwen3.8-27B-MLX-4bit image request correctly described the benchmark chart
  • mixed image/text requests completed concurrently
  • 8 simultaneous image requests all returned HTTP 200 through the bounded queue
  • code, Python, and security reviews completed with no remaining actionable findings

Scope

  • one image per chat request
  • JPEG, PNG, and WebP via HTTPS or base64 data URL
  • Qwen3.8 MLX only; CUDA, other families, audio/video, and image output remain unsupported

Made with Cursor

ashhart pushed a commit that referenced this pull request Sep 29, 2026
…ation, a redacted request log

From #64 (Qwen3.8 MLX image input), carried into the vision branch's modules:
- image URLs must be HTTPS on port 443 without a fragment, and the fetch sends a
  User-Agent and an Accept list of the image types it takes (hosts that refuse
  clients without one now serve the image);
- a response must declare image/jpeg, image/png or image/webp, and the decoder
  opens only JPEG, PNG and WebP;
- at most 16 requests decode and process images at once; others wait up to a
  minute, and past 128 waiting the server answers 503 so clients retry
  (CapacityError, on the Mac and CUDA servers);
- the request log records image parts as <redacted>.
@ashhart

ashhart commented Sep 29, 2026

Copy link
Copy Markdown
Owner

Thank you @di37, this was a careful PR, and parts of it shipped in 0.3.6.3 under your name.

We had image input in progress on a branch when #64 arrived, built a different way: the image encoder feeds the
engine's own language model, so image requests keep drafting (the same tokens as a "draft": false run, measured
5/5) and add under 1 GiB instead of a second copy of the 27B. So the second model and the serial image decode stay
out, and so does the batched image prefill, because we check that every concurrent stream matches its solo run
and a batched row doesn't.

What was better in yours, we took, in your commit (391713e2):

  • image URLs only over HTTPS on port 443, with a User-Agent and an Accept list (some hosts refused our fetches
    without one);
  • the response's Content-Type must be JPEG, PNG or WebP, and the decoder now opens only those three;
  • at most 16 requests prepare images at once, with a 503 "retry shortly" once the queue is full, which bounds
    host memory under a burst of large images;
  • image data never reaches the request log.

Your one-image contract and the SSRF tests were a good check on ours: our fetcher already pinned the connection
to the resolved address, and your port and scheme limits closed what it left open. Thanks again, and we'd be glad
to see more from you.

@ashhart ashhart closed this Sep 29, 2026
BlivionIaG referenced this pull request in BlivionIaG/TensorFold Oct 20, 2026
…ation, a redacted request log

From #64 (Qwen3.8 MLX image input), carried into the vision branch's modules:
- image URLs must be HTTPS on port 443 without a fragment, and the fetch sends a
  User-Agent and an Accept list of the image types it takes (hosts that refuse
  clients without one now serve the image);
- a response must declare image/jpeg, image/png or image/webp, and the decoder
  opens only JPEG, PNG and WebP;
- at most 16 requests decode and process images at once; others wait up to a
  minute, and past 128 waiting the server answers 503 so clients retry
  (CapacityError, on the Mac and CUDA servers);
- the request log records image parts as <redacted>.
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.

2 participants