docs: add Intended use, Why int8, Calibration, Limitations sections
Browse files
README.md
CHANGED
|
@@ -17,6 +17,11 @@ The first entry in the **OneBrain model line** β the cross-encoder reranker us
|
|
| 17 |
|
| 18 |
**v1 is not fine-tuned.** It is a size/speed-optimized int8 build of [BAAI/bge-reranker-v2-m3](https://huggingface.co/BAAI/bge-reranker-v2-m3) (Apache-2.0). Future versions (v2+) may be fine-tuned for OneBrain's vault-search domain; each version ships as its own repo and is sha256-pinned by the OneBrain CLI.
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
## Provenance
|
| 21 |
|
| 22 |
- Base: `BAAI/bge-reranker-v2-m3` (Apache-2.0)
|
|
@@ -24,6 +29,16 @@ The first entry in the **OneBrain model line** β the cross-encoder reranker us
|
|
| 24 |
- Quantization: dynamic int8 (QInt8 weights), onnxruntime 1.27.0, single-file output (`DefaultTensorType=FLOAT` for >2GB shape-inference skip)
|
| 25 |
- `model_int8.onnx` β 569,011,484 bytes Β· sha256 `dd7b26f4a233732aefbe857bef026050582dc7c1bdb8aeda909080bf15b2ad88`
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
## Validation (int8 vs fp32, sigmoid(logit))
|
| 28 |
|
| 29 |
| pair | fp32 | int8 | delta |
|
|
@@ -36,9 +51,29 @@ The first entry in the **OneBrain model line** β the cross-encoder reranker us
|
|
| 36 |
|
| 37 |
Pairwise ranking identical to fp32; max delta 0.0046.
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
## Usage
|
| 40 |
|
| 41 |
-
Consumed automatically by the OneBrain CLI (`onebrain search`) β the model downloads on first `reindex` and is verified against the pinned sha256.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
## License
|
| 44 |
|
|
|
|
| 17 |
|
| 18 |
**v1 is not fine-tuned.** It is a size/speed-optimized int8 build of [BAAI/bge-reranker-v2-m3](https://huggingface.co/BAAI/bge-reranker-v2-m3) (Apache-2.0). Future versions (v2+) may be fine-tuned for OneBrain's vault-search domain; each version ships as its own repo and is sha256-pinned by the OneBrain CLI.
|
| 19 |
|
| 20 |
+
## Intended use
|
| 21 |
+
|
| 22 |
+
- **For:** reranking a small set of `(query, passage)` candidates returned by a first-stage retriever (BM25 / vector), producing a calibrated 0β1 relevance score. This is the Tier-2 precision stage of OneBrain native search.
|
| 23 |
+
- **Not for:** retrieval or embedding β it scores queryβpassage pairs, it does not produce vectors. It is a general (not domain-fine-tuned) reranker, so it is not tuned for any specialized corpus in v1.
|
| 24 |
+
|
| 25 |
## Provenance
|
| 26 |
|
| 27 |
- Base: `BAAI/bge-reranker-v2-m3` (Apache-2.0)
|
|
|
|
| 29 |
- Quantization: dynamic int8 (QInt8 weights), onnxruntime 1.27.0, single-file output (`DefaultTensorType=FLOAT` for >2GB shape-inference skip)
|
| 30 |
- `model_int8.onnx` β 569,011,484 bytes Β· sha256 `dd7b26f4a233732aefbe857bef026050582dc7c1bdb8aeda909080bf15b2ad88`
|
| 31 |
|
| 32 |
+
## Why int8?
|
| 33 |
+
|
| 34 |
+
OneBrain runs **local-first and CPU-only** (no GPU assumption; Raspberry-Pi-class hardware is the floor). A cross-encoder scores every candidate at query time, so both download size and CPU latency matter:
|
| 35 |
+
|
| 36 |
+
- **Size** β the fp32 ONNX export is 2.27 GB; this int8 build is 569 MB (~4Γ smaller). That is the difference between a reranker most users won't download and one that can ship on by default.
|
| 37 |
+
- **CPU latency** β dynamic-QInt8 integer kernels run faster on CPU. OneBrain's design target is β€500 ms P50 for the Tier-2 stage on a warm daemon at the default candidate depth (a design target, not a published benchmark β no measured latency number is claimed here).
|
| 38 |
+
- **Quality cost β negligible** β quantization perturbs the raw logits slightly, but reranking only needs relative ordering and calibrated separation, both preserved. On the validation pairs below the sigmoid-score delta vs fp32 is β€ 0.0046 and the pairwise ranking is identical.
|
| 39 |
+
|
| 40 |
+
int8 is **not** more accurate than fp32 β it is the same weights at ~ΒΌ the size and lower CPU cost, with quality loss small enough to be irrelevant for ranking. That trade is what makes cross-encoder reranking viable on the hardware OneBrain targets.
|
| 41 |
+
|
| 42 |
## Validation (int8 vs fp32, sigmoid(logit))
|
| 43 |
|
| 44 |
| pair | fp32 | int8 | delta |
|
|
|
|
| 51 |
|
| 52 |
Pairwise ranking identical to fp32; max delta 0.0046.
|
| 53 |
|
| 54 |
+
## Calibration (OneBrain vault golden set)
|
| 55 |
+
|
| 56 |
+
Measured with the int8 model on **OneBrain's internal golden set** β a ~585-note personal Obsidian vault (Thai/English mixed), 20 answerable + 10 known-no-answer queries. This is an internal evaluation on one real vault, **not** a public benchmark (MTEB/BEIR/MIRACL were not run).
|
| 57 |
+
|
| 58 |
+
| bucket | top-hit sigmoid score |
|
| 59 |
+
|---|---|
|
| 60 |
+
| genuine relevant match | **0.73 β 0.99** |
|
| 61 |
+
| tangential / weak match | 0.20 β 0.52 |
|
| 62 |
+
| genuine no-answer query | **0.003 β 0.066** (median 0.011) |
|
| 63 |
+
|
| 64 |
+
The cross-encoder separates real matches from no-answer queries by ~an order of magnitude β the property a bi-encoder's overlapping cosine scores cannot provide, and the reason Tier-2 exists. OneBrain uses these measured bands: `> 0.60` confident, `0.30 β 0.60` possible, `< 0.30` no strong match (default gate `0.30`).
|
| 65 |
+
|
| 66 |
## Usage
|
| 67 |
|
| 68 |
+
Consumed automatically by the OneBrain CLI (`onebrain search`) β the model downloads on first `reindex` and is verified against the pinned sha256. Direct use: tokenize `(query, passage)` with the included tokenizer (`max_length` 512), feed `input_ids` + `attention_mask` (int64) β `logits [batch, 1]` (raw logit; apply sigmoid for a 0β1 relevance score). Multilingual (Thai/English first-class) is inherited from the `bge-reranker-v2-m3` base.
|
| 69 |
+
|
| 70 |
+
## Limitations
|
| 71 |
+
|
| 72 |
+
- **Not fine-tuned (v1):** a size/speed-optimized build of a general reranker, not adapted to any specific domain.
|
| 73 |
+
- **Evaluation scope:** validated on OneBrain's internal vault golden set, not on public reranking benchmarks β no MTEB/BEIR/MIRACL scores are claimed.
|
| 74 |
+
- **512-token input:** longer passages are truncated; OneBrain chunks documents upstream so the reranker sees chunk-sized passages.
|
| 75 |
+
- **int8 perturbation:** quantization shifts logits slightly vs fp32 (β€ 0.0046 on the validation pairs) β negligible for ranking, but present.
|
| 76 |
+
- **CPU-oriented:** optimized for CPU int8 inference; users who need maximum fidelity on GPU may prefer the fp32 base model.
|
| 77 |
|
| 78 |
## License
|
| 79 |
|