> ## Documentation Index
> Fetch the complete documentation index at: https://liquidai-example-leonie-demo.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# LFM2-ColBERT-350M

> 350M ColBERT retrieval model (deprecated - use LFM2.5-ColBERT-350M instead)

<a href="/lfm/models/liquid-nanos" className="back-button">← Back to Liquid Nanos</a>

<Warning>
  This model is deprecated. Use [LFM2.5-ColBERT-350M](/lfm/models/lfm25-colbert-350m) for improved multilingual retrieval and reranking.
</Warning>

LFM2-ColBERT-350M generates dense embeddings for document retrieval and reranking using the ColBERT late-interaction architecture. It supports 8 languages and excels at semantic search tasks.

<div style={{display: 'flex', gap: '0.5rem', margin: '0.5rem 0 1.5rem 0'}}>
  <a href="https://huggingface.co/LiquidAI/LFM2-ColBERT-350M" style={{padding: '0.35rem 0.7rem', borderRadius: '4px', fontSize: '0.85rem', fontWeight: 600, textDecoration: 'none', backgroundColor: '#fbbf24'}}><span style={{color: '#000'}}>HF</span></a>
</div>

## Specifications

| Property              | Value      |
| --------------------- | ---------- |
| Parameters            | 353M       |
| Context Length        | 32K tokens |
| Document Length       | 512 tokens |
| Query Length          | 32 tokens  |
| Output Dimensionality | 128        |
| Similarity Function   | MaxSim     |

**Supported Languages:** English, Arabic, Chinese, French, German, Japanese, Korean, Spanish

<div className="use-cases">
  <CardGroup cols={3}>
    <Card title="Semantic Search" icon="magnifying-glass">
      Multi-language retrieval
    </Card>

    <Card title="Reranking" icon="ranking-star">
      Score retrieved documents
    </Card>

    <Card title="RAG Pipeline" icon="diagram-project">
      Retrieval for generation
    </Card>
  </CardGroup>
</div>

## Quick Start

<Warning>
  This model uses PyLate for inference, not standard Transformers or llama.cpp.
</Warning>

<Tabs>
  <Tab title="PyLate">
    **Install:**

    ```bash theme={null}
    pip install -U pylate
    ```

    **Indexing Documents:**

    ```python theme={null}
    from pylate import indexes, models, retrieve

    # Load the ColBERT model
    model = models.ColBERT(
        model_name_or_path="LiquidAI/LFM2-ColBERT-350M",
    )
    model.tokenizer.pad_token = model.tokenizer.eos_token

    # Initialize the PLAID index
    index = indexes.PLAID(
        index_folder="pylate-index",
        index_name="index",
        override=True,
    )

    # Encode and index documents
    documents_ids = ["1", "2", "3"]
    documents = ["document 1 text", "document 2 text", "document 3 text"]

    documents_embeddings = model.encode(
        documents,
        batch_size=32,
        is_query=False,
        show_progress_bar=True,
    )

    index.add_documents(
        documents_ids=documents_ids,
        documents_embeddings=documents_embeddings,
    )
    ```

    **Retrieving Documents:**

    ```python theme={null}
    # Initialize retriever
    retriever = retrieve.ColBERT(index=index)

    # Encode queries
    queries_embeddings = model.encode(
        ["query for document 3", "query for document 1"],
        batch_size=32,
        is_query=True,
        show_progress_bar=True,
    )

    # Retrieve top-k documents
    scores = retriever.retrieve(
        queries_embeddings=queries_embeddings,
        k=10,
    )
    ```

    **Reranking:**

    ```python theme={null}
    from pylate import rank, models

    queries = ["query A", "query B"]
    documents = [
        ["document A", "document B"],
        ["document 1", "document C", "document B"],
    ]
    documents_ids = [[1, 2], [1, 3, 2]]

    model = models.ColBERT(
        model_name_or_path="LiquidAI/LFM2-ColBERT-350M",
    )

    queries_embeddings = model.encode(queries, is_query=True)
    documents_embeddings = model.encode(documents, is_query=False)

    reranked_documents = rank.rerank(
        documents_ids=documents_ids,
        queries_embeddings=queries_embeddings,
        documents_embeddings=documents_embeddings,
    )
    ```
  </Tab>
</Tabs>
