cstr commited on
Commit
8e5b812
·
verified ·
1 Parent(s): f4da337

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +53 -57
README.md CHANGED
@@ -1,27 +1,28 @@
1
  ---
 
 
 
2
  base_model: LiquidAI/LFM2.5-ColBERT-350M
 
 
 
 
 
 
 
 
3
  language:
4
  - en
 
5
  - de
6
  - fr
7
- - es
8
  - it
9
  - pt
10
- - nl
11
- - pl
12
- - ru
13
  - ja
14
- - zh
15
- license: other
16
- license_name: lfm1.0
17
- license_link: https://huggingface.co/LiquidAI/LFM2.5-ColBERT-350M/blob/main/LICENSE
18
- tags:
19
- - gguf
20
- - colbert
21
- - multi-vector
22
- - retrieval
23
- - text-embeddings-inference
24
- - crispembed
25
  ---
26
 
27
  # LFM2.5-ColBERT-350M — CrispEmbed GGUF
@@ -32,71 +33,62 @@ Multi-vector (ColBERT-style) retrieval: per-token embeddings projected to 128 di
32
 
33
  **Format note:** These GGUFs use CrispEmbed's internal tensor naming (`lfm.*` prefix, arch=`lfm2`). They include the `colbert.projection.weight` tensor from the `1_Dense` module. **Not** compatible with llama.cpp.
34
 
35
- ---
36
-
37
- ## Files
38
 
39
- | File | Size | Compression | ColBERT cos vs fp16 |
40
- |------|------|-------------|---------------------|
41
- | `lfm2-colbert-f32.gguf` | 677 MB | 1.0x | **0.999995** |
42
- | `lfm2-colbert-q8_0.gguf` | 361 MB | 1.9x | **0.998** |
43
- | `lfm2-colbert-q5_k.gguf` | 258 MB | 2.6x | **0.977** |
44
- | `lfm2-colbert-q4_k.gguf` | 224 MB | 3.0x | **0.959** |
45
 
46
- **Recommendation:** Use Q8_0 for best accuracy/size trade-off. The LFM2 hybrid conv+attention architecture is sensitive to aggressive quantization (similar to NomicBERT SwiGLU layers). Q5_K/Q4_K produce usable vectors but with noticeable degradation.
47
 
48
- ## Model
49
-
50
- - **Architecture**: 16-layer hybrid (10 ShortConv + 6 GQA attention), hidden=1024
51
- - **Output**: Per-token embeddings projected to **128d** via ColBERT projection head
52
- - **Scoring**: Late interaction (MaxSim) — sum of per-query-token max cosine similarities
53
  - **Parameters**: 350M + 128K projection head
54
- - **Languages**: 11 (en, de, fr, es, it, pt, nl, pl, ru, ja, zh)
55
  - **Task prefixes**: `"query: "` for queries, `"document: "` for passages
56
 
57
- ## Usage with CrispEmbed
58
-
59
- ### CLI
60
 
61
  ```bash
62
  # ColBERT multi-vector encode
63
- ./crispembed -m lfm2-colbert-q8_0.gguf --colbert "What is the capital of France?"
64
 
65
  # JSON output (per-token vectors)
66
  ./crispembed -m lfm2-colbert-q8_0.gguf --colbert --json "query: machine learning"
67
- ```
68
 
69
- ### Python
 
 
 
 
70
 
71
  ```python
72
- import crispembed
73
-
74
- model = crispembed.load("lfm2-colbert-q8_0.gguf")
75
 
76
- # Check ColBERT capability
77
- assert model.has_colbert()
78
- print(f"ColBERT dim: {model.colbert_dim()}") # 128
79
 
80
- # Multi-vector encode
81
- q_vecs = model.encode_multivec("query: What is the capital of France?")
82
- d_vecs = model.encode_multivec("document: Paris is the capital of France.")
83
 
84
- # Late interaction (MaxSim) scoring
85
- import numpy as np
86
- sim_matrix = q_vecs @ d_vecs.T # [n_q_tokens, n_d_tokens]
87
- score = sim_matrix.max(axis=1).sum()
88
- print(f"MaxSim score: {score:.4f}")
89
  ```
90
 
91
- ### Rust
92
-
93
  ```rust
94
  use crispembed::CrispEmbed;
95
 
96
- let model = CrispEmbed::load("lfm2-colbert-q8_0.gguf")?;
97
  assert!(model.has_colbert());
98
- let vecs = model.encode_multivec("query: hello world")?;
99
- // vecs: Vec<Vec<f32>> one 128d vector per token
 
100
  ```
101
 
102
  ## Conversion
@@ -120,4 +112,8 @@ python models/convert-lfm2-embed-to-gguf.py \
120
 
121
  ## License
122
 
123
- [LFM1.0](https://huggingface.co/LiquidAI/LFM2.5-ColBERT-350M/blob/main/LICENSE) — same as the base model.
 
 
 
 
 
1
  ---
2
+ license: other
3
+ license_name: lfm-1.0
4
+ license_link: https://huggingface.co/LiquidAI/LFM2.5-350M/blob/main/LICENSE
5
  base_model: LiquidAI/LFM2.5-ColBERT-350M
6
+ tags:
7
+ - colbert
8
+ - retrieval
9
+ - multi-vector
10
+ - late-interaction
11
+ - gguf
12
+ - crispembed
13
+ - ggml
14
  language:
15
  - en
16
+ - es
17
  - de
18
  - fr
 
19
  - it
20
  - pt
21
+ - ar
22
+ - sv
23
+ - "no"
24
  - ja
25
+ - ko
 
 
 
 
 
 
 
 
 
 
26
  ---
27
 
28
  # LFM2.5-ColBERT-350M — CrispEmbed GGUF
 
33
 
34
  **Format note:** These GGUFs use CrispEmbed's internal tensor naming (`lfm.*` prefix, arch=`lfm2`). They include the `colbert.projection.weight` tensor from the `1_Dense` module. **Not** compatible with llama.cpp.
35
 
36
+ ## Model variants
 
 
37
 
38
+ | File | Quant | Size | ColBERT cos vs F32 |
39
+ |------|-------|------|--------------------|
40
+ | `lfm2-colbert-f32.gguf` | F32 | 677 MB | 0.999995 |
41
+ | `lfm2-colbert-q8_0.gguf` | Q8_0 | 361 MB | 0.998 |
42
+ | `lfm2-colbert-q5_k.gguf` | Q5_K | 258 MB | 0.977 |
43
+ | `lfm2-colbert-q4_k.gguf` | Q4_K | 224 MB | 0.959 |
44
 
45
+ ## Architecture
46
 
47
+ - **Backbone**: LFM2.5-350M bidirectional hybrid (16 layers: 10 ShortConv + 6 GQA attention, 1024-dim hidden, SwiGLU FFN)
48
+ - **ColBERT head**: Linear(1024, 128) + L2 normalize per token
49
+ - **Scoring**: MaxSim max over doc tokens of cosine similarity per query token, summed
 
 
50
  - **Parameters**: 350M + 128K projection head
51
+ - **Languages**: EN, ES, DE, FR, IT, PT, AR, SV, NO, JA, KO (11 languages)
52
  - **Task prefixes**: `"query: "` for queries, `"document: "` for passages
53
 
54
+ ## Usage
 
 
55
 
56
  ```bash
57
  # ColBERT multi-vector encode
58
+ ./crispembed -m lfm2-colbert-q8_0.gguf --colbert "query: what is deep learning?"
59
 
60
  # JSON output (per-token vectors)
61
  ./crispembed -m lfm2-colbert-q8_0.gguf --colbert --json "query: machine learning"
 
62
 
63
+ # Server
64
+ ./crispembed-server --embed lfm2-colbert-q8_0.gguf --port 8080
65
+ curl -X POST http://localhost:8080/colbert/score \
66
+ -d '{"query": "what is deep learning?", "documents": ["Deep learning is a subset of ML", "The weather is nice"]}'
67
+ ```
68
 
69
  ```python
70
+ from crispembed import CrispVit
 
 
71
 
72
+ model = CrispVit("lfm2-colbert-q8_0.gguf")
73
+ assert model.has_colbert
 
74
 
75
+ # Encode multi-vector representations
76
+ query_vecs = model.encode_multivec("query: what is deep learning?") # (n_tokens, 128)
77
+ doc_vecs = model.encode_multivec("document: Deep learning uses neural networks")
78
 
79
+ # MaxSim scoring
80
+ score = model.maxsim(query_vecs, doc_vecs)
81
+ print(f"Score: {score:.4f}")
 
 
82
  ```
83
 
 
 
84
  ```rust
85
  use crispembed::CrispEmbed;
86
 
87
+ let mut model = CrispEmbed::new("lfm2-colbert-q8_0.gguf", 4)?;
88
  assert!(model.has_colbert());
89
+
90
+ let query = model.encode_multivec("query: what is deep learning?");
91
+ let doc = model.encode_multivec("document: Neural networks learn representations");
92
  ```
93
 
94
  ## Conversion
 
112
 
113
  ## License
114
 
115
+ [LFM Open License v1.0](https://huggingface.co/LiquidAI/LFM2.5-350M/blob/main/LICENSE) — same as the base model.
116
+
117
+ ## Credits
118
+
119
+ Original model by [LiquidAI](https://huggingface.co/LiquidAI). GGUF conversion and inference engine by [CrispEmbed](https://github.com/CrispStrobe/CrispEmbed).