BXUP Track progress & test yourself — free
Database & ERP · Playbook · Advanced · ~5 min read
DATABASE & ERP · PLAYBOOK · ADVANCED

Dedupe Master Data with Embeddings plus LLM Adjudication

"Acme Corp", "ACME Corporation Pvt Ltd" and "Acme Corp. (do not use)" are one customer wearing three numbers. This playbook finds duplicate customers, vendors and materials with embedding similarity, adjudicates the borderline pairs with LLM reason codes — and keeps every merge decision human, because merges rewrite history.

Tier: Advanced · Workflow area: ERP Data & Close · ~45 minutes

Classic dedupe tooling matches strings; duplicates are made of meaning. Fuzzy matching catches "Acme Corp"/"Acme Corp." and misses "IBM"/"International Business Machines", transliterations, and the vendor rekeyed after a typo in the tax ID. Embeddings compare records in meaning-space, which finds the semantic pairs — and produces a gray zone in the middle that neither threshold can settle. That gray zone is where the LLM earns its seat: reading both records and issuing a recommendation with reason codes, so the human who owns the merge decides fast and on evidence.

When to use

  • Pre-migration master-data cleanupthe cheapest moment to kill duplicates is before they cross into the new system and acquire fresh transaction history (pairs directly with pb-48).
  • Symptoms are financial, not cosmeticcredit exposure split across three customer numbers, vendor spend invisible to procurement negotiations, duplicate materials defeating MRP. Duplicates are a controls problem wearing a data-quality costume.
  • A merger or acquisition just doubled your party datatwo ERPs' worth of customers and vendors with zero shared keys is the canonical semantic-matching workload.

When NOT to use

  • Auto-merging anythinga wrong merge welds two companies' orders, balances and history together; unpicking it makes the original duplicates look charming. AI proposes, ranks and explains; a human with master-data authority executes.
  • When the real fix is upstreamdedupe without fixing the intake process (no search-before-create, no validation) is bailing with the tap open; ship both.
  • Records where "duplicate" is legally loadedtwo entities sharing a name and address may be genuinely distinct legal parties (franchises, group companies). Tax-ID conflicts route to specialists, not to a similarity score.

The recipe

  1. Extract and canonicalize a matching view. Pull the candidate object (say vendors) into Postgres with the fields that carry identity — name, street, city, country, tax IDs, bank account (hashed), contact email domain — and a matching_text column concatenating the meaningful ones in a fixed order, lowercased, legal-form noise ("pvt ltd", "gmbh", "inc") normalized but not removed. Keep the raw fields; the LLM step needs them intact.

  2. Embed and index with pgvector.

    CREATE EXTENSION IF NOT EXISTS vector;
    ALTER TABLE vendor_match ADD COLUMN emb vector(1024);
    -- Populate emb via your embedding model over matching_text
    -- (batch script; tenant-approved endpoint for real party data).
    CREATE INDEX ON vendor_match USING hnsw (emb vector_cosine_ops);
    

    Then generate candidate pairs — nearest neighbors above a loose floor, blocked by country to keep the pair count sane:

    SELECT a.vendor_id, b.vendor_id,
           1 - (a.emb <=> b.emb) AS sim
    FROM vendor_match a
    JOIN LATERAL (
      SELECT vendor_id, emb FROM vendor_match b
      WHERE b.vendor_id > a.vendor_id AND b.country = a.country
      ORDER BY b.emb <=> a.emb LIMIT 5
    ) b ON TRUE
    WHERE 1 - (a.emb <=> b.emb) > 0.60;
    
  3. Calibrate thresholds on a labeled sample. Hand-label 100–200 pairs across the similarity range as dup / not-dup / unsure. Plot the labels against the score and choose two cut lines: above the upper (say 0.92) pairs are near-certain duplicates that still get human confirmation but no LLM step; below the lower (say 0.72), discard. The band between is the adjudication queue. Calibration on your data is mandatory — thresholds do not transfer between datasets or embedding models.

  4. Adjudicate the gray zone with reason codes. Per pair, the LLM sees the full raw records and answers in a fixed schema:

    Compare these two vendor records and recommend one of:
    MERGE / DISTINCT / ESCALATE (cannot determine).
    Justify using ONLY these reason codes (any that apply):
    RC1 name variation of same legal entity   RC2 same tax ID
    RC3 address match/adjacent                RC4 same bank account
    RC5 tax IDs conflict                      RC6 different legal form
    RC7 successor/renamed entity              RC8 franchise or group
                                                  sibling suspected
    Output JSON: {recommendation, reason_codes[], evidence: one quote
    from each record per code, confidence: high|medium|low}.
    Rule: RC5 present => never MERGE; recommend ESCALATE.
    [record A] [record B]
    

    Hard business rules (RC5's veto, bank-account matches always escalate to fraud-aware review) live in your post-processing, not in model goodwill — parse the JSON and enforce them in code.

  5. Route to human deciders in worklist form. Build the review queue sorted by confidence and business weight (open PO value, open items, transaction recency): recommendation, reason codes, side-by-side records, evidence quotes. A reviewer with reason codes processes a pair in under a minute; the same pair from a bare similarity score takes five. Record every human verdict — agree/override — because that log recalibrates thresholds and audits the model's judgment over time.

  6. Execute merges through the ERP's own machinery, then measure. Approved merges run through sanctioned channels — SAP MDG consolidation or your governed merge process, never direct table surgery — with the survivor record chosen by your data-quality rules and the loser blocked-and-referenced, not deleted. Close the loop with numbers: duplicates confirmed, false-positive rate from reviewer overrides, credit exposure re-consolidated. Then schedule the rerun — dedupe is a cycle, not an event, until intake validation (search-before-create on the same embedding index) closes the tap.

Make it yours

  • SAPfeed confirmed pairs into MDG's consolidation process for the actual merge; the embedding index doubles as a real-time duplicate check in MDG's search during creation.
  • OracleCustomer Data Management (CDM) in Fusion owns the merge machinery; use the embedding+LLM funnel to feed its candidate lists with semantic pairs its native matching misses.
  • Microsoft Dynamics 365Dataverse duplicate-detection rules are string-based; run this pipeline externally against exported party data and execute merges through Dataverse's merge API with the audit trail on.

Quality check

  • Thresholds were calibrated on your labeled sample, not defaultsand the labeled set is kept for recalibrating when the embedding model changes.
  • Every reason code cites verbatim evidence from the recordsa code without a quote is an assertion; spot-check ten adjudications weekly.
  • Hard rules are enforced in code, not promptsverify RC5-veto and bank-account-escalation by planting test pairs that trigger them.
  • Reviewer override rate is trackedabove ~15% overrides means thresholds or prompts need work; near-zero for months means reviewers may be rubber-stamping — sample-audit both tails.
  • Merged records reconcilepost-merge, the survivor's open items and balances must equal the pre-merge sum of both records, to the cent, per pb-48 discipline.
Warning

Party master data is dense PII and commercially sensitive. Embeddings and adjudication prompts must run on tenant-approved endpoints under your data-processing agreement — a vendor list with bank details in a consumer chat tool is a reportable incident, not a workflow.

Key Takeaway:

Embeddings find what string-matching cannot, the LLM makes the gray zone reviewable at speed, and the human merge decision keeps the one irreversible step accountable. Score, reason codes with quoted evidence, human verdict — that funnel is the whole design.

This is the free reading view. Open BXUP to track your progress, run the hands-on labs, and prove it with original, exam-pattern assessments.
© Anvi Innovate · BXUP — Be Exponentially Upskilled · BXUP is an independent learning platform, not affiliated with or endorsed by AWS, Microsoft, Google, NVIDIA, IBM, Salesforce, Databricks, Oracle or Anthropic. All trademarks belong to their respective owners. · bxup.in