---
title: "Creating a Coding Assistant with StarCoder"
description: "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."
url: "https://swe.quest/articles/creating-a-coding-assistant-with-starcoder-ee69e88ef6796911"
canonical: "https://huggingface.co/blog/starchat-alpha"
source: "Hugging Face"
published: "2023-05-09"
difficulty: "medium"
kind: "How-to"
reading_minutes: 23
tags: ["model-training","llms","ai-coding","python"]
---

# Creating a Coding Assistant with StarCoder

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2023-05-09, 23 min read, How-to. Original: [https://huggingface.co/blog/starchat-alpha](https://huggingface.co/blog/starchat-alpha)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- LLM basics ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- Hugging Face Transformers
- Python ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))

## Keywords

StarCoder, StarChat, ChatML, DeepSpeed ZeRO-3, OpenAssistant, Hugging Face Transformers, BigCode

## Related posts

- [StarCoder: A State-of-the-Art LLM for Code](https://swe.quest/articles/starcoder-a-state-of-the-art-llm-for-code-ae224d2374e67db4.md): Hugging Face · 2023-05-04 · Easy · 5 min read · LLMs, AI for coding, Evaluation, Open source
  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.
- [Personal Copilot: Train Your Own Coding Assistant](https://swe.quest/articles/personal-copilot-train-your-own-coding-assistant-058d44307821dd4e.md): Hugging Face · 2023-10-27 · Hard · 15 min read · Model training, AI for coding, LLMs
  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.
- [CoderForge-Preview: SOTA open dataset for training efficient coding agents](https://swe.quest/articles/coderforge-preview-sota-open-dataset-for-training-efficient-coding-agents-83e1f3c7a7bdb67a.md): Together AI · 2026-02-25 · Hard · 14 min read · Model training, AI for coding, AI agents, Evaluation, LLMs
  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.
- [StarCoder2-Instruct: Fully Transparent and Permissive Self-Alignment for Code Generation](https://swe.quest/articles/starcoder2-instruct-fully-transparent-and-permissive-self-alignment-for-code-7d548d6a3e65fc89.md): Hugging Face · 2024-04-29 · Hard · 6 min read · Model training, LLMs, AI for coding, Evaluation
  StarCoder2-15B-Instruct is instruction-tuned entirely on data generated by its own base model, with no human annotations or distillation from proprietary LLMs.
- [Code Llama: Llama 2 learns to code](https://swe.quest/articles/code-llama-llama-2-learns-to-code-bbc6e9367fb26138.md): Hugging Face · 2023-08-25 · Medium · 12 min read · LLMs, AI for coding, Inference & serving, Python, Evaluation
  Code Llama is a family of 7B, 13B and 34B Llama 2 derivatives trained on 500B tokens of code.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
