Run this model with HF Jobs

Run JP-AI-2026/Sweepcoder_300M 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 and TRL to fine-tune https://huggingface.co/JP-AI-2026/Sweepcoder_300M. 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/JP-AI-2026/Sweepcoder_300M 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.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/JP-AI-2026/Sweepcoder_300M. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/JP-AI-2026/Sweepcoder_300M. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
File size: 4,141 Bytes
cbff7ba
 
0c08c16
 
 
 
 
 
 
 
 
 
 
 
 
 
cbff7ba
0c08c16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2372ff0
 
 
 
0c08c16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
---
license: apache-2.0
language:
  - en
  - code
library_name: transformers
pipeline_tag: text-generation
tags:
  - code
  - python
  - javascript
  - html
  - c
  - cpp
  - fim
  - slm
---

# SweepCoder-300M

SweepCoder-300M is a ~304M parameter code model trained from scratch on 45B tokens, focused specifically on **Python, JavaScript, HTML, C, and C++**.

Most small models try to do a bit of everything—general chat, trivia, and dozens of programming languages—which leaves very little capacity for writing clean, reliable code. For this release, I kept the parameter count compact and dedicated the entire training run to five core languages so it can run fast locally while still handling real syntax, types, and boilerplate well.

---

## Specs

- **Developer:** [JP-AI-2026](https://huggingface.co)
- **Parameters:** ~304M (`bf16`, tied embeddings)
- **Architecture:** Llama-style decoder (24 layers, `d_model=896`, `intermediate_size=2432`, SwiGLU, RMSNorm)
- **Attention:** Grouped-Query Attention (14 Q heads, 2 KV heads, `head_dim=64`)
- **Context Length:** 4,096 tokens (RoPE `theta=100000`)
- **Vocab:** 49,152 tokens (includes `<fim_prefix>`, `<fim_suffix>`, `<fim_middle>`)
- **License:** Apache 2.0

---

## How It Was Trained

The model was pre-trained from scratch on **45 billion tokens** across four main buckets:

- **Filtered Code:** Clean, educational open-source code across Python, C++, JavaScript, C, and HTML.
- **Syntax-Verified Synthetic Example:** Self-contained coding problems, tutorials, and bug-fix pairs. Every synthetic sample was passed through language parsers/compilers (`ast`, `node`, `gcc`/`g++`) before training to filter out broken syntax.
- **Math & Logic:** Step-by-step math and algorithmic reasoning data to help with indexing, loops, and control flow.
- **Technical Docs:** Computer science reference text and documentation so the model handles comments and docstrings naturally.

Training followed a Warmup-Stable-Decay (WSD) schedule using Muon for 2D weight matrices and AdamW for embeddings/norms, with a final annealing phase weighted toward the cleanest code examples. Around 30% of code files were formatted with Fill-in-the-Middle (FIM) during pre-training so it works out of the box for inline autocomplete.

---

## Usage

### Code Continuation

```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "JP-AI-2026/SweepCoder-300M"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)

prompt = "def merge_sorted_lists(a: list[int], b: list[int]) -> list[int]:\n"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)

out = model.generate(
    **inputs,
    max_new_tokens=128,
    do_sample=False,
    pad_token_id=tokenizer.eos_token_id,
)

print(tokenizer.decode(out[0], skip_special_tokens=True))
```

### Fill-in-the-Middle (FIM)

```python
prefix = "int factorial(int n) {\n    if (n <= 1) return 1;\n    "
suffix = "\n}"

prompt = f"<fim_prefix>{prefix}<fim_suffix>{suffix}<fim_middle>"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)

out = model.generate(
    **inputs,
    max_new_tokens=64,
    do_sample=False,
    pad_token_id=tokenizer.eos_token_id,
)

print(tokenizer.decode(out[0], skip_special_tokens=False))
```

---

## What to Expect

**Good for:**
- Fast local IDE autocomplete (FIM) on CPU or low-VRAM GPUs
- Writing standalone functions, standard algorithms, and data structures
- C/C++ boilerplate, Python scripting, and basic HTML/JS DOM logic

**Limitations:**
- At 304M parameters, it works best on short-to-medium snippets (~20–120 lines). On long multi-file tasks, it will lose track of context.
- Trained strictly on Python, JS, HTML, C, and C++—don't expect strong results on other languages or general chat.
- Always test generated code before using it in real projects.

---

## Citation

```bibtex
@misc{sweepcoder300m_2026,
  title = {SweepCoder-300M},
  author = {JP-AI-2026},
  year = {2026},
  url = {https://huggingface.co/SweepCoder-300M}
}
```