|
Download source/docs/compression.md from bingokingooo/shruti-coreml: direct link, hf CLI and curl.
- Browser
- Download file 3.35 kB
-
https://huggingface.co/bingokingooo/shruti-coreml/resolve/main/source/docs/compression.md
- Command line
-
hf download hf://bingokingooo/shruti-coreml/source/docs/compression.md
-
curl -L -o compression.md https://huggingface.co/bingokingooo/shruti-coreml/resolve/main/source/docs/compression.md
3.35 kB
| # Experimental Hindi weight compression | |
| The published Shruti Core ML archives reconstruct the upstream CQ4 weights | |
| as float32 constants. These candidates store weight-only quantized tensors | |
| in ML Program packages. Float32 graph inputs, activations, outputs, and the | |
| runtime beam search are unchanged. The audio frontend is copied unchanged. | |
| Build and screen a candidate using the dependencies and corpora in the | |
| project README. | |
| ```sh | |
| python -m shruti_coreml.compress build/hi build/hi-mixed-encoder \ | |
| --profile mixed-encoder --compile macos --compile ios | |
| python -m shruti_coreml.compression_eval build/hi-mixed-encoder \ | |
| --output results/local/compression/mixed-encoder | |
| ``` | |
| The build writes a portable ZIP, its SHA-256, and the sum of compiled file | |
| sizes. The latter excludes filesystem allocation, app packaging, and runtime | |
| memory. A profile can leave some tensors unchanged when Core ML Tools | |
| cannot compress their shapes or when they fall below its weight threshold. | |
| - `int4` uses per-block linear quantization with 32-value blocks. | |
| - `int8` uses per-channel linear quantization. | |
| - `mixed` uses INT8 in the stem and head and for the shared decoder token | |
| embedding and output projection. Other eligible weights use INT4. | |
| - `mixed-tables` adds INT8 for the decoder’s two Engram lookup tables. | |
| - `mixed-encoder` uses INT4 in the eight encoder blocks and INT8 elsewhere. | |
| The screen takes 24 utterances from each corpus ordered by SHA-256 of the | |
| clip ID. It verifies each audio hash and scores the candidate on the same | |
| clips as the FP32 reference. Monsoon uses the official lattice scorer. | |
| FLEURS and MUCS use the existing WER scorer. Per-clip transcripts stay in | |
| the local results directory. The iOS compiler checks package compatibility. | |
| Measure model load, transcription speed, and memory on an iPhone before | |
| promoting any candidate to the production catalog. | |
| ## Hindi results | |
| CPU-only inference on an Apple Silicon Mac, macOS 27.0.1. The FP32 ZIP | |
| from the public release is 207.8 MB. The candidate archives are local | |
| experimental artifacts. All five compiled for iOS with 12 model packages | |
| per variant, and ZIP integrity and notices were verified. | |
| | Candidate | ZIP (MB) | Compiled iOS assets (MB) | FLEURS Δ WER | Monsoon Δ OIWER | MUCS Δ WER | | |
| | --- | ---: | ---: | ---: | ---: | ---: | | |
| | int4 | 33.6 | 39.1 | +0.51 | +0.27 | +0.34 | | |
| | mixed | 36.9 | 42.6 | +0.67 | +0.50 | -0.34 | | |
| | mixed-tables | 44.6 | 50.3 | +0.51 | +0.50 | -0.34 | | |
| | mixed-encoder | 49.5 | 55.5 | +0.51 | +0.50 | +0.34 | | |
| | int8 | 53.8 | 60.0 | +0.17 | +0.00 | -1.03 | | |
| Error deltas are percentage points relative to the same FP32 transcripts | |
| on 24 clips per corpus. Positive means additional errors. These small | |
| samples screen candidates and do not establish noninferiority. | |
| The 49.5 MB mixed-encoder candidate cuts the ZIP by 76.2%. In the | |
| four Koash fixtures it retained the cricketer’s surname and the polar-night | |
| reference to the sun. It split “bulleted” into two tokens in the slides | |
| transcript and rendered “do not” as “don t” in the save dialog. All-INT4 | |
| misrecognized the cricketer’s surname. The all-INT8 variant retained all | |
| four FP32 fixture transcripts. The FP32 cricket transcript itself | |
| still misheard “score.” iPhone inference and actual installed footprint | |
| remain unmeasured for these exact compressed packages. | |