[Image blocked: Perplexity Logo]
pplx-embed-v2-context: Multimodal Contextual Embeddings
pplx-embed-v2-context-9b is a state-of-the-art vision-language embedding model for retrieval over text, images, and visual documents.
It supports contextual and non-contextual embeddings: In contextual mode, the model embeds chunks of a document with the surrounding context in view. In non-contextual mode, text inputs are embedded in isolation.
Its 1024-dimensional MRL prefix shares an embedding space with pplx-embed-v2-context-0.6b. Documents can be embedded with one model and queried with another.
This model also supports contextual chunking for visual inputs. Chunked images can be retrieved via standard dense ANN indices. Chunking images can substantially improve retrieval performance.
For benchmark results and details on training, refer to our technical report.
[!IMPORTANT]
When encoding chunks in contextual mode, the document chunks should be non-overlapping.
[!IMPORTANT]
Queries and documents are encoded with different methods: use encode_queries for queries and encode for document chunks. The model is trained with separate query and document prefixes, and encoding queries with encode silently degrades retrieval quality.
[!IMPORTANT]
Like pplx-embed-context-v1, the model natively produces unnormalized int8-quantized embeddings. Compare embeddings with cosine similarity, or pass normalize_embeddings=True and use the dot product.
Text Embeddings
Requires transformers>=5.4.0, torch, numpy, safetensors, tqdm, Pillow, and torchvision. Install flash-linear-attention and causal-conv1d for the fast linear-attention path. The model uses custom code, so load it with trust_remote_code=True.
encode(documents, ...) and encode_queries(queries, ...) accept:
The text API does not truncate inputs. Split or truncate documents that exceed
the configured input length before encoding. To obtain one embedding per
document, pass each document as a single-chunk list.
Matryoshka dimensions
The model was trained with Matryoshka losses at 1024 and 2048 dimensions. To use 1024-dimensional embeddings, take the first 1024 values of each unnormalized embedding and normalize afterwards:
Apply the same truncation and normalization to image embeddings and query
embeddings. Use 1024 dimensions when comparing against embeddings from the
0.6B model. Other truncation sizes were not trained.
Image Embeddings
Use encode_images() to embed document pages or other images as contextual
chunks. Pass a list of PIL images; each image produces one embedding per
horizontal band. Use encode_queries() for the corresponding text queries.
Each image is encoded in one contextual forward pass, with its merged visual
tokens divided into whole-row horizontal bands. Native three-axis MRoPE and image
wrappers are preserved. Separator tokens between bands use the midpoint of the
adjacent rows and the horizontal center of the image as their spatial position.
Only visual content is pooled; prefixes, wrappers, and separators are excluded.
encode_images() returns one (actual_chunks, 2048) array per page. The actual
chunk count is capped at the number of merged image rows.
Use cosine similarity per chunk and the maximum chunk score
for page retrieval, as shown above with normalized vectors.
The image API also accepts normalize_embeddings, convert_to_numpy,
show_progress_bar, and device with the defaults listed above.
prepare_images(images, chunks=8, min_pixels=16384, max_pixels=1800000) exposes
the input tensors, chunk spans, masks, and position IDs without running the model.
Citation