Skip to content

asr: memory-map the Parakeet GGUF by default, Android included - #83

Merged
lalalune merged 1 commit into
mainfrom
asr/parakeet-mmap-default
Oct 23, 2026
Merged

lalalune merged 1 commit into
mainfrom
asr/parakeet-mmap-default

Conversation

@lalalune

Copy link
Copy Markdown
Member

What

eliza_inference_asr_* on the Parakeet-TDT backend (Phonon-2) now memory-maps the GGUF on every platform. Until now it used eliza_asr_use_mmap(), the Qwen3-ASR policy, which reads the file into private memory on Android (!eliza_asr_android_cpu_profile()).

  • New eliza_parakeet_use_mmap(): default true, and ELIZA_ASR_USE_MMAP=0 still selects the private copy.
  • The Qwen3-ASR / mtmd path keeps its current policy. No device evidence was gathered for that path, and Grace does not ship it.
  • README: documents the default and the override.

Why

The kernels decode the fv5 codes straight from the GGUF (tools/parakeet/README.md: "The model is mmapped and used in place"), so a mapping costs only clean page cache that the kernel can reclaim. A private copy is ~320 MB of anonymous memory. On a 4 GB Lenovo TB336FU that allocation went to swap and starved the device (Grace crash, gracefultechnology/grace#152, which works around it with ELIZA_ASR_USE_MMAP=1).

Evidence

Tablet, TB336FU (Android, 4 GB, arm64), this branch. eliza-inference-test-parakeet-asr (NDK r29, android-28, Release), pinned phonon-2-fv5.gguf (sha256 dc552eb7…), an 8.15 s TTS clip. Peak values sampled from /proc/<pid>/status every 50 ms:

ELIZA_ASR_USE_MMAP peak RssAnon peak RssFile batch (warm) FFI checks
unset (new default) 81 MB 325 MB (clean, reclaimable) 1.40–1.46 s pass
0 (old Android default) 404 MB 6 MB 2.06 s pass

All runs give the same 26-word transcript in batch and in streaming mode.

Grace on the same tablet (measured in the app with the override, reported by the Grace session). Mapped, the private memory added by ASR was under 16 MB. The private copy was a 323 MB allocation that went to swap. WER was unchanged (0.034), and warm ASR RTF was about 0.10.

Mac (M-series, CPU build): footprint 113 MB mapped vs 442 MB private. On macOS this only confirms the override still works, because the default was already mmap there.

Evidence boundaries

  • What the table proves: the default on Android is now a mapping, the override works, and the FFI behaviour is unchanged. It is a test binary in /data/local/tmp, not the app.
  • The in-app numbers come from the Grace work-around (env var), not from an APK built on this branch.

AI-assisted change.

🤖 Generated with Claude Code

The Parakeet-TDT (Phonon-2) backend reads its fv5 codes in place from the
GGUF, but on Android it inherited the Qwen3-ASR CPU profile, which reads the
whole file into private memory. On a 4 GB tablet that is a ~320 MB anonymous
allocation that goes to swap. Map it on every platform instead;
ELIZA_ASR_USE_MMAP=0 still selects the private copy. The Qwen3-ASR policy is
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation examples labels Oct 20, 2026
@lalalune
lalalune merged commit 1241a95 into main Oct 23, 2026
3 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant