FluidAudio ASR runs inside an iOS keyboard extension (CPU and ANE): how, and numbers
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- ios, swift
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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?
- 主要言語
- Swift
- スター
- 3k
- フォーク
- 451
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 87
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
FluidInference/FluidAudio のほかの issue
-
Kokoro ANE legacy: Alignment still runs the graph that traps at 48 tokens (#1172 fixed v3 only)オープンbug text-to-speech
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
FluidInference/FluidAudio#1201 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
FluidInference/FluidAudio#1200 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
FluidInference/FluidAudio#1194 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
FluidInference/FluidAudio#1193 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
FluidInference/FluidAudio#1191 ·
メンテナーはふだん 1 日以内に返信
FluidInference/FluidAudio の issue をすべて見る
似ている issue
-
area: build-and-ci S3: minor
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
manaflow-ai/cmux#65734 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OneBusAway/onebusaway-ios#2025 ·
メンテナーはふだん 1 日以内に返信
-
good first issue help wanted
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
erkamyaman/rust-anything#930 ·
メンテナーはふだん 1 日以内に返信
-
contributor: external iOS needs review sdk-58 severity: low
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
SwiftOldDriver/iOS-Weekly#5528 ·
メンテナーはふだん 1 日以内に返信