Upload README.md with huggingface_hub
Browse files
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 |
-
-
|
| 11 |
-
-
|
| 12 |
-
-
|
| 13 |
- ja
|
| 14 |
-
-
|
| 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 |
|
| 40 |
-
|------|------|------
|
| 41 |
-
| `lfm2-colbert-f32.gguf` | 677 MB |
|
| 42 |
-
| `lfm2-colbert-q8_0.gguf` | 361 MB |
|
| 43 |
-
| `lfm2-colbert-q5_k.gguf` | 258 MB |
|
| 44 |
-
| `lfm2-colbert-q4_k.gguf` | 224 MB |
|
| 45 |
|
| 46 |
-
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
- **
|
| 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**:
|
| 55 |
- **Task prefixes**: `"query: "` for queries, `"document: "` for passages
|
| 56 |
|
| 57 |
-
## Usage
|
| 58 |
-
|
| 59 |
-
### CLI
|
| 60 |
|
| 61 |
```bash
|
| 62 |
# ColBERT multi-vector encode
|
| 63 |
-
./crispembed -m lfm2-colbert-q8_0.gguf --colbert "
|
| 64 |
|
| 65 |
# JSON output (per-token vectors)
|
| 66 |
./crispembed -m lfm2-colbert-q8_0.gguf --colbert --json "query: machine learning"
|
| 67 |
-
```
|
| 68 |
|
| 69 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
```python
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
model = crispembed.load("lfm2-colbert-q8_0.gguf")
|
| 75 |
|
| 76 |
-
|
| 77 |
-
assert model.has_colbert
|
| 78 |
-
print(f"ColBERT dim: {model.colbert_dim()}") # 128
|
| 79 |
|
| 80 |
-
#
|
| 81 |
-
|
| 82 |
-
|
| 83 |
|
| 84 |
-
#
|
| 85 |
-
|
| 86 |
-
|
| 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::
|
| 97 |
assert!(model.has_colbert());
|
| 98 |
-
|
| 99 |
-
|
|
|
|
| 100 |
```
|
| 101 |
|
| 102 |
## Conversion
|
|
@@ -120,4 +112,8 @@ python models/convert-lfm2-embed-to-gguf.py \
|
|
| 120 |
|
| 121 |
## License
|
| 122 |
|
| 123 |
-
[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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).
|