bowang0911 commited on
Commit
59c35f9
·
verified ·
1 Parent(s): 815eeec

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +135 -1
README.md CHANGED
@@ -4,4 +4,138 @@ pipeline_tag: feature-extraction
4
  ---
5
 
6
 
7
- `pplx-embed-1` and `pplx-embed-1-kontext`, state-of-the-art text embedding models built for real-world, web-scale retrieval.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  ---
5
 
6
 
7
+ <p align="center">
8
+ <img src="assets/logo.svg" alt="Perplexity Logo" width="400">
9
+ </p>
10
+
11
+ <p align="center">pplx-embed-1: Diffusion-LM for Dense and Contextual Retrieval</p>
12
+
13
+ `pplx-embed-1` and `pplx-embed-1-context` are state-of-the-art text embedding models optimized for real-world, web-scale retrieval tasks.
14
+
15
+ ![diag.png](assets/diag.png)
16
+
17
+ ## Models
18
+
19
+ | Model | Dimensions | Context | MRL | Quantization | Instruction |
20
+ |:-----:|:----------:|:-------:|:---:|:------------:|:-----------:|
21
+ | `pplx-embed-1-0.6B` | 1024 | 32K tokens | Yes | INT8/BINARY | No |
22
+ | `pplx-embed-1-4B` | 2560 | 32K tokens | Yes | INT8/BINARY | No |
23
+ | `pplx-embed-1-context-0.6B` | 1024 | 32K tokens | Yes | INT8/BINARY | No |
24
+ | `pplx-embed-1-context-4B` | 2560 | 32K tokens | Yes | INT8/BINARY | No |
25
+
26
+ <sub>All models are built on diffusion continued pre-trained Qwen3 at Perplexity AI.</sub>
27
+
28
+ <sub>Many modern embedding models rely on instruction tuning, where users prepend an instruction string to the text being embedded. This can yield a 2%-3% lift on benchmarks, but it also introduces prompt-selection overhead and can make indexing pipelines brittle (small instruction changes can shift embedding space). We deliberately **avoid** this requirement: you can embed the text you want to index directly, without having to choose or maintain an instruction prefix.</sub>
29
+
30
+ ## Quick Start
31
+
32
+ <details>
33
+ <summary>Standard Embeddings API</summary>
34
+
35
+ ```bash
36
+ curl -X POST https://api.perplexity.ai/v1/embeddings \
37
+ -H "Authorization: Bearer YOUR_API_KEY" \
38
+ -H "Content-Type: application/json" \
39
+ -d '{
40
+ "texts": ["What drives human curiosity?"],
41
+ "model": "pplx-embed-1-4B"
42
+ }'
43
+ ```
44
+
45
+ </details>
46
+
47
+ <details>
48
+ <summary>Contextualized Embeddings API</summary>
49
+
50
+ ```bash
51
+ curl -X POST https://api.perplexity.ai/v1/contextualizedembeddings \
52
+ -H "Authorization: Bearer YOUR_API_KEY" \
53
+ -H "Content-Type: application/json" \
54
+ -d '{
55
+ "inputs": [
56
+ [
57
+ "Curiosity begins in childhood with endless questions.",
58
+ "As we grow, curiosity drives us to explore new ideas."
59
+ ]
60
+ ],
61
+ "model": "pplx-embed-1-context-4B"
62
+ }'
63
+ ```
64
+
65
+ </details>
66
+
67
+ <details>
68
+ <summary>Using Transformers</summary>
69
+
70
+ ```python
71
+ from transformers import AutoModel
72
+
73
+ # Standard embeddings
74
+ model = AutoModel.from_pretrained(
75
+ "perplexityai/pplx-embed-1-4B",
76
+ trust_remote_code=True
77
+ )
78
+
79
+ texts = [
80
+ "What drives human curiosity?",
81
+ "Curiosity is the desire to learn and understand new things."
82
+ ]
83
+
84
+ embeddings = model.encode(texts) # Shape: (2, 2560)
85
+ ```
86
+
87
+ </details>
88
+
89
+ <details>
90
+ <summary>Using SentenceTransformers</summary>
91
+
92
+ ```python
93
+ from sentence_transformers import SentenceTransformer
94
+
95
+ model = SentenceTransformer(
96
+ "perplexityai/pplx-embed-1-4B",
97
+ trust_remote_code=True
98
+ )
99
+
100
+ embeddings = model.encode(texts)
101
+ ```
102
+
103
+ </details>
104
+
105
+ <details>
106
+ <summary>Contextualized Embeddings</summary>
107
+
108
+ ```python
109
+ from transformers import AutoModel
110
+
111
+ model = AutoModel.from_pretrained(
112
+ "perplexityai/pplx-embed-1-context-4B",
113
+ trust_remote_code=True
114
+ )
115
+
116
+ # Nested structure: each inner list is a document with sequential chunks
117
+ doc_chunks = [
118
+ [
119
+ "Curiosity begins in childhood with endless questions.",
120
+ "As we grow, curiosity drives us to explore new ideas.",
121
+ "Scientific breakthroughs often start with a curious question."
122
+ ],
123
+ [
124
+ "The curiosity rover explores Mars searching for ancient life.",
125
+ "Each discovery sparks new questions about the universe."
126
+ ]
127
+ ]
128
+
129
+ embeddings = model.encode(doc_chunks) # Shape: (5, 2560)
130
+ ```
131
+
132
+ </details>
133
+
134
+ ## Technical Details
135
+
136
+ For comprehensive technical details and evaluation results, see our paper on arXiv.
137
+
138
+ ## Contact
139
+
140
+ - Website: https://perplexity.ai
141
+ - API Support: api-support@perplexity.ai