Skip to content
AATBIT Labs

Trimwise · LLM context compression

Fit long documents
into your AI prompt budget.

Trimwise picks useful excerpts from your documents and returns them within the token, word, or character limit you set. It keeps the original wording and order.

Without a question, it keeps a broad overview; add one for query-aware extraction to make it focus on your task. You can trim one document or share a budget across several retrieved sources before assembling your prompt.

Example source333 words in

Image delivery
incident review

  1. 01Openingcut
  2. 02Timelinecut
  3. 03Causekept
  4. 04Recoverykept
  5. 05Follow-upcut

144 words out≤ 150 word limit

01 / The cut

Example of a query-aware extraction

The question asks about failure and recovery, so Trimwise kept those sections under the 150-word limit. This incident report is illustrative, but the 144-word result is real.

Question used to focus the result

Why did the image workers fail, and how did the team restore service?

start of sourcekept verbatimend of source

Source / 333 words

Image delivery incident review

On 17 April, publishers in the EU region saw image uploads stall between 09:14 and 10:07 UTC. Existing images still loaded from the CDN, but new posts remained in a processing state. At the peak, 1,842 image jobs were waiting and the oldest job had been queued for 19 minutes. No source documents or published posts were lost.

Read the full report
# Illustrative incident review: image delivery backlog

On 17 April, publishers in the EU region saw image uploads stall between 09:14 and 10:07 UTC. Existing images still loaded from the CDN, but new posts remained in a processing state. At the peak, 1,842 image jobs were waiting and the oldest job had been queued for 19 minutes. No source documents or published posts were lost.

## Timeline

At 09:14, the media queue alert crossed its ten-minute threshold. Support received the first report six minutes later. The on-call engineer checked CDN error rates and regional network health because the user-visible symptom was a missing image. Both were normal. At 09:32, a worker log sample showed repeated storage 403 responses. The retries were safe to replay, but they filled the worker pool and hid the original authorization failure behind queue delay.

## Cause

The credential rotator promoted a new storage key at 08:58. The upload API read the new key immediately, while long-lived image workers kept the previous key in memory. Storage rejected their writes after the old key expired at 09:11. Each failed job retried three times, so the queue grew faster than the workers could drain it. The rotation runbook checked the upload API but did not exercise a background image job.

## Recovery

At 09:41, the team paused new retries, restarted the image workers so they loaded the current key, and replayed the idempotent jobs from the queue. Storage writes succeeded on the first attempt. Queue age returned below one minute at 10:07 UTC, and support confirmed that the affected posts rendered their images. The team kept the incident open for another hour to watch error rates and queue depth.

## Follow-up

The media team owns a worker-side credential reload before the next rotation. The platform team will add a rotation test that uploads and processes an image, plus an alert on storage 403 responses before queue age rises. The incident review is scheduled for 21 April; no customer action is required.

Selected / 144 of 150 words

[…omitted…]

## Cause

The credential rotator promoted a new storage key at 08:58. The upload API read the new key immediately, while long-lived image workers kept the previous key in memory. Storage rejected their writes after the old key expired at 09:11. Each failed job retried three times, so the queue grew faster than the workers could drain it. The rotation runbook checked the upload API but did not exercise a background image job.

## Recovery

At 09:41, the team paused new retries, restarted the image workers so they loaded the current key, and replayed the idempotent jobs from the queue. Storage writes succeeded on the first attempt. Queue age returned below one minute at 10:07 UTC, and support confirmed that the affected posts rendered their images. The team kept the incident open for another hour to watch error rates and queue depth.

[…omitted…]

This is extractive prompt compression: Trimwise keeps original wording and marks omitted gaps, so you can compare the shorter result with the full source.

02 / Try it

Try it on your text.

The report above is loaded here. Change the question or limit, paste your own text, or switch to Shared context for several sources.

Set a token, word, or character limit. Leave room for instructions and the model's answer when building a full prompt. Semantic and hybrid use a model and may take longer. Submitted text goes to the public Trimwise API; avoid secrets or private data.

Result

Selected text

Example · v0.6.0
[…omitted…]

## Cause

The credential rotator promoted a new storage key at 08:58. The upload API read the new key immediately, while long-lived image workers kept the previous key in memory. Storage rejected their writes after the old key expired at 09:11. Each failed job retried three times, so the queue grew faster than the workers could drain it. The rotation runbook checked the upload API but did not exercise a background image job.

## Recovery

At 09:41, the team paused new retries, restarted the image workers so they loaded the current key, and replayed the idempotent jobs from the queue. Storage writes succeeded on the first attempt. Queue age returned below one minute at 10:07 UTC, and support confirmed that the affected posts rendered their images. The team kept the incident open for another hour to watch error rates and queue depth.

[…omitted…]
Input
333 words
Output / limit
144 / 150 words
Selection
lexical

Demo limits: 5 demo requests per minute and 5,000 submitted words daily.

03 / Benchmarked

Did the useful evidence stay?

Shorter context only helps if it keeps what the next task needs. We checked both required source passages and short answers from a model.

Trimwise Hybrid / keeping needed passages

62.5%

Observed in 160 examples, where a pass meant keeping every marked passage together, leaving out prohibited text, and fitting within 256 tokens. RECOMP NQ sentence adapter was the second best method in the results and passed 30.6%.

See how passages were scored ↗

Short answers · 93-case check

46.2% vs 45.2%

GPT-5.4 Mini matched the expected short answer with a 256-token Trimwise Hybrid compressed context in 46.2% of cases, versus 45.2% with the full source.

See the answer check ↗

Run the same example locally.

You can reproduce the result above on your machine. Download the incident text as incident.md, then run Trimwise 0.6.0 with the same question and 150-word limit:

python -m pip install 'trimwise==0.6.0'
python - <<'PY'
from pathlib import Path
from trimwise import Trimmer

result = Trimmer().trim(
    Path('incident.md').read_text(),
    limit=150,
    unit='words',
    strategy='lexical',
    query="Why did the image workers fail, and how did the team restore service?",
)
print(result.text)
print(result.output_count)
PY

Trimwise is open-source Python software. You can also call the public API without a key.