1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! BERT encoder + cross-encoder reranking (GH-326).
//!
//! Sovereign-stack BERT inference for cross-encoder reranking models like
//! `BAAI/bge-reranker-base` and `cross-encoder/ms-marco-MiniLM-L-6-v2`.
//! No ONNX Runtime dependency — pure Rust + trueno SIMD.
//!
//! # Architecture
//!
//! ```text
//! Input: [CLS] query_tokens [SEP] passage_tokens [SEP]
//! ↓
//! BertEmbeddings (word + position + token_type → LayerNorm + Dropout)
//! ↓
//! BertEncoder (N × BertLayer, post-norm: attention → FFN)
//! ↓
//! CLS pooling (extract [CLS] hidden state)
//! ↓
//! Linear classifier head (hidden_dim → 1) → sigmoid
//! ↓
//! Relevance score ∈ [0, 1]
//! ```
//!
//! # Scope
//!
//! - **In scope**: encoder forward pass, cross-encoder scoring API,
//! dimension-correctness tests.
//! - **Out of scope** (separate tickets): HuggingFace-parity numerical
//! validation (requires reference activations), training, decoder-only
//! variants, batched cross-encoder scoring optimization.
pub use BertConfig;
pub use CrossEncoder;
pub use BertEmbeddings;
pub use BertEncoder;
pub use BertLayer;
pub use ;