SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2608.24188 · 2026

Paritok-4B: Intent-Conditioned Context Compression for Coding Agents

Jiayu Shi, Luzhuo Chen

arXiv · PDF

Code that ran

7 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 3 violated it and 0 have no contract verdict; 4 failures of our instrument; 4 no recorded run), measured 2026-11-24; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2608.24188.json · badge: /api/ran/2608.24188.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
Paritok-official/paritok-4b-v1 canonical (classifier label)
classifier basis: census
7 ran · 4 no recorded run
FunctionStatusWhere it lives
apply_selection Ran
ran; our contract draft was wrong, not the code
Paritok-official/paritok-4b-v1/paritok/tool_topk.py
code served (permissive licence) · get_code("873b2f50274887b3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

# Setup code for apply_selection function

ARGS = {
    'tools': [
        {
            'name': 'tool_one',
            'description': 'A standard tool that should be kept',
            'function': {
                'name': 'tool_one',
                'description': 'Function description for tool one'
            }
        },
        {
            'name': 'mcp__tool_two',
            'description': 'An MCP tool that will be stubbed if not in keep_names',
            'function': {
                'name': 'mcp__tool_two',
                'description': 'MCP function description'
            }
        },
        {
            'name': 'tool_three',
            'description': 'Another standard tool',
            'function': {
                'name': 'tool_three',
                'description': 'Function description for tool three'
            }
        },
        {
            'name': 'mcp__tool_four',
            'description': 'Another MCP tool to be stubbed',
            'function': {
                'name': 'mcp__tool_four',
                'description': 'MCP function description four'
            }
        }
    ],
    'keep_names': {'tool_one', 'tool_three'},
    'wire': 'anthropic'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
content_hash Ran
ran; our contract draft was wrong, not the code
Paritok-official/paritok-4b-v1/paritok/storage.py
code served (permissive licence) · get_code("dcaf987a228b2052")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import hashlib

def content_hash(content: str) -> str:
    """SHA256 hash of content, used as shadow_id."""
    return hashlib.sha256(content.encode('utf-8')).hexdigest()[:16]

ARGS = {
    "content": "The quick brown fox jumps over the lazy dog"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
is_expand_call Ran
ran, violated the contract we drafted
Paritok-official/paritok-4b-v1/paritok/pipelines/virtual.py
code served (permissive licence) · get_code("54d1f09ecff523fc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

EXPAND_TOOL_NAME = 'read_original'

EXPAND_TOOL_ALIASES = {EXPAND_TOOL_NAME, 'expand_context'}

def is_expand_call(tool_name: str) -> bool:
    """True for the expand tool under either its current or legacy name."""
    return tool_name in EXPAND_TOOL_ALIASES

ARGS = {
    'tool_name': 'read_original'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
is_virtual_tool_call Ran
ran, violated the contract we drafted
Paritok-official/paritok-4b-v1/paritok/pipelines/virtual.py
code served (permissive licence) · get_code("60354326a5e0c943")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

EXPAND_TOOL_NAME = 'read_original'

EXPAND_TOOL_ALIASES = {EXPAND_TOOL_NAME, 'expand_context'}

VIRTUAL_TOOL_NAMES = EXPAND_TOOL_ALIASES | {'gateway_search_tools'}

def is_virtual_tool_call(tool_name: str) -> bool:
    return tool_name in VIRTUAL_TOOL_NAMES

ARGS = {
    'tool_name': 'read_original'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
looks_like_missing_tool_help Ran
ran, violated the contract we drafted
Paritok-official/paritok-4b-v1/paritok/tool_topk.py
code served (permissive licence) · get_code("1ef84960d2b01625")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

_HELP_HINT = re.compile("((do(n'?| no)t|does(n'?| no)t) have\\b.{0,40}\\b(tool|connector|integration|access|ability)|no\\b.{0,30}\\b(tool|connector|integration)\\b.{0,20}\\bavailable|not available in this (session|environment)|is(n'?t| not) available|can'?t (complete|do that|help with that|look (this|that) up))", re.I)

def looks_like_missing_tool_help(agent_text: str) -> bool:
    """True if the agent's response signals it lacked a tool to finish the task
    (e.g. "I don't have a calendar integration", "no Gmail tool available",
    "the X tool isn't available", "I can't complete this request").
    Measured: fires on 3/3 real MCP misses; standard-tool tasks that succeed don't."""
    return bool(_HELP_HINT.search(agent_text or ''))


ARGS = {
    "agent_text": "I don't have a calendar integration to complete this task."
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
match_region Ran
ran; our contract draft was wrong, not the code
Paritok-official/paritok-4b-v1/paritok/pipelines/edit_recovery.py
code served (permissive licence) · get_code("fa73c5db1a0fbd68")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

_TRAILING_COMMA = re.compile(',(\\s*)([)\\]}])')

_TRIPLE_STR = re.compile('"""(?:.|\\n)*?"""|\\\'\\\'\\\'(?:.|\\n)*?\\\'\\\'\\\'')

_LINE_COMMENT = re.compile('#[^\\n]*')

def _canon_with_map(s: str) -> tuple[str, list[int]]:
    """Canonicalize `s` to the lint-equivalent form and return (canonical, offset_map)
    where offset_map[i] is the index in `s` of the i-th kept (canonical) character.

    Dropped (ignored) for matching: all whitespace, a trailing comma right before a
    closing bracket, triple-quoted docstrings, and `# ...` line comments — exactly the
    things the compression lint removes or reflows, so the model's summary-derived
    string and the true original collapse to the same canonical string."""
    drop: set[int] = set()
    for m in _TRAILING_COMMA.finditer(s):
        drop.add(m.start())
    for m in _TRIPLE_STR.finditer(s):
        drop.update(range(m.start(), m.end()))
    for m in _LINE_COMMENT.finditer(s):
        drop.update(range(m.start(), m.end()))
    out: list[str] = []
    omap: list[int] = []
    for i, ch in enumerate(s):
        if ch.isspace() or i in drop:
            continue
        out.append(ch)
        omap.append(i)
    return (''.join(out), omap)

def match_region(old_string: str, original: str) -> str | None:
    """Return the exact substring of `original` whose canonical form equals
    `old_string`'s, or None unless there is exactly one such match."""
    co, _ = _canon_with_map(old_string)
    corig, omap = _canon_with_map(original)
    if not co:
        return None
    starts: list[int] = []
    i = corig.find(co)
    while i != -1:
        starts.append(i)
        i = corig.find(co, i + 1)
    if len(starts) != 1:
        return None
    st = starts[0]
    en = st + len(co) - 1
    return original[omap[st]:omap[en] + 1]


ARGS = {
    "old_string": "x=1",
    "original": "x = 1  # comment"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
strip_read_line_numbers Ran
ran; our contract draft was wrong, not the code
Paritok-official/paritok-4b-v1/paritok/pipelines/edit_recovery.py
code served (permissive licence) · get_code("cd3e7e762ba0cc48")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

_READ_LINENO_TAB = re.compile('^[ \\t]*\\d+\\t', re.M)

def strip_read_line_numbers(text: str) -> str:
    """Turn a Read tool_result ("1\\tcode\\n2\\t...") back into raw file text."""
    return _READ_LINENO_TAB.sub('', text)

# Test input with line numbers in Read tool format
test_text = "1\tdef hello():\n2\t    print('world')\n3\treturn 42"

ARGS = {
    "text": test_text
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
apply_selection_adaptive Not yet run
unverified (harvested, no recorded run)
Paritok-official/paritok-4b-v1/paritok/tool_topk.py
code served (permissive licence) · get_code("0a1c71ee1daac8f4")
How it ran

no invocation recorded.

build_shadow_storage Not yet run
unverified (harvested, no recorded run)
Paritok-official/paritok-4b-v1/paritok/storage.py
code served (permissive licence) · get_code("2718e4da2b56c44d")
How it ran

no invocation recorded.

parse_shell_replaces Not yet run
unverified (harvested, no recorded run)
Paritok-official/paritok-4b-v1/paritok/pipelines/codex_edit_recovery.py
code served (permissive licence) · get_code("23903c550ccee149")
How it ran

no invocation recorded.

recover_edit Not yet run
unverified (harvested, no recorded run)
Paritok-official/paritok-4b-v1/paritok/pipelines/edit_recovery.py
code served (permissive licence) · get_code("0857a4b13cc34b09")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 11 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Coding agents re-send large file reads and tool outputs to a frontier LLM on every turn, and this context dominates their token bill. Prompt-compression models can shrink that context, but general-purpose compressors are trained on prose and are not well suited to code: they paraphrase identifiers and drop the exact spans an agent needs to edit. We present Paritok-4B, a 4Bparameter LoRA compressor trained specifically for coding-agent trajectories under two design commitments: (i) extractive, so the model selects spans rather than rewriting them-measured over the training corpus, 96.0% of emitted identifiers, paths, and numbers already appear in the input (98.3% outside the one kind we rewrite by design), and the same audit run on held-out SWE-bench Lite output gives 96.2% over 212,506 emitted tokens; and (ii) intent-conditioned, so the compressor is told the agent's current task-which we measure to act chiefly inside a retained segment, selecting which lines survive (retained lines are +0.067 more intent-relevant than removed ones, paired 95% CI [+0.056, +0.078]) rather than changing how much is retained. The compressor operates per segment: a gateway splits the agent request into typed segments and compresses each independently, which makes the unit of work small, parallelizable, and individually recoverable. We build the training set by distilling a gpt-4.1-mini teacher over 67,074 real OpenHands agent trajectories through a five-stage funnel, yielding a 45K-segment distillation pool and 40,606 validated examples, and fine-tune a Qwen3-4B backbone with LoRA, selected over 3B and 7B code-pretrained alternatives under a matched protocol. On an out-of-distribution holdout the released checkpoint emits well-formed output on 100% of segments, compresses to 23.7% of input tokens, and-at that budget-shows no degradation in must-keep identifier retention relative to the teacher it was distilled from (0.385 vs. 0.287 on segments both kept; the paired difference is directionally favorable but not significant at n=39). End-to-end on all 300 SWE-bench Lite instances, Paritok-4B compresses agent context to 25.7% of its size-2.0× harder than a gpt-4.1-mini compressor (50.2%) and 2.4× harder than gpt-5 (61.9%)-while retaining 86.5% of uncompressed single-shot solve quality, on par with the gpt-4.1-mini compressor at less than half the tokens; run instead in the in-distribution cat -n regime that real agents produce, the same 300 instances compress slightly less (27.8%) and retain more (89.3%), where the paired comparison is the informative one: 30 instances are solved only uncompressed and 17 only compressed, an exact McNemar p=0.079-at this sample size, compressing context to roughly a quarter of its size does not significantly reduce the solve rate. We are explicit ( §6.2) that this harness measures comprehension under compression, not end-to-end agent cost. The model is a 264 MB LoRA adapter that self-hosts on a single 24 GB GPU with no per-token compressor fee-which, at list prices, is what decides the economics: we show ( §6.3) that gpt-5 used as a compressor is net-negative, costing more to run than the downstream tokens it saves. Weights, data pipeline, and evaluation scripts-including the extractiveness audit-are open (Apache 2.0).

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2608.24188")
get_code_for_paper("2608.24188")
have("2608.24188")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2608.24188.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2608.24188.svg)](https://syntology.ai/paper/2608.24188)

Connect an agent — have() is free.