Skip to content

feat: bundled INT8 dual-tower encoder, zero-permission OCR & :models_pack - #2

Merged
saariuslystoned merged 1 commit into
mainfrom
feat/days3-5-encoders-ocr
Dec 1, 2026
Merged

saariuslystoned merged 1 commit into
mainfrom
feat/days3-5-encoders-ocr

Conversation

@saariuslystoned

Copy link
Copy Markdown
Contributor

Summary

  • Play Asset Delivery install-time pack (:models_pack) & deterministic RCL1 exporter (scripts/export-int8-models.py): Generates dual_tower_int8.rcl1 (64→128→512 symmetric INT8 dual-tower weights) and ocr_glyphs_int8.rcl1 (8×12 tight-cropped INT8 glyph templates) at build time with zero binary blobs checked into git.
  • Bundled INT8 Dual-Tower Encoder (ModelPackLoader, Int8DualTowerEncoder): Loads verified RCL1 weights from Play Asset Delivery install-time assets (with debug/test classloader fallback) and produces L2-normalized 512-d INT8 embeddings.
  • Zero-Permission On-Device OCR (BitmapOcrExtractor): Grayscale + border-aware Otsu binarization (supporting both light and dark UI screenshots), horizontal line & vertical word/glyph segmentation, geometric . vs - disambiguation, and 8×12 INT8 template cosine classification returning real text + normalized [0, 1] OcrBox coordinates (never fabricating boxes on blank images).
  • Apples-to-Apples 8-Image FreeSched Calibration (FreeSchedEngine): Runs the exact same 8-image 2-layer FFN (seqLen=16, 64→128→64) in matching [out, in] weight layout on CPU vs FreeSched AHB+NNAPI with hot-loop timing boundaries, timeout slot draining, and honest fallback reporting.
  • Schema Upgrade Safety (RecallDatabase v1→v2, ImportManager.reindexPendingScreenshots): Drops incompatible v1 embeddings on upgrade and re-indexes stored screenshots cleanly with import_generation delete fencing.
  • CI Hardening (.github/workflows/ci.yml): Adds bundleDebug build + assertions that dual_tower_int8.rcl1 and ocr_glyphs_int8.rcl1 are present in both the AAB (:models_pack) and debug APK alongside existing zero-permission, 16 KiB ELF/zipalign, and clean-room audits.

Verification

  • ./gradlew --no-daemon testDebugUnitTest assembleDebug bundleDebug — 14/14 unit & Robolectric tests PASS.
  • ./scripts/check-zero-permissions.sh — 0 <uses-permission> in source manifest, 0 platform permissions in merged manifests & APK.
  • ./scripts/check-16k-alignment.sh — libfreesched.so & libandroidx.graphics.path.so uncompressed (ZIP_STORED), PT_LOAD 0x4000, zipalign -P 16 PASS.
  • ./scripts/clean-room-audit.sh — PASS across 48 files (0 errors).

@saariuslystoned
saariuslystoned merged commit 7617631 into main Dec 1, 2026
2 checks passed
@saariuslystoned
saariuslystoned deleted the feat/days3-5-encoders-ocr branch December 1, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant