Skip to main content
GoldenMatch exports 194 symbols from a single import. Every feature is accessible via import goldenmatch as gm.

High-level convenience functions

These are the primary entry points for most users.

dedupe

Deduplicate one or more files. Pass file paths as positional arguments.

dedupe_df

Deduplicate a Polars DataFrame directly (no file I/O). Also used by SQL extensions.

match

Match a target file against a reference file.

match_df

Match DataFrames directly without file I/O.

Scoring functions

score_strings

Score two strings with a named similarity scorer. Returns 0.0—1.0.

score_pair_df

Score a pair of records. Returns weighted overall score.

explain_pair_df

Generate a natural-language explanation for why two records match (or don’t).

PPRL (Privacy-Preserving Record Linkage)

Link records across organizations without sharing raw data.

pprl_auto_config / auto_configure_pprl

Profile a DataFrame and recommend optimal PPRL fields, bloom filter parameters, and threshold.

run_pprl

Low-level PPRL execution with full control over parameters.

PPRLConfig

Other PPRL exports

Evaluation

evaluate

Run the full pipeline and evaluate against ground truth. Returns dict with precision, recall, f1, tp, fp, fn.

evaluate_pairs

predicted is a list of (id_a, id_b, score) triples (the shape score_pairs returns); duplicate pairs are de-duped symmetrically. Evaluate predicted pairs against ground truth pairs directly.

evaluate_clusters

Evaluate cluster dict (from build_clusters) against ground truth.

EvalResult

load_ground_truth_csv

compare_clusters

Compare two clustering outcomes on the same dataset using CCMS. Classifies each cluster from A as unchanged, merged, partitioned, or overlapping relative to B.

CompareResult

run_sensitivity

Sweep parameters and compare each run against a baseline using CCMS.

SweepParam

Fields: "threshold", "matchkey.<name>.threshold", "blocking.max_block_size".

Configuration

load_config

Load a YAML config file into a Pydantic model.

GoldenMatchConfig

Top-level config model. Key fields:

MatchkeyConfig

MatchkeyField

Other config classes

Result classes

DedupeResult

Both DedupeResult and MatchResult have _repr_html_() for rich Jupyter display. native (v2.1.0) — native-dispatch telemetry. result.native is a NativeDispatchSummary reporting whether the scoring hot path actually dispatched to the optional Rust kernel (pip install goldenmatch[native]) or fell back to pure Python — ran_native, hot_path_native, and per-component native/fallback counts. It is None when the run did no scoring. When the kernel is importable but the hot path still ran on the fallback, GoldenMatch also logs a WARNING (and each Ray worker self-reports once per process), so a silently slow run is visible instead of only inferable from wall-clock.

MatchResult

Streaming and incremental

match_one

Match a single record against an existing DataFrame. Returns list of (row_id, score) tuples.
Returns empty list for exact matchkeys (threshold=None). Use find_exact_matches for exact matching.

StreamProcessor

Incremental record matching with immediate or micro-batch processing.

run_stream

Pipeline functions

run_dedupe / run_match

Low-level pipeline entry points. File specs are (path, source_name) tuples.

Scorer functions

Cluster functions

Other pipeline functions

LLM scoring

llm_score_pairs

Score borderline pairs with GPT/Claude. Accepts LLMScorerConfig with optional BudgetConfig.

llm_cluster_pairs

In-context block clustering as alternative to pairwise scoring. Set config.mode = "cluster".

BudgetTracker

Tracks token usage, cost, and enforces limits. Degrades gracefully: cluster mode falls back to pairwise, then stops.

Other LLM exports

Probabilistic matching (Fellegi-Sunter)

train_em

Train m/u probabilities via Expectation-Maximization. Pass blocking_fields to exclude them from training.

score_probabilistic

Score pairs using trained Fellegi-Sunter weights.

Learned blocking

Data-driven predicate selection. Achieves 96.9% F1 matching hand-tuned blocking.

Explainability

Template-based natural-language explanations at zero LLM cost. explain_pair is an alias for explain_pair_nl.

Domain extraction

Data quality

Lineage and profiling

Auto-configuration

New v1.5.0 kwargs on auto_configure_df:
  • strict — compute postflight signals and emit advisories, but suppress auto-adjustments (threshold nudges, etc.). Use for DQBench / regression / reproducibility runs.
  • allow_remote_assets — permit embedding, record_embedding, and cross-encoder rerank scorers. Default False demotes them so auto-config is offline-safe and never triggers a surprise HuggingFace download.
The returned config carries config._preflight_report: PreflightReport (underscore — private-by-convention but stable across v1.5.x).

Controller telemetry (v1.7-v1.12)

auto_configure_df runs the AutoConfigController, which writes (profile, history) to a ContextVar (goldenmatch.core.autoconfig._LAST_CONTROLLER_RUN). Callers can read it post-call:
Or via the cross-surface serializer (single JSON shape used by web / CLI / SQL / MCP / A2A):

AgentSession.autoconfigure (v1.7-v1.12)

For agent-style sessions, AgentSession exposes the same surface as a single call:

Verification (v1.5.0)

The preflight + postflight layer validates an auto-generated config against the data it was built for. auto_configure_df runs preflight automatically at the end; the pipeline runs postflight automatically after scoring. Both are also callable directly.

preflight

Runs 6 checks on (df, config):
  1. Column resolution — every column referenced by blocking/matchkeys exists, or is a pipeline-synthesized __mk_*, or is a domain-extracted column recoverable by enabling config.domain (auto-repaired when a domain profile was stashed during auto-config).
  2. Exact-matchkey cardinality — drops keys with ratio >= 0.99 (near-unique, no pair ever agrees) or < 0.01 (near-constant, produces giant blocks).
  3. Block-size sanity — samples blocking keys and flags blocks that would stall the scorer.
  4. Remote-asset demotionembedding / record_embedding / cross-encoder rerank scorers are demoted unless allow_remote_assets=True.
  5. Weight confidence capping — matchkey fields with profile confidence < 0.5 cap at weight 0.3 (requires profiles kwarg).
  6. Domain auto-repair — when a column like __title_key__ is missing but a domain profile is available, enables config.domain so the pipeline produces the column at runtime.
Auto-repairs what it can (setting finding.repaired = True) and records unrepairable issues as severity="error" findings. auto_configure_df raises ConfigValidationError if report.has_errors.

postflight

Runs 4 signals on scored pairs:
  • Score histogram + bimodality — if the score distribution is clearly bimodal (valley depth ratio < 0.5) and the valley is > 0.05 away from the current threshold, emits a PostflightAdjustment nudging the threshold to the valley. Suppressed under strict=True.
  • Blocking recall estimate — gated at >= 10K rows; returns "deferred" below that.
  • Preliminary cluster sizes + oversized-cluster bottleneck pair — p50/p95/p99/max plus a list of oversized clusters with their weakest edge.
  • Threshold-band overlap — fraction of pairs within 0.02 of the threshold. Advises --llm-auto when > 20% and LLM scorer is off.

Report shapes

PostflightSignals schema

The signals dict is a stable TypedDict contract (defined in goldenmatch/core/autoconfig_verify.py):
ScoreHistogram, BlockSizePercentiles, ClusterSizePercentiles, OversizedCluster are all TypedDicts — import them from goldenmatch.core.autoconfig_verify if you want to type-check consumer code.

Where the reports live

  • config._preflight_report: PreflightReport | None — set by auto_configure_df. Underscore-prefixed, documented as private-by-convention; stable contract.
  • DedupeResult.postflight_report: PostflightReport | None — set by the pipeline after scoring.
  • MatchResult.postflight_report: PostflightReport | None — same for match flows.

Active learning

Label borderline pairs, train LogisticRegression, reclassify.

Diff and rollback

Graph ER

Multi-table entity resolution with cross-relationship evidence propagation. propagation_mode="relational" runs collective ER (Bhattacharya-Getoor): it blends attribute similarity with neighbor-cluster overlap (Jaccard/Adamic-Adar) and iterates to a synchronous fixpoint, resolving homonyms that attributes alone cannot (measured pairwise F1 ~0.66 -> ~0.87 on a relational fixture where the co-author neighborhood is the only disambiguating signal). "additive" / "multiplicative" are the simpler flat-boost modes (the default stays additive).

Output

Learning Memory (v1.6.0)

After a pipeline run, every DedupeResult / MatchResult carries a memory_stats field:
Full guide: Learning Memory.

REST API client

Uses stdlib urllib only — no extra dependencies.