Prompt

How do I use embeddings for deduplication of near-duplicate records?

Artificial Intelligence / AI Search3 observationsLast seen Oct 26, 2026

Latest observation

Oct 26, 2026OpenAI APIWeb search: off

To deduplicate near-duplicate records with embeddings, you typically:

  1. Convert each record to text

    • For structured data, concatenate the important fields into a consistent string.
    • Example:
      name: Acme Corp | address: 123 Main St | phone: 555-1234
  2. Generate embeddings

    • Use an embedding model to map each record into a vector.
    • Similar records should have vectors close together.
  3. Measure similarity

    • Commonly use cosine similarity.
    • Pairs with similarity above a threshold are treated as likely duplicates.
  4. Find candidate matches efficiently

    • For small datasets, compare all pairs.
    • For larger datasets, use approximate nearest neighbor search:
      • FAISS
      • Annoy
      • hnswlib
      • vector databases
  5. Cluster or pair records

    • You can:
      • mark each record’s nearest neighbors above threshold as duplicates
      • cluster records and choose a canonical representative per cluster
  6. Review and tune

    • Thresholds depend on the data and model.
    • Validate on labeled examples and tune for precision vs recall.

Typical workflow

1) Prepare the text

Make the representation stable and consistent:

  • normalize casing
  • strip punctuation if useful
  • standardize abbreviations
  • order fields consistently
  • include only relevant fields

Example:

company_name: acme corporation
address: 123 main street, springfield
email: info@acme.com

2) Embed

from sentence_transformers import SentenceTransformer
model = SentenceTransformer("all-MiniLM-L6-v2")

texts = [
    "company_name: acme corporation address: 123 main street",
    "company_name: acme corp address: 123 main st."
]
embeddings = model.encode(texts, normalize_embeddings=True)

3) Compare similarities

import numpy as np

sim = np.dot(embeddings[0], embeddings[1])  # cosine similarity if normalized
print(sim)

4) Decide duplicate threshold

Example rule:

  • similarity > 0.85 → probable duplicate
  • 0.75–0.85 → review
  • < 0.75 → different

These numbers vary a lot by dataset.

Important caveats

  • Embeddings are best for semantic similarity, not exact matching.
  • For deduplication, embeddings often work well for:
    • product descriptions
    • company names with variations
    • messy free text
    • customer support tickets
  • They may be weaker for:
    • exact IDs
    • numeric fields
    • highly structured records where rules/fuzzy matching are better

Best practice: combine embeddings with rules

A strong dedup system often uses both:

  • rules/fuzzy matching for exact/near-exact fields
  • embeddings for semantic similarity
  • optional human review for borderline cases

Example hybrid logic:

  • if email matches exactly → duplicate
  • else if embedding similarity high and name/address close → duplicate
  • else not duplicate

If you want, I can also show:

  • a full Python example using FAISS or pandas
  • a clustering-based dedup pipeline
  • how to choose thresholds and evaluate precision/recall

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (3 observations for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.