Skip to content
Late-Interaction Retrieval With Perplexity's New Embeddings — ContentBuffer guide

Late-Interaction Retrieval With Perplexity's New Embeddings

K
Kodetra Technologies··10 min read Intermediate

Summary

Build a ColBERT-style MaxSim search over text and images with pplx-embed-v2-late, verified code included.

On October 7, 2026 Perplexity released pplx-embed-v2-late, an open-weight retriever in 0.6B and 9B sizes. It is not a normal embedding model. Instead of squeezing a document into one vector, it keeps one 128-dimension vector per token and scores with MaxSim, the ColBERT recipe. It also reads page images, so a screenshot of a chart and a paragraph of text live in the same index.

Why care now? Single-vector search is where most RAG pipelines quietly lose answers: a long passage gets averaged into one point, and a short, specific query like an error code or a plan name drowns in the average. Late interaction keeps the detail. The new models are MIT-licensed on the 0.6B card, run through plain Sentence Transformers, and the two sizes share one embedding space, so you can index with the big model and query with the small one.

This guide builds the whole thing: encode, score, hand-roll MaxSim to see what the library does, write a small persistent index, add an image to it, and rerank a shortlist. Every snippet below was run against the real 0.6B checkpoint, and the outputs shown are what it printed.

Prerequisites

  • Python 3.10+ and basic NumPy/PyTorch comfort
  • About 3 GB of free disk for the 0.6B weights; a GPU helps but a CPU is fine for the demos here (load took about 9 seconds on CPU)
  • Familiarity with embeddings and cosine similarity; no ColBERT background needed
python -m venv .venv && source .venv/bin/activate
pip install -U "sentence-transformers[image]>=6.0.0" "transformers>=5.4.0" pillow numpy

Do not skip the [image] extra. The checkpoint ships a Qwen3-VL style processor, and without torchvision the load fails with Qwen3VLVideoProcessor requires the Torchvision library, even if you only plan to embed text. The model card asks for sentence-transformers >= 6.0.0 and transformers >= 5.4.0; I ran 6.1.0 and 5.19.0.

How late interaction differs from one vector per document

A classic bi-encoder turns a document into one vector and a query into one vector, then compares them with a dot product. Fast and compact, but the single vector has to represent everything the passage says.

Late interaction delays the comparison. The query becomes n vectors (one per token), the document becomes m vectors, and the score is: for each query token, find the most similar document token, then add those maxima up. That is MaxSim. A query word like Okta can lock onto SAML or OIDC in a document without the rest of the document diluting the match.

The cost is storage. A 30-token passage is a 30 x 128 matrix, which is 15,360 bytes in fp32 versus a few kilobytes for one 1024-dim vector. Plan for that; the fp16 trick later in the guide halves it.

Step 1: Encode and score

The API is two methods and a scorer. encode_query and encode_document add the model's query and document markers for you, and similarity runs MaxSim. Note that the model card says this model expects its markers first, unlike PyLate, which places them second, so do not mix tooling by hand-adding markers.

from sentence_transformers import MultiVectorEncoder

model = MultiVectorEncoder("perplexity-ai/pplx-embed-v2-late-0.6b", device="cpu")  # or "cuda"

docs = [
    "Refunds are issued within 5 business days to the original payment method. "
    "Card refunds can take up to 10 days to appear on your statement.",
    "To reset your password, open Settings, choose Security, then click Reset password.",
    "The API allows 600 requests per minute per key. Exceeding it returns HTTP 429.",
]
queries = ["how long until my money comes back", "what happens if I send too many requests"]

D = model.encode_document(docs)    # list of tensors, one (n_tokens, 128) per document
Q = model.encode_query(queries)    # same for queries

print([tuple(d.shape) for d in D])
print(model.similarity(Q, D))      # (n_queries, n_docs) MaxSim scores
[(30, 128), (19, 128), (28, 128)]
tensor([[6.67, 5.53, 6.44],
        [7.25, 5.60, 7.54]])

Both questions find their answer, but look at the numbers: scores are raw sums, not cosine values. The second query has more tokens, so its numbers run higher across the board. Row-to-row comparison is meaningless; compare scores only within one query's row.

Step 2: Re-implement MaxSim to see what is happening

Thirty seconds of PyTorch removes the mystery. This reproduces the library's score exactly.

import torch

def maxsim(q: torch.Tensor, d: torch.Tensor) -> float:
    sim = q.float() @ d.float().T      # (n_q, n_d) every query token vs every doc token
    return sim.max(dim=1).values.sum().item()   # best doc token per query token, summed

print(maxsim(Q[0], D[0]))   # 6.667834..., identical to model.similarity(Q, D)[0][0]

In my run the query 'how long until my money comes back' produced 8 vectors from 7 word-pieces (the extra one is the query marker), and the refund passage produced 30 vectors. Those 8 maxima summed to 6.6678, matching model.similarity to every printed digit.

Step 3: Build a small persistent index

A production system would use a vector database with multi-vector support, but a flat matrix is enough to understand the mechanics and to serve a few thousand passages. The class below stores every token vector in one fp16 array with offsets per document, and divides MaxSim by the query length so scores are comparable across queries.

import json
import numpy as np
from sentence_transformers import MultiVectorEncoder

class LateIndex:
    """Flat multi-vector store: one fp16 matrix holding every token vector, plus offsets."""
    def __init__(self, model):
        self.model, self.ids, self.offsets, self.mat = model, [], [0], None

    def add(self, ids, texts):
        vecs = self.model.encode_document(texts)
        chunks = [v.float().numpy().astype(np.float16) for v in vecs]
        for i, c in zip(ids, chunks):
            self.ids.append(i)
            self.offsets.append(self.offsets[-1] + len(c))
        new = np.concatenate(chunks)
        self.mat = new if self.mat is None else np.concatenate([self.mat, new])

    def search(self, query, k=3):
        q = self.model.encode_query([query])[0].float().numpy()    # (n_q, 128)
        sims = q @ self.mat.astype(np.float32).T                    # (n_q, total_tokens)
        scores = []
        for n, doc_id in enumerate(self.ids):
            a, b = self.offsets[n], self.offsets[n + 1]
            scores.append((doc_id, float(sims[:, a:b].max(1).sum() / len(q))))  # MaxSim / n_q
        return sorted(scores, key=lambda x: -x[1])[:k]

    def save(self, path):
        np.save(path + ".npy", self.mat)
        json.dump({"ids": self.ids, "offsets": self.offsets}, open(path + ".json", "w"))
model = MultiVectorEncoder("perplexity-ai/pplx-embed-v2-late-0.6b", device="cpu")
kb = {
  "refunds":  "Refunds are issued within 5 business days to the original payment method. Card refunds can take up to 10 days to appear on your statement.",
  "password": "To reset your password, open Settings, choose Security, then click Reset password. A link is emailed to you.",
  "limits":   "The API allows 600 requests per minute per key. Exceeding it returns HTTP 429 with a Retry-After header.",
  "invoices": "Invoices can be downloaded as PDF from the Billing page. Admins can also set a billing email.",
  "sso":      "Single sign-on supports SAML 2.0 and OIDC. Enable it under Organization, Authentication.",
}
ix = LateIndex(model)
ix.add(list(kb), list(kb.values()))

for q in ["how long until my money comes back", "what happens if I send too many requests",
          "log in with Okta", "where do I get a receipt"]:
    print(q, "->", ix.search(q, 2))
how long until my money comes back -> [('refunds', 0.833), ('limits', 0.805)]
what happens if I send too many requests -> [('limits', 0.838), ('refunds', 0.806)]
log in with Okta -> [('sso', 0.777), ('password', 0.755)]
where do I get a receipt -> [('invoices', 0.794), ('refunds', 0.779)]

The query 'log in with Okta' never mentions SSO, SAML or authentication, yet the SSO article wins. 'Where do I get a receipt' lands on invoices. A keyword engine would miss both, and with only five documents the gaps are small, so treat this as a smoke test rather than a benchmark. For real numbers, Perplexity reports ViDoRe v3 nDCG@10 of 62.3 percent (image) and 61.2 percent (markdown) for the 0.6B model, and 65.2 and 64.7 for the 9B.

I also checked the hand-built index against the library: for the SSO query the normalized score was 0.7768 in both. The stored matrix for these five passages was 115 x 128 in fp16, 29,440 bytes.

Step 4: Add pictures

The same model embeds images, so a scanned page, slide or chart can sit beside text passages. Pass PIL images converted to RGB to encode_document. Keep images and text in separate calls; the card says mixed batches are not supported.

from PIL import Image, ImageDraw

img = Image.new("RGB", (900, 500), "white")
ImageDraw.Draw(img).text((40, 40), "Q3 REVENUE BY REGION\nEMEA 42M   APAC 31M   AMER 77M", fill="black")
img.save("chart.png")

iv = model.encode_document([Image.open("chart.png").convert("RGB")])   # images in their own batch
q2 = model.encode_query(["which region had the highest revenue"])
print("image vectors:", tuple(iv[0].shape))
print("vs image:", model.similarity(q2, iv))
print("vs text docs:", model.similarity(q2, model.encode_document(list(kb.values()))))
image vectors: (451, 128)
vs image: tensor([[5.5600]])
vs text docs: tensor([[5.1074, 5.0316, 5.1346, 5.1016, 5.0966]])

A 900 x 500 picture became 451 vectors, roughly 15 times the footprint of a short text passage. The image won this query (5.56 versus about 5.1 for every text passage), even though the only 'text' in it was drawn pixels. That cross-modal comparability is the point of the shared space, but remember the cost: image pages are expensive to store, so budget for them.

Step 5: Index big, query small

Because the 0.6B and 9B checkpoints share one vector space, you can run the 9B model once, offline, to build the index, and serve live queries with the 0.6B model. I could only run the 0.6B checkpoint in the sandbox, so I did not reproduce the cross-size result myself; Perplexity and the coverage of the release both describe it, and it is worth testing on your own data before committing. If you try it, keep the query and index models fixed in your config and store the model name next to the vectors.

Step 6: Late interaction as a reranker

If storing every token vector is too heavy, use a cheap first stage (BM25 or a single-vector model) to fetch 50 to 200 candidates, then encode just those with the late model at query time. You pay compute instead of disk.

def rerank(query, candidates: dict, model, k=3):
    """candidates: {doc_id: text}. Encode only the shortlist at query time."""
    ids = list(candidates)
    Q = model.encode_query([query])
    D = model.encode_document([candidates[i] for i in ids])
    s = model.similarity(Q, D)[0] / Q[0].shape[0]
    return sorted(zip(ids, s.tolist()), key=lambda x: -x[1])[:k]

Worked example: support-bot retrieval

Take a help center with 2,000 articles. Plan: split each article into passages of 100 to 200 words, encode them in batches with encode_document, and save the fp16 matrix plus an offsets file. At roughly 1.2 tokens per word, a 150-word passage is about 180 vectors, so 20,000 passages come to around 3.6 million vectors, or 0.9 GB in fp16. That is fine in memory on a normal server, and it is the number to compute before you adopt any multi-vector system.

At query time, encode the question, compute MaxSim against the matrix, take the top five passages, and hand them to your LLM with the instruction to cite the passage id. If a flat scan becomes slow at that scale, move the first stage to an approximate method and keep MaxSim as the final scorer; do not drop MaxSim, since it is what makes the ranking sharp.

Common pitfalls

  • Missing torchvision. Install sentence-transformers[image] even for text-only use, or the load throws an ImportError about the video processor.
  • Comparing raw scores across queries. MaxSim sums one maximum per query token, so longer queries score higher. Divide by the number of query vectors, or only compare within a row.
  • Mixing text and images in one batch. Unsupported per the model card. Encode them separately and merge the results.
  • Adding markers by hand or porting PyLate settings. The encode methods add the markers; this model expects them first, not second.
  • Forgetting the fp32 cast. The checkpoint is F32 but if you move vectors to half precision, cast back to float32 before the matmul on CPU, as the index class does.
  • Underestimating storage. Tokens per passage times 128 times 2 bytes. Images are the big spender at hundreds of vectors each.
  • Mixing model versions in one index. Only the 0.6B and 9B variants of this release are stated to share a space. Do not mix them with another vendor's multi-vector model.
  • Trusting a five-document demo. Evaluate on your own queries and a labeled set before you replace an existing retriever.

Quick reference

ItemValue
Model IDsperplexity-ai/pplx-embed-v2-late-0.6b and -9b
ArchitectureColBERT-style late interaction, Qwen3.5 base with bidirectional attention
Vector size128 dims per token
ScoringMaxSim, via model.similarity(Q, D)
Load classsentence_transformers.MultiVectorEncoder
Query / docencode_query / encode_document
Requirementssentence-transformers >= 6.0.0, transformers >= 5.4.0, [image] extra
License (0.6B card)MIT
ViDoRe v3 nDCG@100.6B: 62.3 image, 61.2 markdown; 9B: 65.2 image, 64.7 markdown
Active params0.6B: about 340M; 9B: about 7.4B

Next steps

  • Swap the flat scan for a vector store with native multi-vector support once you pass a few hundred thousand passages
  • Run your own eval: take 50 real user questions, mark the right passage, and compare nDCG@10 against your current single-vector retriever
  • Test the index-with-9B, query-with-0.6B setup on your corpus and measure recall against all-9B
  • Add page images from your PDFs and see whether tables and charts become retrievable without OCR

Sources: the pplx-embed-v2-late-0.6b model card for API, requirements, license and benchmarks, and Crypto Briefing's coverage of the October 7, 2026 release for the training and shared-space claims.

Comments

Subscribe to join the conversation...

Be the first to comment

Found this useful?

Get new AI guides for builders by email. Free.

Join 3,617 newsletter subscribers.

Also get