Skip to content

Commit 52ccf19

Browse files
committed
docs(router): recommend nomic-embed-text-v1.5 over Longformer
llama.cpp doesn't support Longformer's sliding-window + global attention pattern — confirmed by grepping convert_hf_to_gguf.py for LongformerModel (not present; supported encoder archs are Bert, DistilBert, Roberta, XLMRoberta, NomicBert, JinaBert, ModernBert, NeoBERT, EuroBert). For routing the dataset schema is encoder-agnostic; we just need SOME long-context sentence encoder. nomic-embed-text-v1.5 (NomicBert arch, 8192 native context, GGUF available, already in gallery/index.yaml) fits the bill and runs on the existing llama-cpp embedding path. Updates the model-editor description for router.embedding_model to surface nomic-embed-text-v1.5 as the default suggestion, with modernbert-embed-base / jina-embeddings-v3 as alternatives. Also corrects an inaccurate comment in routing_data.go that conflated Longformer's context length (4096 tokens) with embedding dimensionality (768) when justifying the 8MB scanner buffer. Assisted-by: claude-code:claude-opus-4-7 [Edit] [Bash] Signed-off-by: Richard Palethorpe <io@richiejp.com>
1 parent a73459b commit 52ccf19

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

core/config/meta/registry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ func DefaultRegistry() map[string]FieldMetaOverride {
416416
"router.embedding_model": {
417417
Section: "other",
418418
Label: "Router Embedding Model",
419-
Description: "Embedding model for the KNN classifier — embeds both probe prompts and candidate exemplars. Required when classifier is 'knn'.",
419+
Description: "Embedding model for the KNN classifier — embeds both probe prompts and candidate exemplars. Required when classifier is 'knn'. A long-context sentence encoder works best; nomic-embed-text-v1.5 (NomicBert, 8192 ctx, GGUF via llama-cpp) is a good default. Other supported encoders include modernbert-embed-base and jina-embeddings-v3.",
420420
Component: "model-select",
421421
AutocompleteProvider: ProviderModels,
422422
Order: 232,

core/services/routing/router/routing_data.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,12 @@ func LoadRoutingDataset(path string) (*RoutingDataset, error) {
100100

101101
ds := &RoutingDataset{}
102102
scanner := bufio.NewScanner(f)
103-
// Default scanner buffer maxes at 64KB; routing rows with
104-
// inline embeddings can exceed that easily (a 4096-D Longformer
105-
// row is ~50KB of float JSON alone). Bump to 8MB per line.
103+
// Default scanner buffer maxes at 64KB. A row with an inline
104+
// pre-computed embedding can blow past that — a 1024-D
105+
// jina-v3 vector serialised as JSON is already ~10KB; some
106+
// models output 4096-D. Bump to 8MB per line with the same
107+
// 64KB initial allocation, so small rows don't pay the
108+
// memory cost up front.
106109
scanner.Buffer(make([]byte, 0, 64*1024), 8*1024*1024)
107110

108111
lineNum := 0

0 commit comments

Comments
 (0)