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.
Sweepcoder_300M / README.md
JP-AI-2026's picture
Update README.md
2372ff0 verified
|
Raw History Blame Contribute Delete
4.14 kB
---
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}
}
```