Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 23 min read How-to mediumAdept

Creating a Coding Assistant with StarCoder

StarCoder, BigCode's 16B-parameter open code model with an 8k context window, can be turned into a coding assistant either by dialogue prompting or by fine-tuning it on conversations. Prompting with a long system message and example dialogues works but is expensive, since every turn resends thousands of tokens. The cheaper route is fine-tuning on the English subset of the OpenAssistant dataset, about 21k dialogues, formatted with ChatML-style special tokens (<|system|>, <|user|>, <|assistant|>, <|end|>) added to the tokenizer so generation stops cleanly at turn boundaries. Training uses 🤗 Transformers with DeepSpeed ZeRO-3, and the resulting StarChat model, dataset and code are released.

Assumes: LLM basicsHugging Face TransformersPython

Related posts

  • StarCoder: A State-of-the-Art LLM for Code

    Hugging Face easyNovice

    StarCoder and StarCoderBase are ~15B-parameter code LLMs trained on 1 trillion tokens of permissively licensed GitHub data from The Stack 1.2, covering 80+ languages, commits, issues and notebooks, with StarCoder further fine-tuned on 35B Python tokens. With an 8K+ token context, they beat other open code models and match or exceed OpenAI's code-cushman-001 on HumanEval, MBPP, MultiPL-E and DS-1000. A solution-file prompt prefix lifts StarCoder's HumanEval score from 34% to 40.8%, and prompting alone turns the model into a technical assistant. The release includes weights under OpenRAIL-M, training code, an evaluation harness, a PII-redaction dataset and a code attribution tool.

  • Personal Copilot: Train Your Own Coding Assistant

    Hugging Face hardMaster

    HugCoder is a code LLM fine-tuned on the top 10 Hugging Face GitHub repositories, built by cloning repos in parallel, filtering non-code files and training StarCoder with a fill-in-the-middle objective. Full fine-tuning of the 15.5B model on 8×A100 80GB with FSDP took 9 hours (~$108), while QLoRA on a single A100 40GB took 12.5 hours (~$13.75), with a per-parameter memory breakdown explaining why. QLoRA reached slightly higher loss than full fine-tuning but preserved HumanEval pass@1 (33.37 vs 33.57) and matched it qualitatively on HF-specific infilling where GitHub Copilot failed. The post also covers serving the model in VS Code via Inference Endpoints, training a chat variant, and combining LoRA adapters across tasks and base models.

  • CoderForge-Preview: SOTA open dataset for training efficient coding agents

    Together AI hardMaster

    CoderForge-Preview is an open dataset of 258K test-verified coding agent trajectories (155K passing) covering 51K tasks across 1,655 repositories from R2E-Gym, SWE-Smith and SWE-Rebench. The trajectories were generated with Qwen3-Coder-480B in OpenHands Docker environments, filtered by rejection sampling and permissive-license audits, and cost about $130K to produce at a ~90% prompt cache hit rate. Fine-tuning Qwen3-32B on the passing trajectories, using Ulysses sequence parallelism, multipacking and token-level loss normalization at 128K context, reaches 59.4% pass@1 on SWE-Bench Verified, and a 4B model reaches 43.0%. Ablations show a repetition penalty helps only early checkpoints, so later checkpoints should be run without one.

  • StarCoder2-Instruct: Fully Transparent and Permissive Self-Alignment for Code Generation

    Hugging Face hardMaster

    StarCoder2-15B-Instruct is instruction-tuned entirely on data generated by its own base model, with no human annotations or distillation from proprietary LLMs. The pipeline filters 5M docstring-bearing Python functions from The Stack v1 down to 250k seeds using Pyright type checking, decontamination, LLM-judged docstring quality and MinHash deduplication. It then has the model extract code concepts and write 238k instructions, and keeps only responses that pass self-generated tests executed in a sandbox, ending with 50k SFT pairs. The model scores 72.6 on HumanEval, beating CodeLlama-70B-Instruct, and outperforms a GPT-4-distilled variant on LiveCodeBench, suggesting models learn better from in-distribution self-generated data.

  • Code Llama: Llama 2 learns to code

    Hugging Face mediumAdept

    Code Llama is a family of 7B, 13B and 34B Llama 2 derivatives trained on 500B tokens of code. It comes in base, Python-specialized and instruction-tuned variants, has a 16k training context that extrapolates to 100k via RoPE frequency scaling, and supports fill-in-the-middle infilling in the 7B and 13B models. Hugging Face integration starts at transformers 4.33, with code for completion, infilling with the <FILL_ME> token, the Llama 2 chat prompt template, and 4-bit bitsandbytes loading. Recommended setup is float16 for inference and bfloat16 for fine-tuning, plus GPU sizing guidance for TGI/Inference Endpoints and HumanEval/MultiPL-E evaluation.

The quest for software engineering knowledge.

Look:
Layout: