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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! Pure Rust encoder implementations using Candle.
//!
//! # Design Philosophy
//!
//! Pluggable encoder backends sharing a common trait:
//!
//! ```text
//! ┌─────────────────────────────────────────────┐
//! │ TextEncoder Trait │
//! │ fn encode(&self, text) -> Embeddings │
//! │ fn hidden_dim(&self) -> usize │
//! └──────────────────┬──────────────────────────┘
//! │
//! ┌───────────┴───────────┐
//! │ │
//! ┌──────▼──────┐ ┌──────▼──────┐
//! │ BertEncoder │ │ModernBertEnc│
//! │ 512 ctx │ │ 8192 ctx │
//! │ APE │ │ RoPE │
//! └─────────────┘ └─────────────┘
//! ```
//!
//! # Key Innovation: ModernBERT
//!
//! ModernBERT (late 2024) combines:
//! - 8192 token context (vs 512 for BERT)
//! - RoPE (Rotary Position Embeddings) for extrapolation
//! - GeGLU activation functions
//! - Unpadding for memory efficiency
//!
//! Reference: <https://arxiv.org/abs/2412.13663>
use crate::;
use ;
use Tokenizer;
/// Encoder configuration types and defaults.
pub use *;
/// Encoder backend implementations (Candle, stubs).
pub use ;
// =============================================================================
// Stub for non-candle builds
// =============================================================================
;
// =============================================================================
// Tests
// =============================================================================