Skip to main content
Corvi Careers Archive

Technical • August 22, 2026

Selecting Key Sentences for RAG with Requirement Centroids

Score candidate sentences against requirement-oriented selector centroids and keep each candidate's best centroid score.

Author: ssp

Long documents contain a mix of useful evidence and generic text. Embedding the whole document averages those signals together. Fixed-size chunks reduce the problem, but they still treat every chunk as equally worth retrieving.

The approach used in Corvi Careers was more direct: define the kinds of requirements that matter, represent them as selector centroids, and use those centroids to find the sentences most likely to contain useful evidence.

The key idea

Start with a bank of requirement-oriented selector centroids. Each centroid is the normalized mean embedding of examples for one requirement family, such as experience, education, licensure, technical skills, or working conditions.

For every candidate sentence:

  1. Embed and normalize the sentence.
  2. Compute its cosine similarity to every selector centroid.
  3. Keep the highest similarity as the sentence’s score.
  4. Rank all candidates by that score and retain the top k.

For candidate embedding e_i and normalized centroids c_1 ... c_m:

score(e_i) = max_j(e_i dot c_j)

That maximum is the entire selection rule. A sentence only needs to strongly match one useful requirement family. Averaging its scores would penalize a specific sentence merely because it does not discuss every other kind of requirement.

It is also useful to keep the winning centroid:

selector(e_i) = argmax_j(e_i dot c_j)

The winner explains why the sentence was selected and makes it easy to inspect whether one requirement family dominates the result.

Preparing candidates

The scoring rule works best with clean, sentence-sized inputs. The project used a small amount of preprocessing before embedding:

  • flatten HTML into readable text;
  • split the text into sentences;
  • remove empty, malformed, and extremely long fragments; and
  • deduplicate normalized sentences.

These are guardrails, not the main method. Filters should be conservative: an aggressive early filter can discard evidence before the selector bank gets a chance to score it.

Why a bank of centroids

A single generic “important sentence” vector tends to blur different notions of importance. A centroid bank keeps them separate. A sentence about a required license can match the licensure centroid, while a sentence about five years of experience can independently match the experience centroid.

This has three practical benefits:

  • Coverage: distinct requirement families can surface different evidence.
  • Interpretability: each selected sentence has a winning selector.
  • Efficiency: centroid scores can be computed as one candidate-by-centroid matrix multiplication, followed by a row-wise maximum.

The bank should be small enough to understand and broad enough to reflect the questions the system is meant to answer. Build it from representative examples, normalize every vector, and derive it without using the evaluation set.

Selection and storage

After scoring, retain the top sentences with their source text, offsets, document ID, score, and winning selector. The output remains verbatim evidence, not a generated summary.

Selecting only the global top k can let one requirement family fill every slot. If coverage matters, reserve a small number of slots per winning selector and fill the remaining slots by global score. That is a policy layered on top of the same scoring rule, not a different model.

Keep the original document available. Sentence selection is lossy: if a useful sentence is missed, later retrieval cannot reconstruct it.

What to measure

The main question is whether the selected set preserves useful evidence. Test:

  1. Evidence recall: how often does the top-k set contain the supporting sentence?
  2. Compression: what fraction of the source text is retained?
  3. Selector coverage: which centroids win, and which never do?
  4. Ranking quality: how early does supporting evidence appear?
  5. Downstream retrieval: does selection improve recall and answer quality over whole documents or fixed chunks?

Compare the centroid selector with random sentences, first-k sentences, fixed-size chunks, and direct query-to-sentence similarity. Use held-out documents and held-out requirement examples so the evaluation does not simply reward the data that produced the centroids.

The reusable lesson

Do not ask one document vector to average everything the source happened to contain. Score each candidate against a bank of requirement-oriented selector centroids and keep its best centroid score. It is a small, inspectable mechanism for turning a repetitive document into a compact set of task-relevant evidence.