Why a fixed similarity threshold fails when deduplicating feature requests with pgvector
A developer built a semantic deduplication system for a feature-request board after noticing that identical user requests, worded differently, were being filed separately and splitting votes. Traditional trigram similarity in Postgres proved ineffective because it compares spelling rather than meaning, prompting a switch to vector embeddings via pgvector and OpenAI's text-embedding-3-small model. The developer found that combining request titles and body text produced better embeddings than titles alone, since short bare-verb titles lack enough context for accurate similarity matching. A key lesson was that the widely cited cosine similarity threshold of 0.85 for flagging duplicates is unreliable, as scores vary significantly depending on text length. The same conceptual similarity scored around 0.91 for title-only pairs but dropped to roughly 0.74 when body text was included, making a single hardcoded cutoff unsuitable across mixed content.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in