Table of Contents

Property MinRelativeScore

Namespace
LMKit.Retrieval
Assembly
LM-Kit.NET.dll

MinRelativeScore

Gets or sets the relative score gate applied to the final ranking: results scoring below this fraction of the best hit's score are dropped, even when they clear the absolute minScore floor.

public float MinRelativeScore { get; set; }

Property Value

float

A value between 0 and 1. Default is 0 (disabled).

Examples

LM embeddingModel = LM.LoadFromModelID("embeddinggemma-300m");
RagEngine ragEngine = new RagEngine(new Embedder(embeddingModel));

// Drop results scoring more than 20% below the best hit
ragEngine.MinRelativeScore = 0.8f;

// Disable the relative gate (the default)
ragEngine.MinRelativeScore = 0f;

Remarks

An absolute floor cannot express "far below the best hit": when a query has one strong answer, the remaining top-k slots fill with whatever clears the floor, regardless of the gap. A relative gate prunes those trailing results. For example, 0.8 drops any result scoring more than 20 percent below the best one.

The gate applies after reranking and diversity selection, so it prunes the ranking the caller would otherwise receive. It never removes the best result, and it does not apply to context-window neighbors, which carry no score of their own.

Exceptions

ArgumentOutOfRangeException

Thrown if set to a value outside the [0, 1] range.

Share