cstr commited on
Commit
c66f75e
·
verified ·
1 Parent(s): f4f41ca

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +133 -0
README.md ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: LiquidAI/LFM2.5-Embedding-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-Embedding-350M/blob/main/LICENSE
18
+ tags:
19
+ - gguf
20
+ - embedding
21
+ - retrieval
22
+ - text-embeddings-inference
23
+ - crispembed
24
+ ---
25
+
26
+ # LFM2.5-Embedding-350M — CrispEmbed GGUF
27
+
28
+ CrispEmbed-native GGUF quantizations of [LiquidAI/LFM2.5-Embedding-350M](https://huggingface.co/LiquidAI/LFM2.5-Embedding-350M).
29
+
30
+ **Format note:** These GGUFs use CrispEmbed's internal tensor naming (`lfm.*` prefix, arch=`lfm2`). They are **not** interchangeable with the [official LiquidAI GGUFs](https://huggingface.co/LiquidAI/LFM2.5-Embedding-350M-GGUF) which target llama.cpp (`lfm2-bidir` arch, `blk.*` tensor naming). Use the LiquidAI GGUFs if you want llama.cpp/llama-server.
31
+
32
+ ---
33
+
34
+ ## Files
35
+
36
+ | File | Size | Description |
37
+ |------|------|-------------|
38
+ | `lfm2-embed-q8_0.gguf` | 359 MB | 8-bit quantization — best accuracy, recommended |
39
+ | `lfm2-embed-q4_k.gguf` | 222 MB | 4-bit K-quant — 3× compression, minimal quality loss |
40
+ | `lfm2-embed-f16.gguf` | 678 MB | Full fp16 — reference precision |
41
+
42
+ ## Parity (CrispEmbed q8_0 vs HF float32 `Lfm2BidirectionalModel`)
43
+
44
+ | Stage | Cosine | Notes |
45
+ |-------|--------|-------|
46
+ | per-layer (all 20) | ≥ 0.9999 | measured on 3-token input via test-lfm2-diff |
47
+ | CLS embedding q8_0 | **0.9999** | 5 diverse test sentences |
48
+ | CLS embedding q4_k | **0.982** | expected q4_k quantization floor |
49
+
50
+ ## Model
51
+
52
+ - **Architecture**: 16-layer hybrid (10 ShortConv + 6 GQA attention), hidden=1024
53
+ - **Pooling**: CLS token (position 0) of last hidden state, L2-normalized
54
+ - **Dimension**: 1024
55
+ - **Languages**: 11 (en, de, fr, es, it, pt, nl, pl, ru, ja, zh)
56
+ - **Parameters**: 350M
57
+ - **Task prefixes**: `"query: "` for queries, `"document: "` for passages
58
+
59
+ ## Usage with CrispEmbed
60
+
61
+ ### CLI
62
+
63
+ ```bash
64
+ # Download
65
+ ./crispembed --download lfm2-embed
66
+
67
+ # Embed a query (prefix auto-applied)
68
+ ./crispembed -m ~/.cache/crispembed/lfm2-embed-q8_0.gguf "What is the capital of France?"
69
+
70
+ # Embed a document (disable auto-prefix and supply explicitly, or use --prefix)
71
+ ./crispembed -m ~/.cache/crispembed/lfm2-embed-q8_0.gguf \
72
+ --prefix "document: " "Paris is the capital of France."
73
+
74
+ # JSON output for downstream use
75
+ ./crispembed -m ~/.cache/crispembed/lfm2-embed-q8_0.gguf --json "query: machine learning"
76
+ ```
77
+
78
+ ### Python (via [crispembed Python bindings](https://github.com/CrispStrobe/CrispEmbed))
79
+
80
+ ```python
81
+ import crispembed
82
+
83
+ model = crispembed.load("~/.cache/crispembed/lfm2-embed-q8_0.gguf")
84
+
85
+ query_emb = model.encode("query: What is the capital of France?")
86
+ doc_emb = model.encode("document: Paris is the capital of France.")
87
+
88
+ import numpy as np
89
+ score = np.dot(query_emb, doc_emb) # both are already L2-normalized
90
+ print(f"Similarity: {score:.4f}")
91
+ ```
92
+
93
+ ### Rust
94
+
95
+ ```rust
96
+ use crispembed::CrispEmbed;
97
+
98
+ let model = CrispEmbed::load("lfm2-embed-q8_0.gguf")?;
99
+ let emb = model.encode("query: hello world")?;
100
+ ```
101
+
102
+ ## Comparison with official LiquidAI GGUFs
103
+
104
+ | | This repo | [LiquidAI/LFM2.5-Embedding-350M-GGUF](https://huggingface.co/LiquidAI/LFM2.5-Embedding-350M-GGUF) |
105
+ |---|---|---|
106
+ | Runtime | [CrispEmbed](https://github.com/CrispStrobe/CrispEmbed) | llama.cpp / llama-server |
107
+ | GGUF arch tag | `lfm2` | `lfm2-bidir` |
108
+ | Tensor naming | `lfm.*` prefix | `blk.*` / llama.cpp convention |
109
+ | Quantizations | f16, q8_0, q4_k | BF16, F16, Q4_0, Q4_K_M, Q5_K_M, Q6_K, Q8_0 |
110
+ | q8_0 size | 359 MB | 379 MB |
111
+ | Metal GPU | Yes (Apple Silicon) | Yes |
112
+
113
+ ## Conversion
114
+
115
+ Convert from the source model yourself:
116
+
117
+ ```bash
118
+ git clone https://github.com/CrispStrobe/CrispEmbed
119
+ cd CrispEmbed
120
+
121
+ # Download source
122
+ python models/convert-lfm2-embed-to-gguf.py \
123
+ --model LiquidAI/LFM2.5-Embedding-350M \
124
+ --output lfm2-embed-f16.gguf --dtype f16
125
+
126
+ # Quantize
127
+ ./build/crispembed-quantize lfm2-embed-f16.gguf lfm2-embed-q8_0.gguf q8_0
128
+ ./build/crispembed-quantize lfm2-embed-f16.gguf lfm2-embed-q4_k.gguf q4_k
129
+ ```
130
+
131
+ ## License
132
+
133
+ [LFM1.0](https://huggingface.co/LiquidAI/LFM2.5-Embedding-350M/blob/main/LICENSE) — same as the base model.