Feature Extraction
Transformers
Safetensors
lfm2
fill-mask
encoder-only
multimodal
image-text-retrieval
image-text-matching
siglip2
lfm2.5
gptq
custom_code
compressed-tensors
Instructions to use konic-labs/LFM2.5-multimodal-encoder-230M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use konic-labs/LFM2.5-multimodal-encoder-230M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="konic-labs/LFM2.5-multimodal-encoder-230M", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("konic-labs/LFM2.5-multimodal-encoder-230M", trust_remote_code=True) model = AutoModelForMaskedLM.from_pretrained("konic-labs/LFM2.5-multimodal-encoder-230M", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Document GPTQ compression and size comparison
Browse filesRename-facing model card update with GPTQ settings, calibration, artifact sizes, and base-model comparison.
README.md
CHANGED
|
@@ -57,18 +57,15 @@ retrieval evaluation, the candidate caption is never provided to the image branc
|
|
| 57 |
Clone the repository and install the tested runtime dependencies:
|
| 58 |
|
| 59 |
```bash
|
| 60 |
-
git clone https://huggingface.co/konic-labs/
|
| 61 |
-
cd
|
| 62 |
|
| 63 |
-
pip install torch transformers pillow accelerate safetensors
|
| 64 |
```
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
```bash
|
| 70 |
-
export PYTHONPATH="$PWD/vendor:$PWD:$PYTHONPATH"
|
| 71 |
-
```
|
| 72 |
|
| 73 |
The SigLIP2 vision model is downloaded from Hugging Face on first use. Run one image-text
|
| 74 |
matching example:
|
|
@@ -111,7 +108,6 @@ experiments.
|
|
| 111 |
| `recipe.yaml` | Quantization recipe |
|
| 112 |
| `run_multimodal.py` | Local image-text inference example |
|
| 113 |
| `evaluation/` | Saved metrics and deep-evaluation summaries |
|
| 114 |
-
| `vendor/` | Tested compressed-tensors runtime source |
|
| 115 |
|
| 116 |
## Evaluation
|
| 117 |
|
|
@@ -155,17 +151,48 @@ Cyclic-negative matching AUROC is `0.9733` on MONET. Text-nearest hard-negative
|
|
| 155 |
is `0.4961`, so the current model is substantially better at coarse compatibility than
|
| 156 |
fine-grained semantic discrimination.
|
| 157 |
|
| 158 |
-
## Compression and
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
|
| 160 |
| Metric | GPTQ INT4 |
|
| 161 |
|---|---:|
|
| 162 |
-
| Artifact size | approximately 370 MB |
|
| 163 |
| Hidden cosine versus BF16 | 0.9427 |
|
| 164 |
| Logit cosine versus BF16 | 0.9654 |
|
| 165 |
| Multimodal latency, batch 4 | 45.7 ms on NVIDIA L4 |
|
|
|
|
| 166 |
|
| 167 |
The current GPTQ backend is intended primarily for weight-size reduction. Native BF16
|
| 168 |
-
is faster in the tested environment.
|
| 169 |
|
| 170 |
## Limitations
|
| 171 |
|
|
|
|
| 57 |
Clone the repository and install the tested runtime dependencies:
|
| 58 |
|
| 59 |
```bash
|
| 60 |
+
git clone https://huggingface.co/konic-labs/LFM2.5-multimodal-encoder-230M
|
| 61 |
+
cd LFM2.5-multimodal-encoder-230M
|
| 62 |
|
| 63 |
+
pip install torch transformers pillow accelerate safetensors compressed-tensors
|
| 64 |
```
|
| 65 |
|
| 66 |
+
GPTQ loading requires a `compressed-tensors` installation compatible with the model
|
| 67 |
+
configuration. The tested quantization details are recorded in `recipe.yaml` and
|
| 68 |
+
`compression_manifest.json`.
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
The SigLIP2 vision model is downloaded from Hugging Face on first use. Run one image-text
|
| 71 |
matching example:
|
|
|
|
| 108 |
| `recipe.yaml` | Quantization recipe |
|
| 109 |
| `run_multimodal.py` | Local image-text inference example |
|
| 110 |
| `evaluation/` | Saved metrics and deep-evaluation summaries |
|
|
|
|
| 111 |
|
| 112 |
## Evaluation
|
| 113 |
|
|
|
|
| 151 |
is `0.4961`, so the current model is substantially better at coarse compatibility than
|
| 152 |
fine-grained semantic discrimination.
|
| 153 |
|
| 154 |
+
## Compression details and size comparison
|
| 155 |
+
|
| 156 |
+
The released LFM2.5 body uses GPTQ INT4 W4A16 compression:
|
| 157 |
+
|
| 158 |
+
| Compression setting | Value |
|
| 159 |
+
|---|---|
|
| 160 |
+
| Method | GPTQ INT4 |
|
| 161 |
+
| Weight/activation format | W4A16 |
|
| 162 |
+
| Quantized layers | Linear layers; `lm_head` excluded |
|
| 163 |
+
| Block size | 128 |
|
| 164 |
+
| Activation order | Static |
|
| 165 |
+
| Dampening fraction | 0.01 |
|
| 166 |
+
| Calibration | 256 fused multimodal `inputs_embeds` samples |
|
| 167 |
+
| Maximum calibration sequence length | 160 tokens |
|
| 168 |
+
| Compressor revision | `8cec0acc1931de6f8f73257151ab7007c14dbf4e` |
|
| 169 |
+
|
| 170 |
+
The calibration samples contained actual projected visual tokens rather than text-only
|
| 171 |
+
inputs, so the quantization pass reflects the multimodal path.
|
| 172 |
+
|
| 173 |
+
### Storage comparison
|
| 174 |
+
|
| 175 |
+
| Artifact | Model weights | Full package | Relative to original package |
|
| 176 |
+
|---|---:|---:|---:|
|
| 177 |
+
| Original LFM2.5 Encoder 230M FP32 | 918.79 MB | 923.65 MB | 100% |
|
| 178 |
+
| Clean BF16 reference | 459.40 MB | 474.81 MB | 51.4% |
|
| 179 |
+
| Clean GPTQ INT4 release | 355.03 MB | 370.46 MB | 40.1% |
|
| 180 |
+
|
| 181 |
+
The GPTQ release is approximately **59.9% smaller than the original package** and
|
| 182 |
+
**22.0% smaller than the clean BF16 package**. The external SigLIP2 vision tower is not
|
| 183 |
+
included in these sizes and is downloaded separately.
|
| 184 |
+
|
| 185 |
+
### Fidelity and runtime
|
| 186 |
|
| 187 |
| Metric | GPTQ INT4 |
|
| 188 |
|---|---:|
|
|
|
|
| 189 |
| Hidden cosine versus BF16 | 0.9427 |
|
| 190 |
| Logit cosine versus BF16 | 0.9654 |
|
| 191 |
| Multimodal latency, batch 4 | 45.7 ms on NVIDIA L4 |
|
| 192 |
+
| Peak multimodal VRAM | 2.38 GiB on NVIDIA L4 |
|
| 193 |
|
| 194 |
The current GPTQ backend is intended primarily for weight-size reduction. Native BF16
|
| 195 |
+
is faster and uses less runtime VRAM in the tested environment.
|
| 196 |
|
| 197 |
## Limitations
|
| 198 |
|