Benchmarked against: Anthropic — Embeddings
Model: Gemini embedding-001 (768 dimensions)
Infrastructure: Cloudflare Vectorize
Vector embeddings power the semantic search in Cloud UB. When text is ingested, it's converted to a numerical vector that captures its meaning. Similar content produces similar vectors, enabling "find things like this" searches.
How embeddings work in UB
Embedding pipeline
- Ingestion: Content → Gemini
embedding-001 → 768-dimensional vector → stored in Vectorize
- Search: Query → same embedding model → query vector → cosine similarity against all stored vectors
- Ranking: Combine vector similarity score with FTS5 keyword score → hybrid ranked results
Embedding model details
| Property | Value |
|---|
| Provider | Google (Gemini) |
| Model | embedding-001 |
| Dimensions | 768 |
| Max input | ~2,048 tokens per embedding |
| Language support | English (excellent), Chinese (good) |
| Cost | Included in Gemini API pricing (very low) |
Why Gemini embedding-001?
| Factor | Decision |
|---|
| Cost | Very low — pennies per thousand embeddings |
| Quality | Good multilingual support |
| Integration | Native Cloudflare Vectorize support |
| Dimensions | 768 — good balance of quality vs. storage |
Vectorize infrastructure
| Property | Value |
|---|
| Service | Cloudflare Vectorize |
| Index type | HNSW (approximate nearest neighbor) |
| Similarity metric | Cosine similarity |
| Free tier | 30M queries/month |
| Storage | Part of Workers infrastructure |
Hybrid search scoring
Search results combine two scores:
| Source | Weight | What it finds |
|---|
| FTS5 keyword score | Varies | Exact term matches |
| Vector similarity score | Varies | Semantically similar content |
The combined score determines final ranking. Entries matching both keyword and semantic get the highest scores.
Embedding quality considerations
| Factor | Impact |
|---|
| Content length | Short entries may have weak embeddings — less semantic signal |
| Content language | English content embeds better than Chinese |
| Content specificity | Specific content embeds better than generic |
| Duplicate content | Near-duplicates cluster together — may reduce search diversity |
Best practices for embeddable content
| Do | Don't |
|---|
| Write descriptive titles | Use vague titles ("Notes") |
| Include key terms in content | Rely only on tags for discoverability |
| Keep entries self-contained | Write entries that depend on context |
| Use English for all UB content | Mix languages within entries |
Regeneration
Vector embeddings are regenerable — they can be rebuilt from entry content:
| Scenario | Action |
|---|
| Vectorize index corruption | Re-embed all entries from D1 |
| Embedding model upgrade | Re-embed with new model |
| Content update | Entry re-embedded automatically |
This makes embeddings a low-criticality backup item — they don't need to be backed up separately.
Related pages