Embed v1 4b
import { embed } from 'ai';
const result = await embed({ model: 'perplexity/pplx-embed-v1-4b', value: 'Sunny day at the beach',})Frequently Asked Questions
What embedding dimensions does Embed v1 4b produce?
2560 by default. Matryoshka representation learning lets you request shorter vectors through the
dimensionsparameter, trading a small amount of retrieval quality for faster search and less storage.Does Embed v1 4b need an instruction prefix?
No. You embed text directly. That removes a failure mode where the instruction used at indexing time differs from the one used at query time and silently degrades recall.
Which similarity metric should I use with Embed v1 4b?
Cosine similarity for INT8 embeddings and Hamming distance for binary embeddings. Embed v1 4b returns unnormalized vectors, so inner product and L2 distance give incorrect results unless you convert to float32 and L2-normalize first.
How does Embed v1 4b compare to Qwen3-Embedding-4B?
On MTEB(Multilingual, v2), Embed v1 4b reaches 69.66% average nDCG@10 at INT8 precision against 69.60% for Qwen3-Embedding-4B. On Perplexity's PPLXQuery2Query benchmark it reaches 73.5% Recall@10 against 67.9%. The
qwen3-embedding-4bmodel is also available through AI Gateway if you want to compare on your own corpus.How much storage do INT8 and binary embeddings save?
INT8 output uses 4x less storage than FP32, and binary output uses 32x less. At this parameter scale, Perplexity measures the quality drop from binary output at under 1.6 percentage points.
What is the context window for Embed v1 4b?
32K tokens. Chunk documents longer than that before you embed them.
How does Embed v1 4b differ from the contextualized pplx-embed-context-v1 models?
Embed v1 4b embeds each input independently, which suits queries, single sentences, and standalone documents. The contextualized models embed chunks with respect to the surrounding document, which helps when a chunk's meaning depends on its neighbors.
How do I call Embed v1 4b through AI Gateway?
Use the AI SDK
embedfunction for one value orembedManyfor a batch, with the model identifierperplexity/pplx-embed-v1-4b. AI Gateway also serves embeddings through the OpenAI-compatible REST API.Can I change the embedding dimension after indexing?
Not without re-embedding. Existing vectors and new ones must share the same model and dimension count, so pick both before you build the production index.
Is Zero Data Retention available for Embed v1 4b?
Zero Data Retention is not currently available for this model. Zero Data Retention is offered on a per-provider basis. See https://vercel.com/docs/ai-gateway/capabilities/zdr for details.