1,346 Downloads Updated 3 weeks ago
ollama run paritok/paritok-4b-v1:f16
Updated 3 weeks ago
3 weeks ago
458d88a8878f Β· 8.1GB Β·
base_model: Qwen/Qwen3-4B-Instruct-2507 library_name: peft pipeline_tag: text-generation license: apache-2.0 language: - en tags: - code - compression - coding-agent - lora - sft - claude-code - cursor model-index: - name: paritok-4b-v1 results: - task: type: text-compression dataset: name: SWE-bench Verified type: swe-bench-verified metrics: - name: Quality retained type: quality-retained value: 86.5 - name: Compression rate type: compression-rate
The first open-source compression model trained specifically for coding agents.
Cut Claude / GPT input token bills by up to 95% while retaining 86.5% of full-context solve quality on SWE-bench Verified.
~74%Fewer tokensTypical CR = 25.7% Up to 95% on long sessions |
86.5%Solve quality retainedSWE-bench Verified Matches gpt-4.1-mini |
4BSelf-hostable LoRASingle 24GB GPU Apache 2.0, zero fee |
file_read, bash_command, log_outputβ¦). Preserves function names, imports, paths, and error strings while compressing.import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
BASE_MODEL = "Qwen/Qwen3-4B-Instruct-2507"
ADAPTER = "paritok/paritok-4b-v1"
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
base = AutoModelForCausalLM.from_pretrained(
BASE_MODEL, torch_dtype=torch.bfloat16, device_map="auto"
)
model = PeftModel.from_pretrained(base, ADAPTER)
model.eval()
# Wrap your code as [SEG id=1 kind=file_read] ... [/SEG]
user_msg = "[SEG id=1 kind=file_read]\n<your code here>\n[/SEG]"
prompt = tokenizer.apply_chat_template(
[{"role": "system", "content": "<full system prompt β see GitHub>"},
{"role": "user", "content": user_msg}],
tokenize=False, add_generation_prompt=True,
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=1024, do_sample=False)
print(tokenizer.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
π Full runnable example + system prompt + reproduction pipeline: GitHub β Paritok-official/paritok-4b-v1
| Context source | Quality retained ΒΉ | Compression rate |
|---|---|---|
| Uncompressed baseline | 100.0% | 100.0% |
| gpt-4.1-mini (compressor) | 85.6% | 50.2% |
| gpt-5 (compressor) | 93.6% | 61.9% |
| Paritok-4B-v1 β | 86.5% | 25.7% |
ΒΉ Quality retained = compressor solve rate Γ· uncompressed baseline solve rate. Higher is better.
Paritok compresses ~2Γ harder than gpt-4.1-mini on the same task while keeping the same solve rate β the only open-source entry trained end-to-end on real coding-agent trajectories.
| Turn input size | Uncompressed input | With Paritok |
|---|---|---|
| Short (8K) | $0.024 | $0.006 |
| Typical (15K) | $0.045 | $0.012 |
| Long session (30K) | $0.090 | $0.023 |
10-person team, 3-month project β save ~$10K on API bills.
@misc{paritok2026,
author = {Paritok Team},
title = {Paritok: Fine-tuned Compression for AI Coding-Agent Context},
year = {2026},
publisher = {GitHub},
howpublished = {\url{https://github.com/Paritok-official/paritok-4b-v1}},
}
Apache 2.0 β see LICENSE. Base model (Qwen3-4B-Instruct-2507) is under its own license; please review before commercial deployment.
GitHub Β· paritok.com Β· Contact