# glance-speedlab

> A local lab for timing and speeding up live-camera vision-language inference

- Repository: https://github.com/yoheinakajima/glance-speedlab
- Category: Image, video & audio
- Stars: 52 · Forks: 9 · Language: Python · License: MIT
- Experience: Advanced
- Page: https://ir.adyog.com/repos/yoheinakajima/glance-speedlab/

Running a vision-language model on a live camera feed is slow, and it is hard to know which tweak actually helps. Glance Speedlab is a research harness for that. It grabs the newest camera frame only when the model is ready, sends one request with several questions, and reports capture, transport, image-prefix, scoring and full-loop latency separately.

It sits on top of Glance, a local layer that turns open vision-language models into typed yes/no decisions. Speedlab keeps a PyTorch MPS reference path next to an optional MLX 8-bit scorer, so you can switch between them in the same UI and compare.

Its main value is the written record. Each change starts as a preregistered experiment with a hypothesis and a quality guardrail, and the README tables what was kept and rejected. Results cover one Apple M5 laptop, Qwen3-VL-2B and 4B, and a small fixed test suite. It is a research prototype, not a production monitor.

## What it does

- **Per-stage latency reporting**: Capture, transport, image prefix, scoring and full-loop time are measured separately, so you can see what dominates.
- **Reference and MLX backends**: Compare Glance on PyTorch MPS with an opt-in MLX 8-bit scorer. The README reports it 25 to 28% faster on fresh frames, matching all 84 fixed-suite decisions.
- **Logged experiments, failures included**: The README tables about 16 interventions with outcomes. Native multi-question requests were 2.4x faster; 4-bit scoring was rejected for probability drift.
- **Benchmark command**: pnpm bench times a still image with warmup and iteration counts and writes JSON to stdout.
- **Local and private by default**: Everything binds to loopback, frames stay in memory, and metrics are recorded only if you turn them on, as timing metadata without frames.

## What you could build

- Measure where latency goes in a local webcam vision-language pipeline on a Mac.
- Compare PyTorch MPS and MLX 8-bit scoring for Qwen3-VL-2B on your own hardware.
- Reproduce or challenge the published speed and quality results with the preregistered experiment workflow.
- Test whether a smaller model tier or lower image-token cap keeps your decisions stable.
- Use the experiment log as a template for documenting performance work honestly.

## Who it's for

Suits developers and researchers working on local vision-language inference, ideally on Apple Silicon, who are comfortable with Python, Node and the Glance project first.

## Get started

Clone and set up Glance first, cache its model, then install Speedlab's Node dependencies and launch it. Open http://127.0.0.1:8787 in a camera-enabled browser; use pnpm launch:mlx after creating the MLX environment for the 8-bit path.

```
git clone https://github.com/yoheinakajima/glance.git
cd glance
uv sync
uv run glance doctor --json
uv run glance ask samples/dog.jpg "Is there a dog?"
```
```
corepack enable
pnpm install --frozen-lockfile
cp .env.example .env
pnpm launch
```

Tags: vision-language-model, latency, apple-silicon, benchmarking, mlx
