Principle:666ghj BettaFish Diversity Sampling
| Knowledge Sources | |
|---|---|
| Domains | Machine_Learning, Information_Retrieval, NLP |
| Last Updated | 2026-10-08 00:00 GMT |
Overview
Technique that uses semantic clustering to select diverse, representative items from a large set of search results, ensuring coverage of all topical sub-themes rather than only the most frequent ones.
Description
Diversity Sampling addresses the problem of redundant search results: when a database search returns hundreds of results, many will be near-duplicates or cover the same sub-topic. Simply taking the top-N by popularity leads to topical bias. By clustering results semantically (using sentence embeddings) and sampling from each cluster, the system ensures that all distinct sub-topics are represented in the final set.
This approach combines semantic similarity (SentenceTransformer embeddings) with importance ranking (hotness score within each cluster), producing a set that is both diverse and high-quality.
Usage
Use this principle when processing large result sets (>50 items) before passing them to an LLM for summarization. It prevents context window overflow while ensuring the LLM sees representative coverage of all sub-topics.
Theoretical Basis
The diversity sampling process:
Where:
- = raw results, = embeddings, = clusters
- clusters
- selects the top-m items by hotness from each cluster
Pseudo-code Logic:
# Abstract pattern (NOT real implementation)
embeddings = sentence_transformer.encode(texts)
clusters = kmeans.fit_predict(embeddings, k=n_clusters)
sampled = []
for cluster in clusters:
top_by_hotness = sorted(cluster, key=hotness, reverse=True)[:m]
sampled.extend(top_by_hotness)
return sampled[:max_results]
Related Pages
Implemented By
- Implementation:666ghj_BettaFish_Clustering_and_Sampling
- Implementation:666ghj_BettaFish_DeepSearchAgent_init