Downloads · 30 days
206
6% of all-time downloads
sweepai/sweep-next-edit-v2-7B
sweep-next-edit-v2-7B is a text generation model from sweepai. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
Blog: https://blog.sweep.dev/posts/oss-next-edit
Downloads · 30 days
206
6% of all-time downloads
All-time downloads
3.3K
Public
Parameters
7.6B
15.2 GB on disk
Likes
44
Trending 1
Click a slice to open those files.
.safetensors15.2 GB · 100%
From the Hugging Face model README
Blog: https://blog.sweep.dev/posts/oss-next-edit
A 7B parameter model that predicts the next edit a developer will make. Given the current file, recent diffs, and cursor position, the model predicts what code block the developer will change next and how.
pip install transformers torch accelerate
python inference.py
See inference.py for a complete working example.
from inference import build_prompt, generate, FileChunk, DIFF_FORMAT
prompt, code_block, block_start, relative_cursor = build_prompt(
file_path="example.py",
file_contents=edited_contents,
cursor_position=cursor_position,
recent_changes=recent_changes,
retrieval_chunks=[FileChunk("utils.py", "def helper(): ...")],
changes_above_cursor=False,
)
completion = generate(model, tokenizer, prompt, device="cuda")
The model uses <|file_sep|> delimiters and a <|cursor|> marker:
<|file_sep|>{file_path}
{file_contents}
{retrieval_chunks}
{recent_changes_as_diffs}
<|file_sep|>original/{file_path}:{start}:{end}
{code_block_before_last_edit}
<|file_sep|>current/{file_path}:{start}:{end}
{code_block_with_cursor_marker}
<|file_sep|>updated/{file_path}:{start}:{end}
{prefill}
The model completes the updated/ section with the predicted new code block.
original:/updated: format<|cursor|> inserted at cursor positionThe updated/ section is seeded with a prefill to constrain generation:
changes_above_cursor=False): Prefill everything up to the cursor line. The model only generates from the cursor line onward.changes_above_cursor=True): Prefill only the first line + trailing blank lines. Gives the model freedom to rewrite lines between the insertion point and cursor.<|file_sep|>{file_path}:{start_line}:{end_line}
original:
{old_code}
updated:
{new_code}
Fine-tuned from Qwen2.5-Coder-7B on developer editing traces using SFT, then GRPO, then DPO.
<table> <tr><td>Base model</td><td>Qwen2.5-Coder-7B</td></tr> <tr><td>Fine-tuning</td><td>SFT → GRPO → DPO</td></tr> <tr><td>Parameters</td><td>7B</td></tr> <tr><td>Precision</td><td>bfloat16</td></tr> <tr><td>Context length</td><td>32,768 tokens</td></tr> <tr><td>Architecture</td><td>Qwen2 (28 layers, hidden dim 3584)</td></tr> <tr><td>Stop tokens</td><td><code><|endoftext|></code>, <code><|file_sep|></code></td></tr> <tr><td>Max output tokens</td><td>1024</td></tr> <tr><td>Decoding</td><td>Greedy (temperature=0)</td></tr> </table>