hr98w/jev-visual
An educational Jev-like visual inference experiment on Apple Silicon: shared context, direct candidate scoring, and local visual demos.
What it solves
It addresses the inefficiency of autoregressive structured generation (like generating JSON) when a vision-language model needs to answer multiple questions about a single image. Instead of generating text, it uses a direct-scoring method to quickly determine the most likely answer from a set of candidates.
How it works
The project uses a "shared prefill" strategy on Apple Silicon via MLX. It processes the image and context once, forks the cache, and then batches multiple question suffixes. Rather than letting the model "think" or write out an answer, it reads the model logits to score candidate outputs (such as A/B/C options or yes/no) and assembles the results in code.
Who it’s for
Developers and researchers interested in optimizing vision-language model (VLM) inference on Mac hardware, specifically those looking for alternatives to slow text generation for classification or multiple-choice tasks.
Highlights
- Optimized for Apple Silicon: Built to run locally on M-series chips using MLX.
- High-Efficiency Inference: Demonstrates a significant speedup (e.g., 37.30s down to 2.40s for 64 decisions) by using shared-prefix batched scoring instead of independent generation.
- Direct Scoring: Avoids the unpredictability of structured text generation by scoring candidate tokens directly from logits.
- Interactive Demos: Includes visual game demos like a simplified Breakout and an AI sorting factory to showcase real-time visual classification.
Related
- Project
- Project
- Project
- Project