/ Модель

Характеристики

Лицензия
Apache 2.0
Опубликована
14 окт 2026

trim-1

Ранжирование текстаТекст → score10 профессий
0скачиваний за 30 дней25лайковвеса обновлены28 ноя 2026

Описание модели

Составлено на русском по карточке модели и метаданным Hugging Face

trim-1 — компактная модель на деревьях градиентного бустинга, которая отбирает полезные строки контекста по запросу для сокращения длинных документов и результатов инструментов.

trim-1 — компактная модель компрессии контекста, разработанная Caveman. Это не нейросеть: модель состоит из 712 деревьев градиентного бустинга и занимает 1,2 МБ. Она оценивает строки контекста относительно запроса и отбирает наиболее полезные, сохраняя исходный текст и порядок строк. Реализация на Go работает на одном ядре CPU без GPU и сетевых запросов.

Модель предназначена для сокращения длинных документов, результатов поиска, кода, журналов и вывода инструментов перед передачей контекста ИИ-агенту или языковой модели. В описанных тестах режим balanced сокращал токены длинных документов в среднем на 88,9%, сохраняя размеченные свидетельства в 94,4% случаев; для найденного кода сокращение составляло 21,8%. Эти результаты получены на конкретных наборах и не гарантируют качество на других данных.

trim-1 работает построчно и требует запроса. Она не переписывает и не суммирует оставленный текст, не сокращает отдельные длинные строки и может терять связанные сущности, если последующие фрагменты не совпадают с запросом по словам. Обучение и оценка проводились на английском тексте и исходном коде. Лицензия — Apache-2.0.

Сценарии применения

  • сокращение длинных документов перед ответом на вопрос
  • отбор подтверждающих фрагментов для многошагового поиска по документам
  • сжатие результатов поиска для передачи языковой модели
  • сокращение журналов ошибок перед анализом агентом
  • отбор релевантных строк из найденного кода

Ограничения

Модель требует непустого запроса, отбирает только целые строки и может терять поздние звенья цепочки сущностей, если они не имеют общих слов с запросом. Показатели основаны на одном запуске бенчмарков; англоязычные тесты не подтверждают качество на других языках.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

Для каких профессий подходит10

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

[!NOTE] trim-1 is a 1.2 MB extractive line-level context compressor (712 gradient-boosted trees, pure Go, no GPU) that keeps the exact lines of context an AI agent needs for its current query and drops the rest.

On frozen 2026-10-11 holdout suites at the default balanced setting, it cuts 88.9% of tokens on long multi-hop QA (8k–32k tokens) while keeping labelled evidence on 94.4% of cases (85.6% vs 88.9% full-context reader accuracy), cuts 21.8% on retrieved code (90.7% evidence kept), and runs in 7.2 ms p50 on 5,000 tokens on one CPU core (28 MB RSS).

  • 1.2 MB: 712 gradient-boosted trees, not a neural network.
  • Milliseconds on one CPU core: no GPU, no network call, no extra model request.
  • Deterministic: no sampling and no randomness; the same context and query always produce the same output.
  • Verbatim: every kept line is an unmodified line of the input, in original order, with a short marker where lines were removed — identifiers, paths, and error text never get rewritten or summarized.

It saves the most on long-document retrieval, where it removes most of the input and keeps the evidence. On short coding-agent tool outputs it saves little by design (see Which setting to use). trim-1 is the model inside Caveman; source code lives at caveman-ai/trim-1.

How it works

  1. The context (a tool result, file, log, or long chat) is split into lines.
  2. Each line receives 67 numeric features computed against the query:
    • Lexical match: BM25 against the query, query-term coverage, shared bigrams and trigrams, compound identifier hits.
    • Line kind: whether the line reads as an error, test result, path, heading, diff header, function signature, JSON key, or stack frame.
    • Position and shape: where the line sits, its length, its indent, and how the indent changes.
    • Neighbours: how the lines around it, and its enclosing header, score.
  3. The 712 trees turn each feature row into a keep probability.
  4. An operating point selects every line scoring above a share of the best line's score, the top few lines regardless, one line of context on each side, and the enclosing block header.

trim-1 fails closed: it returns the context unchanged when the query is blank, the context is under 2,000 bytes, the context is over 8 MiB or 200,000 lines, or the cut would remove less than 10% of the bytes.

Benchmarks

Evidence kept

A case passes when every piece of labelled evidence survives in the output.

Answers kept

A reader model answers from the compressed output and a judge model grades the answer against the uncompressed context ("Full").

Speed and memory

Which setting to use

The setting decides how hard trim-1 cuts, and cutting harder costs quality. Every line removed is a line the downstream model can no longer read, so a higher setting saves more tokens and loses more of what the task needed.

  • Coding-agent tool outputs: use a low setting. Stay at balanced or conservative. A tool output is short and dense: most of its lines are things the agent uses in its next turns. At balanced, trim-1 keeps all of it and saves about 2%. Pushed to a 27% cut, 8% of cases lose something the agent went on to use. Expect small savings here, and do not raise the setting to get more.
  • Long-document retrieval: this is what trim-1 is for. A long document holds a few lines that answer the query and a lot that do not. At balanced, trim-1 removes 89% of the tokens and keeps the supporting evidence in 94% of cases, and a reader model answers 85.6% of questions from the output against 88.9% from the full document. aggressive drops that to 76.7%, so balanced is the setting to use here too.
  • Retrieved code sits in between. balanced cuts 22% and keeps the lines the fix touches in 91% of cases. aggressive cuts 67% and keeps them in 57%, which is too lossy for most uses.

Usage

The code is at caveman-ai/trim-1. It is pure Go with no dependencies, and the model is embedded.

go install github.com/caveman-ai/trim-1/cmd/trim@latest
trim --query "why does the build fail" build.log

From Go:

import trim "github.com/caveman-ai/trim-1"

res := trim.Compress(context, query, trim.Options{Point: "balanced"})
fmt.Print(res.Output)

Training data

trim-1 was trained on public, commercially licensed data only. Labels come directly from each source: human-marked spans and supporting facts, the lines a gold patch edits, the element a person acted on, and what a coding agent used in its next turns. No language model wrote a label.

  • Agent trajectories: public coding-agent runs, labelled by what the agent used next.
  • Code context: issue-and-patch datasets over permissively licensed repositories.
  • Documents and chat: question answering, contract, finance, and meeting datasets with human evidence labels.
  • Structured output: web pages, tool catalogs and API responses, SQL schemas, tables, and CI logs.

Non-commercial and unlicensed datasets, and code from copyleft or unlicensed repositories, were left out. Every training context was checked against the evaluation contexts and repositories and removed on a match. No private session data is in the model.

Files

"KEEP"                           4 bytes
version                          uint32 (1)
features, trees, nodes, leaves   uint32 each (67, 712, 44144, 44856)
feature names                    each: uint16 length + bytes
tree roots                       []int32
node feature                     []int32
node threshold                   []float64
node left, node right            []int32 each
leaf values                      []float64

A child or root below zero is the leaf ^index. A node sends a row left when row[feature] <= threshold. A line's score is the sigmoid of the summed leaf values.

Limitations

  • Entity chains: trim-1 drops later hops that share no words with the query. This is the main cause of its haystack losses.
  • Needs a query: with no query it does nothing.
  • Line-level only: it keeps or drops whole lines; it does not shorten a long line.
  • English: training and evaluation data are English text and source code.
  • One run: the numbers above come from a single run. Suites are clustered by session, repository, or conversation, so per-case intervals understate the uncertainty. The judge model was not validated against human labels.
  • In-distribution QA: the multi-hop QA suites use the validation split of a dataset whose train split is in the training data.
  • Not a savings claim: token cuts are local token counts on benchmark cases, not measured provider billing.

License

Apache-2.0.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм

Нельзя запустить

В репозитории нет config.json: не понять архитектуру модели.

Ревизия весов
9078d35

0 моделей