Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -38,15 +38,15 @@ retrieves worse.
|
|
| 38 |
|
| 39 |
## Verification
|
| 40 |
|
| 41 |
-
| build | file | size (MB) | Mac ms* | worst cosine vs eager | retrieval budget |
|
| 42 |
-
|---|---|---|---|---|---|
|
| 43 |
-
| fp32 | `embed_multilingual_e5_small_xnnpack_fp32.pte` | 470.2 |
|
| 44 |
-
| fp16 | `embed_multilingual_e5_small_xnnpack_fp16.pte` | 235.
|
| 45 |
-
| Core ML (fp16, iOS) | `embed_multilingual_e5_small_coreml_all.pte` | 235.
|
| 46 |
|
| 47 |
\*Mac arm64, median of 10, one 256-token sequence β a reference point for relative
|
| 48 |
cost, not a device number. Torch eager fp32 on the same machine is
|
| 49 |
-
|
| 50 |
|
| 51 |
Cosine is measured against the model run in eager through its own pooling, over eight
|
| 52 |
sentences. The last column is the one that decides: rank those eight against each
|
|
@@ -54,18 +54,35 @@ other, and ask whether this build's score error is smaller than the gap between
|
|
| 54 |
document a query retrieves and the runner-up. Every shipped build keeps all eight
|
| 55 |
top-1 results.
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
## Not shipped: int8
|
| 58 |
|
| 59 |
-
`embed_multilingual_e5_small_xnnpack_int8.pte` is **406.7 MB** against fp16's 235.
|
| 60 |
linear weights and leaves the token embedding table in fp32, and here that table is
|
| 61 |
384 MB of the 470.2 MB model β **82%**. The size a build comes out at is
|
| 62 |
`0.5 + 1.5 x (table share)` times the fp16 build; at 82% that is
|
| 63 |
1.73, so there was never a smaller file to be had.
|
| 64 |
|
| 65 |
It is withheld on the number that decides. Ranking the eight test sentences against
|
| 66 |
-
each other, this build moves a pair score by at most **0.
|
| 67 |
closest fp32 decision β the gap between the document a query retrieves and the
|
| 68 |
-
runner-up β is **0.0105**. That is **
|
| 69 |
the room available, against a bar of 50%.
|
| 70 |
|
| 71 |
Correlation reads 0.999568 for this build, which no correlation gate
|
|
|
|
| 38 |
|
| 39 |
## Verification
|
| 40 |
|
| 41 |
+
| build | file | size (MB) | Mac ms* | backend takes | worst cosine vs eager | retrieval budget |
|
| 42 |
+
|---|---|---|---|---|---|---|
|
| 43 |
+
| fp32 | `embed_multilingual_e5_small_xnnpack_fp32.pte` | 470.2 | 89.8 | 78.5% | 1.000000 | 0% |
|
| 44 |
+
| fp16 | `embed_multilingual_e5_small_xnnpack_fp16.pte` | 235.2 | 41.8 | 67.6% | 1.000000 | 1% |
|
| 45 |
+
| Core ML (fp16, iOS) | `embed_multilingual_e5_small_coreml_all.pte` | 235.8 | 4.9 | 100.0% | 0.999979 | 15% |
|
| 46 |
|
| 47 |
\*Mac arm64, median of 10, one 256-token sequence β a reference point for relative
|
| 48 |
cost, not a device number. Torch eager fp32 on the same machine is
|
| 49 |
+
124.0 ms.
|
| 50 |
|
| 51 |
Cosine is measured against the model run in eager through its own pooling, over eight
|
| 52 |
sentences. The last column is the one that decides: rank those eight against each
|
|
|
|
| 54 |
document a query retrieves and the runner-up. Every shipped build keeps all eight
|
| 55 |
top-1 results.
|
| 56 |
|
| 57 |
+
## The attention is eager, and that is the faster export
|
| 58 |
+
|
| 59 |
+
On the sdpa path transformers hands `F.scaled_dot_product_attention` a **boolean**
|
| 60 |
+
mask, PyTorch fills the masked entries with `-inf`, and the edge dialect lowers the
|
| 61 |
+
whole thing to `_safe_softmax` β whose guard against a row of all `-inf` costs six
|
| 62 |
+
operations XNNPACK cannot take (`scalar_tensor`, `where`, `logical_not`, `eq`,
|
| 63 |
+
`full_like`, `any.dim`), once per attention block, each one cutting the subgraph in two.
|
| 64 |
+
|
| 65 |
+
`attn_implementation="eager"` masks with `torch.finfo(dtype).min` instead β a large
|
| 66 |
+
finite number β so there is no guard to lower. The two disagree only about rows that
|
| 67 |
+
have no unmasked key at all: sdpa zeroes them, eager gives them a uniform row. Those
|
| 68 |
+
are padding rows, which the pooling discards and which every real query row masks out,
|
| 69 |
+
so the output does not move. Measured with all but eight positions masked β as
|
| 70 |
+
adversarial as this shape gets β the two graphs agree to 1.4e-07.
|
| 71 |
+
|
| 72 |
+
XNNPACK fp32 goes from **62.6% to 78.5%** delegated.
|
| 73 |
+
|
| 74 |
## Not shipped: int8
|
| 75 |
|
| 76 |
+
`embed_multilingual_e5_small_xnnpack_int8.pte` is **406.7 MB** against fp16's 235.2 MB. Dynamic int8 quantises the
|
| 77 |
linear weights and leaves the token embedding table in fp32, and here that table is
|
| 78 |
384 MB of the 470.2 MB model β **82%**. The size a build comes out at is
|
| 79 |
`0.5 + 1.5 x (table share)` times the fp16 build; at 82% that is
|
| 80 |
1.73, so there was never a smaller file to be had.
|
| 81 |
|
| 82 |
It is withheld on the number that decides. Ranking the eight test sentences against
|
| 83 |
+
each other, this build moves a pair score by at most **0.0046** while the
|
| 84 |
closest fp32 decision β the gap between the document a query retrieves and the
|
| 85 |
+
runner-up β is **0.0105**. That is **44%** of
|
| 86 |
the room available, against a bar of 50%.
|
| 87 |
|
| 88 |
Correlation reads 0.999568 for this build, which no correlation gate
|