FluidAudio ASR runs inside an iOS keyboard extension (CPU and ANE): how, and numbers
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- ios, swift
- Lĩnh vực
- machine-learning, mobile-dev
Hướng nghiên cứu
Read the issue's iOS keyboard extension probe details and the two questions about ANE reliability and sharing compiled CoreML caches through an App Group. The payload names no FluidAudio source files or tests to start from; first check the relevant CoreML and iOS extension APIs, then verify whether either approach is supported. Done means providing evidence-backed answers to both questions; the issue is exploratory and needs iOS/CoreML expertise.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Edited 2026-11-19: on-device probe results added; earlier version assumed the memory cap was the blocker, which turned out wrong.
Following up on a Discord thread. This is a case study / FYI with a couple of narrow questions at the end, not a bug report. FluidAudio tdtCtc110m loads and transcribes inside a custom keyboard extension on iOS 27, on both CPU and the ANE (confirmed with MLComputePlan), at well under the extension memory cap.
How: audio capture in a keyboard extension
Keyboard extensions don't get record entitlements. audiomxd logs that the process "is an extension and doesn't have entitlements to record audio". Hex (anomalyco/hex#1999, ios/HEXKeyboard/KeyboardLocalDictation.swift) gets around this with no entitlement:
- A hidden 2×2 px
WKWebView(alpha 0.02) loads an inline page that callsnavigator.mediaDevices.getUserMedia({audio}). WKUIDelegate.requestMediaCapturePermissionForauto-grants.microphone. WebKit's media process captures under the containing app's mic permission.- A
ScriptProcessorsends Int16 PCM as base64 to Swift throughwebkit.messageHandlers. - The keyboard's Info.plist adds
NSMicrophoneUsageDescriptionandNSSpeechRecognitionUsageDescription.
Hex then transcribes with Apple SpeechTranscriber (out of process). I used the same capture, but with FluidAudio in-process instead.
On-device probe (iPhone 16, iOS 27)
The containing app stages tdtCtc110m in the App Group container. The keyboard loads it with AsrModels.load(from:) and runs it in-process, with the containing app not running. The probe logs phys_footprint and os_proc_available_memory at each step.
Capture works at 48 kHz with healthy levels (peak 0.9998, rms 0.11).
CPU (.cpuOnly) |
ANE (.cpuAndNeuralEngine) |
|
|---|---|---|
| First load | ≈30 s (one-time CoreML compile, then cached) | 6.2 s |
| Later loads | 0.6 s | — |
| Audio → transcription time | 10.3 s → 231 ms (≈45× RT) | 27.0 s → 294 ms (≈92× RT) |
| Output | correct text inserted into Notes | correct text |
phys_footprint peak |
23 MB | 25 MB |
-
Cap: footprint +
os_proc_available_memory≈ 177 MB, which matches Hex's ~176 MB on iPhone 17 Pro / iOS 27.2. -
Memory headroom: even five accidental concurrent loads peaked at 34 MB.
-
What counts against the cap: the model's ~217 MB on-disk size is not charged to the extension. The compiled CoreML weights are clean, file-backed pages.
-
iOS 27 ANE attribution: the iOS 27.0 notes say Neural Engine memory is now attributed to the app process (174796039, background ANE gated by 179282606, see #738 / FB23457001). Even so, the ANE run stayed at 25 MB.
-
ANE confirmed:
MLComputePlanrun inside the keyboard:Model .cpuAndNeuralEngine.cpuOnlyPreprocessor (fused 110M encoder) ANE 988 ops / CPU 55 CPU 1043 Decoder (19 ops) CPU CPU JointDecision (24 ops) CPU CPU The
phys_footprintpeak in that run was 29 MB (ANE) / 32 MB (CPU) of the ~177 MB cap.
For contrast, my full app (Parakeet v2 + CTC-110M spotter + CPU fallback twins) peaks at 657 MB during load. That heavier load path is a different case and doesn't predict the extension numbers.
Mac bake-off (accuracy context)
M4 Mac mini, macOS 27.2, FluidAudio 0.18.4. 11 of my own dictation clips, 270 s of audio / 731 reference words. WER ignores case and punctuation. RTFx is measured on warm models.
| Engine | WER | RTFx | First load + warm-up |
|---|---|---|---|
| Parakeet v2 | 2.60% (19/731) | 266× | 14.0 s |
| tdtCtc110m | 4.38% (32/731) | 482× | 4.9 s |
| Phonon-2 | 4.92% (36/731) | 124× | n/a (196 s, includes ~360 MB download) |
Apple SpeechTranscriber |
6.02% (44/731) | 73× | 0.7 s (out of process) |
On my speech, tdtCtc110m beats Apple's on-device model (4.4% vs 6.0% WER) and is ~6.5× faster. Since it now runs inside the keyboard, it's a real upgrade over the out-of-process approach.
Questions
- Is there any known reason ANE-in-extension would break later, e.g.
anedlimits, compile-cache location/eviction, or per-process ANE quotas once iOS 27 attribution applies? - The first CPU load compiled for ~30 s inside the extension. Is there a supported way to compile in the containing app and share the compiled cache with the extension via the App Group, so the keyboard never pays the compile?
- Ngôn ngữ chính
- Swift
- Star
- 3k
- Fork
- 451
- Merge trung bình
- 1 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 87
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của FluidInference/FluidAudio
-
Kokoro ANE legacy: Alignment still runs the graph that traps at 48 tokens (#1172 fixed v3 only)Đang mởbug text-to-speech
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
FluidInference/FluidAudio#1201 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
FluidInference/FluidAudio#1200 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
FluidInference/FluidAudio#1194 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
FluidInference/FluidAudio#1193 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
FluidInference/FluidAudio#1191 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của FluidInference/FluidAudio
Issue tương tự
-
area: build-and-ci S3: minor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
manaflow-ai/cmux#65734 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
OneBusAway/onebusaway-ios#2025 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue help wanted
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
erkamyaman/rust-anything#930 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
contributor: external iOS needs review sdk-58 severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
expo/expo#54458 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
SwiftOldDriver/iOS-Weekly#5528 ·
Maintainer thường phản hồi trong vòng 1 ngày