語義房源去重:可審計物業檢索的 5 個訊號
Semantic Listing Deduplication — 5 Signals for Auditable Property Retrieval
房源檢索應採用兩階段架構,先以詞彙條件和語義相似度產生候選,再按文本相似度、結構化欄位一致性、地理距離、資料新鮮度及來源可信度評分。系統應保留各項原始證據及政策版本,並以可重現的方式記錄合併決策,方便審查。麵對模型逾時,應將候選標記為「延後審查」,而非虛構相似度分數。
Short answer: for real-estate listing discovery, use a two-stage retrieval architecture that combines lexical constraints with semantic similarity, then rank candidates with freshness, provenance, geographic fit, and duplicate penalties; keep every decision reproducible so a compliance reviewer can explain why a listing appeared.
A property feed is a stream of claims, not a clean catalog. The same apartment can arrive from an agency portal, a syndication partner, and a nightly CSV export, each with different wording, currencies, and update times. A semantic index helps find near-duplicates, but it cannot decide alone that two records are the same home. That decision needs signals with different failure modes.
Keep it deterministic.
I approach this as a ledger problem. A retrieval result should have an evidence trail, an idempotent event key, and a deterministic fallback when a model is unavailable. The retrieval system can be probabilistic; the final write to a canonical listing table cannot be.
How should retrieval architecture rank real-estate listings for discovery?
Start with an explicit unit of identity. For a listing, that might be a normalized address plus unit number, but addresses are incomplete, transliterated, or intentionally vague. Store the raw record, a normalized projection, the source identifier, and an ingestion timestamp. Never overwrite the raw payload when a newer feed disagrees.
The first stage should be inexpensive candidate generation. Exact matches on source IDs and normalized phone numbers catch obvious repeats. Token search over street, neighborhood, and agent fields catches spelling changes. Embeddings then retrieve semantically similar descriptions such as “sunlit two-bedroom near the tram” and “bright 2BR, five minutes from transit.” A vector hit is a hypothesis, not proof.
The second stage scores a small candidate set. Five signals are useful because they express independent evidence: textual similarity, structured-field agreement, geo distance, temporal freshness, and source provenance. Keep their raw values beside the final score. A single opaque score makes incident review painful.
For a pair of records a practical score can be written as:
type PairEvidence struct {
TextCosine float64
AddressAgreement float64
GeoAgreement float64
Freshness float64
SourceTrust float64
ConflictPenalty float64
}
func duplicateScore(e PairEvidence) float64 {
return 0.34*e.TextCosine +
0.24*e.AddressAgreement +
0.16*e.GeoAgreement +
0.10*e.Freshness +
0.16*e.SourceTrust -
e.ConflictPenalty
}
Those coefficients are starting policy, not a universal truth. Calibrate them against reviewed pairs and record the policy version with each merge decision. If the address is missing, do not silently treat it as agreement; represent missingness explicitly and lower confidence.
How do latency and retrieval quality interact in a near-duplicate search?
Latency is a budget across stages. Parsing and normalization happen at ingest, so the online path can use precomputed fields and embeddings. Candidate generation might return 100 records, while a cross-encoder or richer feature join reranks only the top 20. This arrangement preserves recall without paying the expensive cost for every document.
The catch is that aggressive pruning can erase the only useful comparison. A rural listing may have a sparse address and generic prose, so lexical filters can reject it before semantic retrieval sees it. Conversely, a pure vector search can pair two different units in the same building because their descriptions are nearly identical. Set a recall floor for candidate generation, then tune reranking latency inside that constraint.
Use timeouts and bounded concurrency around model calls. On timeout, retain the candidate with a “deferred review” status rather than inventing a low similarity score. An exactly-once mindset matters here: retries must reuse an idempotency key derived from source, source record ID, and feed revision. The same event should not create a second canonical listing.
I once treated a feed revision as a mutable row number. A replay after a partner outage produced two merge events for the same apartment, and the audit log could explain each event but not why both were accepted. The repair was to persist an immutable event ID and a unique constraint on (source, record_id, revision). It added a few bytes per event and removed an entire class of reconciliation work. Small detail. Large consequence.
Keep it deterministic.
Signals, evidence, and failure modes
| Signal | Useful evidence | Typical false positive | Guardrail |
|---|---|---|---|
| Text similarity | Description and title embeddings | Template text shared by many homes | Down-weight boilerplate spans |
| Address agreement | Parsed street, number, unit | Missing unit numbers | Treat unknown as unknown |
| Geo agreement | Coordinates or geohash | Pin snapped to neighborhood center | Use a distance band by locality |
| Freshness | Feed revision and observed time | Old record with a newer crawl time | Separate publication time from crawl time |
| Provenance | Source history and verification | High-volume source repeating errors | Track source-level precision |
Freshness deserves special care. A newly crawled stale page is not a newly published listing. Keep published_at, updated_at, and observed_at as separate fields, and define which one controls ranking for the user’s intent. For availability searches, an older but confirmed update may beat a fresh unverified scrape.
Provenance is not a popularity contest. It is evidence about how a value entered the system. When two sources disagree on rent, preserve both claims with their timestamps and choose a display value through a documented policy. This is the same discipline used in a payment ledger: append facts, derive views, and make corrections as new events.
Operating the index without losing the audit trail
Every retrieval request should emit a trace containing query normalization, index version, candidate IDs, feature values, model version, and the policy version that produced the final ordering. Hash large payloads instead of copying sensitive text into logs. Real-estate data can contain phone numbers and precise locations; retention and access rules should follow applicable privacy and financial-crime controls when listings feed lending or payments workflows. Compliance limits are architectural constraints, not paperwork added at the end.
Build a replayable evaluation set from adjudicated pairs: duplicate, distinct, and “insufficient evidence.” Measure recall at the candidate stage, precision of automatic merges, and the percentage routed to review. Segment results by locality, language, source, and missing-field pattern. A single aggregate hides the neighborhoods where the model is weakest.
The operational boundary is important. Automatic merging is suitable when the business can tolerate a reversible false positive and a human queue exists. It is not suitable when a merge changes ownership, underwriting eligibility, or a legal notice without review. In those cases, keep records separate and expose the relationship as “possible duplicate.” Stick with deterministic keys and manual adjudication when the consequences of a wrong merge exceed the latency benefit.
Choosing an architecture that can be explained later
A managed vector service may reduce maintenance, while a self-hosted index can offer tighter data residency control; a relational extension can simplify joins, while a dedicated engine can provide higher throughput. None of these choices fixes weak identity fields or undocumented policies. Select based on residency, recovery objectives, query volume, and the team’s ability to inspect ranking decisions. Your mileage may vary because locality, language, and feed quality dominate benchmark results.
Keep the interfaces boring: an ingestion contract, a candidate-search contract, a reranking contract, and an adjudication event. Version each contract. Store the input hash and output decision so a replay can prove that a code change, not a mysterious model mood, changed the result.
The design I would ship is therefore deliberately two-path: fast lexical and structured retrieval for known entities, semantic retrieval for paraphrases, and a bounded reranker that emits evidence with every score. It favors explainability over a last percentage point of recall, because an unresolved duplicate in a property index is cheaper than an untraceable merge in a financial workflow.
References
- Lewis et al., “Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks”: https://arxiv.org/abs/2005.11401
- NIST, “Artificial Intelligence Risk Management Framework (AI RMF 1.0)”: https://www.nist.gov/itl/ai-risk-management-framework
- ISO 8601 date and time format overview: https://www.iso.org/iso-8601-date-and-time-format.html
- OpenTelemetry specification: https://opentelemetry.io/docs/specs/otel/
來源:DEV Community · dev.to