Run this model with HF Jobs
Run ayanami-kitasan/code-pruner on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/ayanami-kitasan/code-pruner. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/ayanami-kitasan/code-pruner on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use ayanami-kitasan/code-pruner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ayanami-kitasan/code-pruner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="ayanami-kitasan/code-pruner")# pip install -U transformers accelerate # Load model directly from transformers import SwePrunerForCodeCompression model = SwePrunerForCodeCompression.from_pretrained("ayanami-kitasan/code-pruner", device_map="auto") - Notebooks
- Google Colab
- Kaggle
SWE-Pruner: Self-Adaptive Context Pruning for Coding Agents
SWE-Pruner is a self-adaptive context pruning framework specifically designed for coding agents. It addresses the challenges of long interaction contexts, such as high API costs and latency, by performing task-aware adaptive pruning.
- Paper: SWE-Pruner: Self-Adaptive Context Pruning for Coding Agents
- Repository: https://github.com/Ayanami1314/swe-pruner
Description
Inspired by how human programmers selectively skim code, SWE-Pruner enables agents to formulate explicit goals (e.g., "focus on error handling") which guide a lightweight neural skimmer (0.6B parameters). This skimmer dynamically selects relevant lines from the surrounding context, preserving critical implementation details while significantly reducing token usage.
Evaluations across benchmarks show that SWE-Pruner achieves 23-54% token reduction on agent tasks like SWE-Bench Verified and up to 14.84x compression on single-turn tasks like LongCodeQA with minimal performance impact.
Model Usage
Given that we have made significant modifications to the model, its dual-head architecture and the complex compression head service code will be rather complex. Therefore, we recommend that you use the version we have released on GitHub instead of attempting to use the original model on your own.
Citation
If you find SWE-Pruner useful in your research, please cite:
@misc{wang2026sweprunerselfadaptivecontextpruning,
title={SWE-Pruner: Self-Adaptive Context Pruning for Coding Agents},
author={Yuhang Wang and Yuling Shi and Mo Yang and Rongrui Zhang and Shilin He and Heng Lian and Yuting Chen and Siyu Ye and Kai Cai and Xiaodong Gu},
year={2026},
eprint={2601.16746},
archivePrefix={arXiv},
primaryClass={cs.SE},
url={https://arxiv.org/abs/2601.16746},
}
- Downloads last month
- 221