ScaleDown’s compression endpoint is powered by task-specific small language models (SLMs) that identify which parts of a context are relevant to a given query. This post covers how we approach training these models, with a focus on the data pipeline, since that’s where most of the work (and most of the decisions) live.
The Task: Extractive Sentence Selection
Our compression model doesn’t generate text. Given a query, it classifies which tokens in a context should be kept and which can be dropped. This is a deliberate design choice: by avoiding generation entirely, we eliminate hallucination risk and keep inference fast. This helps us process long contexts at scale while maintaining low latency and high throughput.
The model scores the relevance of each token and we use those token level scores to build up to sentence level relevance in the context with respect to the query. We return the top-scoring sentences to form the compressed output. The training methodology follows established patterns from : learn a relevance function over (query, sentence) pairs using supervision derived from known-good answers.
Building the Training Data
The training pipeline starts with (context, query, answer) triplets. From these, we derive per-sentence relevance labels using a teacher model.
Step 1: Source Diverse, Long-Context Documents
The document corpus needs to be long-context (compression is most valuable when there’s a lot to compress) and domain-diverse (the model needs to generalize).
Our training corpus draws from:
MS-MARCO: Microsoft’s large-scale information retrieval dataset with ~1M real Bing queries and web passages. This is a natural fit: the data is already structured as (query, passage, relevance) and covers a broad range of web-search topics. It forms the backbone of ours.
Natural Questions: Google’s QA dataset of 307k real search queries paired with full Wikipedia articles. Each example requires reading an entire Wikipedia page to find the answer, giving us naturally long contexts (full articles, not just paragraphs) with human-annotated answer spans. This provides dense, factual, multi-topic contexts across history, science, geography, and more.
S2ORC (Semantic Scholar Open Research Corpus): Allen AI’s corpus of 136M+ academic papers with parsed full text spanning biomedicine, computer science, physics, mathematics, and dozens of other disciplines. We use this as our source for both biomedical and general scientific documents. S2ORC includes full-text papers from PubMed Central alongside arxiv and other publishers, giving us long, structured scientific documents with sections, citations, and technical notation.
SEC filings (EDGAR): Raw 10-K, 10-Q, and 8-K filings pulled directly from the SEC’s EDGAR system. Financial filings are particularly good training data because they’re long, structurally repetitive, and full of boilerplate that a good compressor should learn to skip.
Synthetic Data: We generate diverse textual data spanning many categories. We also designed a diverse prompting strategy to improve the variety and authenticity of the generated data.
Step 2: Generate QA Pairs
Some of our source datasets like MS-MARCO, Natural Questions, and CUAD already come with (query, answer) pairs or relevance annotations. For these, we can go directly to the teacher labeling step.
For raw document corpora, we use a strong teacher model to generate (query, answer) pairs over the documents. The prompt is straightforward: given a document, generate questions that require reading specific sections to answer, along with the correct answers.
Quality filtering matters here. We discard QA pairs where the answer is trivially derivable from the query alone, where the question is too generic to require specific evidence, or where the teacher model’s own answer doesn’t hold up against the source text.
Step 3: Label Sentence Relevance via Teacher Scoring
This is the core of the pipeline. Given a (context, query, answer) triplet, we need to determine which sentences in the context are relevant to answering the query.
We use a teacher model to score token-level relevance, then aggregate up to sentence-level labels. The process:
Token-level relevance scoring: The teacher model evaluates how much each sentence in the context contributes to producing the correct answer for the given query. From this, we create token-level relevance scores.
Sentence-level aggregation: Token scores are aggregated to produce a relevance score per sentence. A sentence is labeled as relevant if its aggregated score exceeds a threshold.
Validation: We verify that the selected sentence subset is sufficient to answer the query. If the answer can’t be derived from the selected sentences alone, the labels are adjusted or the example is discarded.
This gives us training examples in the form: (context, query) → binary label per sentence.
Training the Model
The SLM is trained as a token-level classifier: given a (query, sentence) pair in the context of the full document, predict whether the token should be kept.
The key property of the base model architecture is its size: it’s small enough to run inference on long contexts at low latency and cost, while being large enough to capture cross-sentence relevance patterns across domains.
Why This Generalizes
We don’t finetune a separate model for finance, legal, medical, or any other domain. The multi-domain training mix handles generalization: by training on EDGAR filings alongside S2ORC papers and Natural Questions, the model learns domain-agnostic patterns of relevance and what makes a sentence useful for answering a question, regardless of whether that question is about cardiac risk factors or quarterly revenue.
This is why the model performs well on FinanceBench without having seen FinanceBench during training. The EDGAR filings in our training set teach the model the structure and language of financial documents, while the broader corpus teaches it to generalize the relevance function across domains.
Evaluating Compression Quality
Compression quality can’t be measured by classification metrics alone. A model that keeps every sentence gets perfect recall but provides no compression. A model that drops everything gets perfect precision on the “irrelevant” class but destroys the context.
The real evaluation is downstream: does the compressed context produce the same (or better) answers from the LLM? ScaleBench, our open-source benchmarking framework, runs this end-to-end: compress the context, send it to the downstream model, and measure answer quality via F1, exact match, and other task-specific metrics against gold answers.
This is how we validate that the extractive approach works. We ensure not just that the model picks reasonable sentences, but that those sentences are sufficient for the downstream task.
Key Takeaways
Extractive over abstractive. No generation means no hallucination and fast inference. The model selects sentences, it doesn’t rewrite them.
Teacher-labeled relevance at the token level. Fine-grained teacher scoring, aggregated to sentence labels, produces higher-quality supervision than heuristic methods.
Diverse, non-benchmark training data. A broad mix of datasets supplemented with synthetically generated QA pairs gives the model domain-general compression capability.
Downstream evaluation is the only evaluation that matters. Classification accuracy on sentence labels is a proxy. The real metric is whether the compressed context preserves answer quality at lower token cost.



