[Deferred] TTFT increases 3× after a few seconds of inactivity — local investigation
Status
Deferred for later investigation. This issue preserves the diagnostic findings for a future follow-up. No fix has been validated and no deadline has been set. This status reflects our local tracking, not a commitment from the maintainers.
Observed problem
After a few seconds of inactivity, the delay before the first received content increases by approximately one second. The model remains loaded.
Test environment: oMLX macOS application 0.7.0rc1 build 2849, bundled MLX 0.32.2, Qwen3.8-Flash-Next-oQ4e-mtp, with PLE offloaded to SSD. The local installation and runtime contain adaptations; reproduction on an unmodified upstream distribution remains to be verified.
Protocol and measurements
/v1/chat/completionsendpoint, streaming, sequential requests.- Identical 472-token input, output limited to 64 tokens, temperature 0, seed 42.
- Cache disabled; no cached tokens reported.
- Two initial warm-up requests; one reactivation request before each idle interval.
- Four repetitions per interval, shuffled with fixed seeds, without profiling during measurements.
- Client-side TTFT: time from the start of the HTTP request until the first content or reasoning is received.
| Idle interval | Requests | Median TTFT | Minimum–maximum |
|---|---|---|---|
| 0 s | 4 | 0.463 s | 0.460–0.465 s |
| 0.1 s | 4 | 0.478 s | 0.474–0.492 s |
| 0.3 s | 4 | 0.507 s | 0.504–0.516 s |
| 1 s | 4 | 0.500 s | 0.476–0.509 s |
| 3 s | 4 | 1.411 s | 1.403–1.514 s |
| 10 s | 4 | 1.383 s | 1.275–1.403 s |
Median overhead after three seconds: approximately 0.948 s, or a 3.05× increase in TTFT. The change occurs between one and three seconds in this sample; the exact threshold was not measured.
All 24 measured requests completed without errors. Content and reasoning matched by SHA-256 hash. Responses stop at the 64-token limit: this test demonstrates neither general output quality nor long-term reliability. The sample is insufficient for a representative p95.
Investigation completed so far
Earlier Python traces locate a wait during MLX materialization in engine/vlm.py, around:
token_ids = input_ids[0].tolist() if input_ids.ndim > 1 else input_ids.tolist()Two experiments failed to remove the overhead and were reverted: selecting the row on the CPU after conversion, then using text tokenization without MLX before admission.
A tiny MLX operation with no model loaded does not reproduce this overhead.
Three pre-armed native captures show MLX/Metal submission, residency, and wait calls. These captures aggregate several seconds and perturb timing; they cannot attribute the delay to a specific call. Their timings are excluded from the table.
The native cause has not been isolated. GPU wake-up and memory residency remain hypotheses, not conclusions.
Future follow-up
- Verify reproduction on an unmodified upstream version and retain the before/after protocol.
- Correlate a timestamped GPU/native trace with the request start and first submission after the idle interval.
xctraceis unavailable in the current diagnostic environment. - Choose a fix only after identifying the mechanism.
- Validate on a larger sample and multiple inputs: proposed target of at least a 30% reduction in median TTFT after idle, less than 5% regression when warm, no additional errors, preserved deterministic outputs, and verified memory usage and unloading.
Settings were restored after the experiments, the model was unloaded, and the server was healthy. No fix was installed and no artificial GPU keep-alive was added.
Source: jundot/omlx