Views
No views yet
pplx-embed-v1 and pplx-embed-context-v1 are state-of-the-art text embedding models optimized for real-world, web-scale retrieval tasks.pplx-embed-v1 for independent text embedding (queries, documents, semantic search)pplx-embed-context-v1 for document chunks in RAG systems where surrounding context matters[!IMPORTANT]pplx-embed-v1andpplx-embed-context-v1natively produce unnormalized int8-quantized embeddings. Ensure that you compare them via cosine similarity.

| Model | Dimensions | Context | MRL | Quantization | Instruction | Pooling |
|---|---|---|---|---|---|---|
pplx-embed-v1-0.6B | 1024 | 32K | Yes | INT8/BINARY | No | Mean |
pplx-embed-v1-4B | 2560 | 32K | Yes | INT8/BINARY | No | Mean |
pplx-embed-context-v1-0.6B | 1024 | 32K | Yes | INT8/BINARY | No | Mean |
pplx-embed-context-v1-4B | 2560 | 32K | Yes | INT8/BINARY | No | Mean |
1curl -X POST https://api.perplexity.ai/v1/embeddings \
2 -H "Authorization: Bearer YOUR_API_KEY" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "input": [
6 "Scientists explore the universe driven by curiosity.",
7 "Children learn through curious exploration.",
8 "Historical discoveries began with curious questions.",
9 "Animals use curiosity to adapt and survive.",
10 "Philosophy examines the nature of curiosity."
11 ],
12 "model": "pplx-embed-v1-4b"
13 }'1from sentence_transformers import SentenceTransformer
2
3model = SentenceTransformer(
4 "perplexity-ai/pplx-embed-v1-4B",
5 trust_remote_code=True
6)
7
8texts = [
9 "Scientists explore the universe driven by curiosity.",
10 "Children learn through curious exploration.",
11 "Historical discoveries began with curious questions.",
12 "Animals use curiosity to adapt and survive.",
13 "Philosophy examines the nature of curiosity.",
14]
15
16embeddings = model.encode(texts) # Shape: (5, 2560), quantized to int8
17embeddings = model.encode(texts, quantization="binary") # Shape: (5, 2560), quantized to binary1
2import onnxruntime as ort
3from transformers import AutoTokenizer
4import numpy as np
5
6tokenizer = AutoTokenizer.from_pretrained("perplexity-ai/pplx-embed-v1-4b", trust_remote_code=True)
7session = ort.InferenceSession("onnx/model.onnx")
8
9
10texts = [
11 "Scientists explore the universe driven by curiosity.",
12 "Children learn through curious exploration.",
13 "Historical discoveries began with curious questions.",
14 "Animals use curiosity to adapt and survive.",
15 "Philosophy examines the nature of curiosity.",
16]
17
18tokenized = tokenizer(
19 texts,
20 padding=True,
21 truncation=True,
22 return_tensors="np"
23)
24
25onnx_inputs = {
26 "input_ids": tokenized["input_ids"].astype(np.int64),
27 "attention_mask": tokenized["attention_mask"].astype(np.int64),
28}
29
30# Run inference
31onnx_embeddings = session.run([out.name for out in session.get_outputs()], onnx_inputs)
32
33# ONNX produces both int8 and binary precision embeddings:
34int8_embeddings = onnx_embeddings[2]
35binary_embeddings = onnx_embeddings[3]
36packed_embeddings = np.packbits(binary_embeddings != -1, axis=-1)[!NOTE] Text Embeddings Inference v1.9.2+ is required.
[!IMPORTANT] Currently, only int8-quantized embeddings are available via TEI. Remember to use cosine similarity with unnormalized int8 embeddings.
docker run -p 8080:80 ghcr.io/huggingface/text-embeddings-inference:cpu-1.9 --model-id perplexity-ai/pplx-embed-v1-4B --dtype float32docker run -p 8080:80 ghcr.io/huggingface/text-embeddings-inference:cpu-1.9 --model-id onnx-community/pplx-embed-v1-4B --dtype float32docker run --gpus all --shm-size 1g -p 8080:80 ghcr.io/huggingface/text-embeddings-inference:cuda-1.9 --model-id perplexity-ai/pplx-embed-v1-4B --dtype float32If you hit OOM during warmup, lower --max-batch-tokens and --max-client-batch-size. Set --max-batch-tokens to max_sequence_length × batch_size (e.g., 2048 tokens × 8 sequences = 16384).
Alternatively, when running in CUDA you can use the architecture / compute capability specific container instead of thecuda-1.9, as that includes the binaries for Turing, Ampere, Hopper and Blackwell, so using a dedicated container will be lighter e.g.,ampere-1.9.
/embed:1curl http://0.0.0.0:8080/embed \
2 -H "Content-Type: application/json" \
3 -d '{
4 "inputs": [
5 "Scientists explore the universe driven by curiosity.",
6 "Children learn through curious exploration.",
7 "Historical discoveries began with curious questions.",
8 "Animals use curiosity to adapt and survive.",
9 "Philosophy examines the nature of curiosity."
10 ],
11 "normalize": false
12 }'