mlboydaisuke commited on
Commit
448c45a
·
verified ·
1 Parent(s): c0599b9

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +28 -7
README.md CHANGED
@@ -24,15 +24,15 @@ each candidate together with the query and scores it properly.
24
 
25
  ## Variants
26
 
27
- | build | file | size (MB) | worst score error vs eager | Mac median (ms)* |
28
- |---|---|---|---|---|
29
- | fp32 | `rerank_bge_reranker_base_xnnpack_fp32.pte` | 1112.4 | 0.0000 logits | 76.9 |
30
- | fp16 | `rerank_bge_reranker_base_xnnpack_fp16.pte` | 556.4 | 0.0185 logits | 169.4 |
31
- | Core ML (fp16, iOS) | `rerank_bge_reranker_base_coreml_all.pte` | 556.6 | 0.0458 logits | 19.7 |
32
 
33
  \*Mac arm64, single process, median of 10, one query-document pair at 512 tokens — a
34
  reference point for relative cost, not a device number. PyTorch eager fp32 on the same
35
- machine: 54.7 ms.
36
 
37
  Correlation is not reported because it cannot be: the output is a single number, and the
38
  correlation of a one-element vector is undefined. The column above is the error in the
@@ -62,9 +62,30 @@ this shelf, scores the same passage -10.96 and puts it fifth of
62
  6. That is what the 250k-token vocabulary buys, and it is also why this file is
63
  12 times larger.
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  ## Not shipped
66
 
67
- - **int8 (dynamic) is not shipped**: at 856.1 MB it is larger than the fp16 build's 556.4 MB, and its score error is 0.5776 logits. Dynamic int8 quantizes the linear weights and leaves the token embedding table in fp32, while fp16 halves that table too. The table here is 768 MB of a 1112 MB model, and the arithmetic says int8 only comes out smaller when the table is under a third of the weights (371 MB) — measured on ten models on this shelf, the rule called all ten correctly.
68
 
69
  ## Verification
70
 
 
24
 
25
  ## Variants
26
 
27
+ | build | file | size (MB) | worst score error vs eager | Mac median (ms)* | backend takes |
28
+ |---|---|---|---|---|---|
29
+ | fp32 | `rerank_bge_reranker_base_xnnpack_fp32.pte` | 1112.3 | 0.0000 logits | 55.3 | 78.3% |
30
+ | fp16 | `rerank_bge_reranker_base_xnnpack_fp16.pte` | 556.4 | 0.0067 logits | 96.6 | 67.8% |
31
+ | Core ML (fp16, iOS) | `rerank_bge_reranker_base_coreml_all.pte` | 557.7 | 0.0419 logits | 20.1 | 100.0% |
32
 
33
  \*Mac arm64, single process, median of 10, one query-document pair at 512 tokens — a
34
  reference point for relative cost, not a device number. PyTorch eager fp32 on the same
35
+ machine: 62.4 ms.
36
 
37
  Correlation is not reported because it cannot be: the output is a single number, and the
38
  correlation of a one-element vector is undefined. The column above is the error in the
 
62
  6. That is what the 250k-token vocabulary buys, and it is also why this file is
63
  12 times larger.
64
 
65
+ ## The attention is eager, and that is the faster export
66
+
67
+ `F.scaled_dot_product_attention` does not survive export as one operation. The edge
68
+ dialect lowers it through `_safe_softmax`, whose guard against a row with no unmasked
69
+ key at all leaves **eleven operations XNNPACK cannot take, in every attention block** —
70
+ `scalar_tensor`, `where`, `mul.Scalar`, `logical_not`, `eq`, `full_like`, `any.dim`.
71
+ Each one cuts the subgraph in two. The count is exact and does not vary by family:
72
+ measured across this shelf, from a 4-layer cross-encoder to a 28-layer causal reranker,
73
+ it is 11 per block every time.
74
+
75
+ The guard is emitted whether or not it can ever fire, and here it cannot. It triggers
76
+ only on `-inf`, which reaches the graph only because the sdpa path hands `F.sdpa` a
77
+ **boolean** mask for PyTorch to fill; `attn_implementation="eager"` masks with
78
+ `torch.finfo(dtype).min`, a large finite number, and never produces one. So the two
79
+ arms differ only on rows that have no unmasked key — sdpa zeroes them, eager gives them
80
+ a uniform row — and those are padding rows, which the pooling discards and every real
81
+ query row masks out. Measured with all but eight positions masked, as adversarial as
82
+ this shape gets, the two graphs agree to 1.1e-05.
83
+
84
+ XNNPACK fp32 goes from **62.5% to 78.3%** delegated.
85
+
86
  ## Not shipped
87
 
88
+ - **int8 (dynamic) is not shipped**: at 856.1 MB it is larger than the fp16 build's 556.4 MB, and its score error is 0.7316 logits. Dynamic int8 quantizes the linear weights and leaves the token embedding table in fp32, while fp16 halves that table too. The table here is 768 MB of a 1112 MB model, and the arithmetic says int8 only comes out smaller when the table is under a third of the weights (371 MB) — measured on ten models on this shelf, the rule called all ten correctly.
89
 
90
  ## Verification
91