mlboydaisuke commited on
Commit
26dfeb9
Β·
verified Β·
1 Parent(s): cce2cb4

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +45 -15
README.md CHANGED
@@ -29,17 +29,19 @@ attention_mask (1, 512) int64
29
 
30
  ## Variants
31
 
32
- | build | file | size (MB) | worst score error vs eager | Mac median (ms)* |
33
- |---|---|---|---|---|
34
- | fp32 | `rerank_qwen3_0_6b_xnnpack_fp32.pte` | 2383.7 | **0.0000 logits** | 381.5 |
35
- | fp16 | `rerank_qwen3_0_6b_xnnpack_fp16.pte` | 1192.5 | 0.0247 logits | 1058.0 |
36
- | **Core ML (fp16, iOS)** | `rerank_qwen3_0_6b_coreml_all.pte` | 1195.2 | 0.0573 logits | **85.0** |
37
-
38
- \*Mac arm64, median of 10, one 512-token pair β€” a reference point for relative cost, not
39
- a device number. Torch eager fp32 on the same machine is 261 ms. **Core ML is the one to
40
- use where it exists**: 4.5x faster than XNNPACK fp32 and 100% of the graph delegated,
41
- where XNNPACK takes 72% across 172 subgraphs. A reranker earns its keep over a list of
42
- fifty candidates, so that factor is the whole story.
 
 
43
 
44
  Correlation cannot judge this model β€” the output is a single number, and the correlation
45
  of a one-element vector is undefined. The gate is the score error in the model's own
@@ -113,17 +115,45 @@ The six test pairs include a Japanese passage that says what the query asks. It
113
  (+6.727). The shelf's `ms-marco-MiniLM` rerankers are English-only and put it far lower β€”
114
  which is the right answer for them, not a defect.
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  ## Not shipped: int8
117
 
118
- `rerank_qwen3_0_6b_xnnpack_int8.pte` is **1064.0 MB** and runs at 327 ms β€” smaller and
119
- faster than the fp32 build. It is withheld on the number that decides.
 
120
 
121
- Dynamic int8 moves a pair score by **0.6456 logits**, against a narrowest adjacent gap of
122
  **0.7433** in the ranking it has to preserve. It happens to keep the order on these six
123
- pairs, but an error that is 87% of the distance between two neighbours is not a build
124
  that ranks reliably β€” a slightly different candidate list would reorder.
125
 
126
  The size was predictable before it was built: the token embedding table is
127
  151,669 x 1024 x 4 = 621 MB of the 2383.7 MB model, a **26.1%** share, and this shelf's
128
  rule `int8/fp16 = 0.5 + 1.5 x (table share)` puts the file at 0.891 of fp16. It came out
129
  at **0.892** β€” the same figure as Qwen3-Embedding-0.6B, which shares this backbone.
 
 
 
 
 
29
 
30
  ## Variants
31
 
32
+ | build | file | size (MB) | worst score error vs eager | Mac ms* | backend takes |
33
+ |---|---|---|---|---|---|
34
+ | fp32 | `rerank_qwen3_0_6b_xnnpack_fp32.pte` | 2383.7 | **0.0001 logits** | 320.5 | 80.8% |
35
+ | fp16 | `rerank_qwen3_0_6b_xnnpack_fp16.pte` | 1192.4 | 0.0268 logits | 1188.8 | 70.4% |
36
+ | **Core ML (fp16, iOS)** | `rerank_qwen3_0_6b_coreml_all.pte` | 1196.2 | 0.0886 logits | **83.4** | 100% |
37
+
38
+ \*Mac arm64, one 512-token pair, **fastest of five medians of ten** β€” a reference point for
39
+ relative cost, not a device number. The host shares its cores with other work and a single
40
+ median does not survive that; contention only ever adds time, so the fastest repetition is
41
+ the one that means something. Torch eager fp32, measured the same way, is 320.1 ms.
42
+ **Core ML is the one to use where it exists**: 3.8x faster than XNNPACK fp32, the whole
43
+ graph in one delegated subgraph where XNNPACK takes 80.8% across 172. A reranker earns its
44
+ keep over a list of fifty candidates, so that factor is the whole story.
45
 
46
  Correlation cannot judge this model β€” the output is a single number, and the correlation
47
  of a one-element vector is undefined. The gate is the score error in the model's own
 
115
  (+6.727). The shelf's `ms-marco-MiniLM` rerankers are English-only and put it far lower β€”
116
  which is the right answer for them, not a defect.
117
 
118
+ ## The attention is eager, and the left padding is why that needed checking
119
+
120
+ `F.scaled_dot_product_attention` does not survive export as one operation. The edge
121
+ dialect lowers it through `_safe_softmax`, whose guard against a row with no unmasked key
122
+ at all leaves **eleven operations XNNPACK cannot take, in every attention block** β€”
123
+ `scalar_tensor`, `where`, `mul.Scalar`, `logical_not`, `eq`, `full_like`, `any.dim`. Over
124
+ 28 layers that is 308 operations, each one cutting the subgraph in two. Exporting with
125
+ `attn_implementation="eager"` removes them: **72.0% to 80.8% delegated**, fp32 from 381.5
126
+ to 320.5 ms.
127
+
128
+ **This is the one model on the shelf where that guard could plausibly have been doing
129
+ work.** Its prompt is left-padded, so the leading rows of a causal mask have no unmasked
130
+ key at all β€” exactly the case the guard exists for. Every other model here is
131
+ right-padded, where even an all-padding row still sees the real tokens and the question
132
+ never arises.
133
+
134
+ So it was measured rather than assumed. With 109 real tokens of 512, sdpa against eager:
135
+ no `NaN` appears on either arm, and the scored last position reads **54.7696 against
136
+ 54.7695**. The reason is that the guard fires only on `-inf`, and eager masks with
137
+ `torch.finfo(dtype).min`, a large finite number β€” a fully-masked row comes back uniform
138
+ instead of zeroed. Both answers are defined; they differ only about padding rows, and
139
+ this graph reads position βˆ’1, which is a real token by construction.
140
+
141
  ## Not shipped: int8
142
 
143
+ `rerank_qwen3_0_6b_xnnpack_int8.pte` is **1063.9 MB** and runs at 265.4 ms β€” smaller and
144
+ faster than the fp32 build, and 85.3% of it delegates, the most of any build here. It is
145
+ withheld on the number that decides.
146
 
147
+ Dynamic int8 moves a pair score by **0.6336 logits**, against a narrowest adjacent gap of
148
  **0.7433** in the ranking it has to preserve. It happens to keep the order on these six
149
+ pairs, but an error that is 85% of the distance between two neighbours is not a build
150
  that ranks reliably β€” a slightly different candidate list would reorder.
151
 
152
  The size was predictable before it was built: the token embedding table is
153
  151,669 x 1024 x 4 = 621 MB of the 2383.7 MB model, a **26.1%** share, and this shelf's
154
  rule `int8/fp16 = 0.5 + 1.5 x (table share)` puts the file at 0.891 of fp16. It came out
155
  at **0.892** β€” the same figure as Qwen3-Embedding-0.6B, which shares this backbone.
156
+
157
+ Going eager (below) made this build 13% faster and took it from 78.1% to 85.3%
158
+ delegated. It did not move the verdict: speed and quality are separate questions,
159
+ and what withholds this file is the score error, which barely changed.