Repository navigation
Conversation
…Android The C shim now disables the CPU memory arena and sets session.use_device_allocator_for_initializers=1, as the JVM/Android recognizer does since #16. Over the 77-clip parity run the footprint after scoring drops from 666 MB to 468 MB (peak 706 -> 592 MB); the iOS logits are bit-identical with and without the options. Claude-Session: https://claude.ai/code/session_01FcVpZoyr8VdRLp1QecX1Ng
- IosOnDeviceScorer replaces NoOnDeviceScoring: the pack lives in Application Support/scoring, excluded from the iCloud backup, downloads through the app's queue with the published digest, loads off the main thread and is released on background and memory warnings. - The scoring pipeline (scoreOnDevice) and ModelPackImport move to shared common code, so Android and iOS run the same code; Android behaviour is unchanged. - Import from Files with the document picker, opened in place. - The screens now offer the model on iOS, since the scorer is supported. Claude-Session: https://claude.ai/code/session_01FcVpZoyr8VdRLp1QecX1Ng
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The iOS app now scores takes on the phone when the model pack is installed, with the same pipeline and the same score as Android and the server. This replaces
NoOnDeviceScoring.What changed
IosOnDeviceScorer(shared/src/iosMain) is the iOS twin of Android'sOnDeviceScorer:Application Support/scoring, flagged withNSURLIsExcludedFromBackupKey.ForegroundDownloader), checked against the digest the server publishes.Dispatchers.IOand is released onUIApplicationDidEnterBackgroundNotificationand on memory warnings.URLSessionwould only have to replaceDownloadFile.fetch.AccentScoringwith variants,PhoneticProfile,StressAnalyzer,FeedbackAssembler) is nowscoreOnDevicein sharedcommonMain. Android'sscoreLoadedcalls it, and the code moved verbatim.ModelPackImportand the pinned/published digests also moved to shared common code, ported fromjava.ioto okio.rememberFilePickeron iOS usesUIDocumentPickerViewController, opened in place with security-scoped access. The 358 MB model is not copied into the app inbox first.supportedis true, onboarding, Settings, the offline drawer and the practice screen offer the model on iOS. When a take is offline and there is no pack, the app offers the download instead of an error.DisableCpuMemArenaandsession.use_device_allocator_for_initializers=1, as on Android since build: AGP 9.3 with R8 optimized resource shrinking, and lower on-device scoring memory #16. This is a separate commit.docs/IOS-ENGINE.mdanddocs/IOS-DEV.mdare updated.Deployment target is still iOS 16.0.
Evidence (iPhone 17 simulator, iOS 27, Debug)
Parity gate (
tools/score-parity/run-ios-parity.sh): PASS before and after the shim change, 49/49 identical final scores, and the 4 fixtures match the server golden. The iOS logits are bit-identical before and after the memory options (47/47 clips, all 49 records identical).Memory from the parity run (
phys_footprint, 77 clips):Memory in the app (
footprint -p):End to end against a local server (
:server:runwith the deployed assets):model-copy.onnx,vocab-copy.json) install under the right names with the right digests.Same score as the cloud. I replayed the exact
ScoreRequestthe app built (captured with a temporary hook, not committed) against/v1/scorewith the same WAV, for "Three people thank the firefighters." (a drill with content variants):medianVowelMs) come from the ORT version (server 1.20 vs device 1.30), already documented in IOS-ENGINE.md.acousticsandfluencyare server-only extras that Android on-device also leaves out.Tests:
:engine:jvmTest: 463 passed:shared:testAndroidHostTest: 146 passed:androidApp:testFdroidDebugUnitTest/testPlaystoreDebugUnitTest: 296 / 295 passed (includes the updatedModelPackImportTest):shared:iosSimulatorArm64Test: 84 passed:androidApp:assembleFdroidDebugandassemblePlaystoreDebugbuild, and:androidApp:lintFdroidDebugpasses.Known gap, not introduced here (owner decision)
Dialogue turns in "A Call Home" ("I'm fine, thanks, Mum. And you?") scored 88 on-device vs 91 in the cloud, with the same transcription:
ipaVariants. Dialogue turns ship none, and the recall-card path callsengine.toggle(text, ipa, accentIpa = ...)with no variants, so /ənd/ vs heard /a/ is MISSED.LessonViewModel. That moves scores, so it is not in this PR.Not verified
URLSession, which is a separate task.Risks
ModelPackImportnow goes through okio instead ofjava.io. Its unit test still passes.https://claude.ai/code/session_01FcVpZoyr8VdRLp1QecX1Ng