Split View: 코드 모델 고르기: 자동완성과 대화형, FIM, 라이선스
코드 모델 고르기: 자동완성과 대화형, FIM, 라이선스
- 코드 모델은 두 가지 다른 제품입니다
- 자동완성에는 중간 채우기가 필요합니다
- 기본 모델에 채팅을 시키지 마세요
- 대화형 코드 모델
- 에이전트형 코딩은 또 다른 요구입니다
- 컨텍스트 길이가 코드에서 특히 중요한 이유
- 라이선스가 가장 조심스러운 범주
- 코드 예시
- 고를 때의 순서
- 직접 해보기
- 시리즈 안내
- 참고 자료
모델 정보는 2026-08-12에 Hugging Face 페이지에서 직접 확인했습니다. 모델 카드와 라이선스는 바뀔 수 있으니 사용 전 원본을 다시 확인하세요.
코드 모델은 두 가지 다른 제품입니다
코드 모델을 고르는 첫 갈림길은 크기가 아니라 용도입니다. 편집기에서 커서 위치를 채우는 자동완성과, 질문에 설명이 붙은 답을 내놓는 대화형은 요구하는 능력이 다릅니다.
자동완성은 지연이 전부입니다. 사용자가 타이핑을 멈춘 사이에 결과가 나와야 하므로 대개 작은 모델을 쓰고, 커서 앞뿐 아니라 뒤에 있는 코드도 함께 보아야 합니다. 대화형은 몇 초를 기다려도 되는 대신 설명과 근거를 요구합니다. 이 둘을 하나의 모델로 해결하려 하면 대개 양쪽 다 어정쩡해집니다.
자동완성에는 중간 채우기가 필요합니다
편집기 자동완성이 어려운 이유는 커서 뒤에도 코드가 있기 때문입니다. 앞부분만 보고 이어 쓰면 아래에 이미 있는 함수와 충돌합니다. 그래서 앞과 뒤를 모두 주고 가운데를 채우게 하는 중간 채우기 학습이 필요합니다.
| 저장소 | license | 크기 | 컨텍스트 | 중간 채우기 표기 |
|---|---|---|---|---|
bigcode/starcoder2-7b | bigcode-openrail-m | 7B | 16,384, 슬라이딩 윈도 4,096 | 중간 채우기 목표로 학습했다고 명시 |
google/codegemma-7b | gemma | 스펙 칸에 9B params | 명시되어 있지 않음 | 전용 토큰을 명시 |
deepseek-ai/deepseek-coder-6.7b-instruct | deepseek | 6.7B | 16K | 프로젝트 수준 완성과 채움을 위한 빈칸 채우기 과제를 명시 |
Qwen/Qwen2.5-Coder-1.5B | apache-2.0 | 1.54B (임베딩 제외 1.31B) | 32,768 | 적용 가능한 과제로 언급, 토큰 이름은 명시되어 있지 않음 |
google/codegemma-7b 카드는 사용할 토큰 이름까지 적어 둡니다. <|fim_prefix|>, <|fim_suffix|>, <|fim_middle|>, <|file_separator|>입니다. 편집기 확장을 직접 만든다면 이 형식을 정확히 맞춰야 하고, 모델마다 토큰이 다르므로 교체할 때 프롬프트 조립 코드도 함께 바꿔야 합니다.
주의할 점은 대화형 변형에 중간 채우기 표기가 반드시 있는 것은 아니라는 사실입니다. Qwen/Qwen2.5-Coder-7B-Instruct 페이지에는 중간 채우기가 명시되어 있지 않습니다. 자동완성용으로 쓰려면 같은 계열의 기본 모델 쪽을 확인하는 편이 맞습니다.
기본 모델에 채팅을 시키지 마세요
bigcode/starcoder2-7b 카드는 이 모델이 지시 모델이 아니며 제곱근을 계산하는 함수를 작성하라 같은 명령은 잘 동작하지 않는다고 직접 적습니다. Qwen/Qwen2.5-Coder-1.5B 카드도 기본 언어 모델을 대화에 쓰는 것을 권하지 않는다고 적습니다.
이 문장을 못 보고 기본 모델에 질문을 던지면, 모델은 질문을 이어 쓰기 시작합니다. 그리고 팀은 이 모델이 나쁘다고 결론 내립니다. 실제로는 용도가 다른 물건을 쓴 것뿐입니다. 저장소 이름 끝에 Instruct가 붙어 있는지부터 확인하세요.
bigcode/starcoder2-7b은 컨텍스트 표기도 살펴볼 가치가 있습니다. 16,384로 적혀 있지만 슬라이딩 윈도 어텐션 폭이 4,096이라는 설명이 함께 붙습니다. 표기된 최대 길이와 실제로 한 번에 참조되는 범위가 다를 수 있다는 뜻입니다. 학습 데이터는 The Stack v2이고 17개 프로그래밍 언어라고 적혀 있습니다.
대화형 코드 모델
| 저장소 | license | 크기 | 컨텍스트 | 카드에 적힌 특징 |
|---|---|---|---|---|
Qwen/Qwen2.5-Coder-7B-Instruct | apache-2.0 | 7.61B (임베딩 제외 6.53B) | 기본 32,768, YaRN으로 131,072 | 코드 생성·추론·수정 개선, 코드 에이전트 용도 언급 |
deepseek-ai/deepseek-coder-6.7b-instruct | deepseek | 6.7B | 16K | 코드 87퍼센트와 자연어 13퍼센트로 2조 토큰 학습, 명령 데이터 20억 토큰으로 미세조정 |
deepseek-ai/deepseek-coder-6.7b-instruct 카드가 밝히는 학습 데이터 구성은 드물게 구체적입니다. 영어와 중국어 자연어 13퍼센트에 코드 87퍼센트라는 비율은, 이 모델이 코드 설명을 어떤 언어로 잘할지 짐작하게 해 줍니다. 카드는 이 모델이 상업적 사용을 지원한다고 적으면서 세부 사항은 LICENSE-MODEL 문서를 보라고 안내합니다.
에이전트형 코딩은 또 다른 요구입니다
모델이 직접 파일을 읽고 명령을 실행하며 작업을 진행하게 하려면 함수 호출 형식이 필요합니다.
Qwen/Qwen3-Coder-30B-A3B-Instruct는 apache-2.0에 전체 30.5B, 활성 3.3B로 적혀 있고, 도구 호출 능력과 에이전트형 코딩을 위한 전용 함수 호출 형식을 언급합니다. 컨텍스트는 262,144를 기본 지원하고 Yarn으로 100만 토큰까지 확장할 수 있다고 적습니다. 다만 이 모델은 비사고 모드만 지원하며 <think></think> 블록을 생성하지 않는다고 카드가 명시합니다. 메모리 부족이 발생하면 컨텍스트를 32,768 같은 짧은 값으로 줄이라는 안내도 함께 있습니다.
MoE 구조이므로 이전 글에서 다룬 계산이 그대로 적용됩니다. 속도는 활성 3.3B를 따르지만, 가중치는 30.5B 전부가 메모리에 올라가야 합니다.
컨텍스트 길이가 코드에서 특히 중요한 이유
코드에서 컨텍스트는 대화 길이가 아니라 참조 범위입니다. 함수 하나를 고치려면 그 함수를 부르는 곳, 타입 정의, 테스트 파일이 함께 들어가야 하고, 이 셋은 대개 서로 다른 파일에 있습니다.
그래서 deepseek-ai/deepseek-coder-6.7b-instruct의 16K와 Qwen/Qwen3-Coder-30B-A3B-Instruct의 262,144는 성능 차이가 아니라 다룰 수 있는 작업 단위의 차이입니다. 단일 파일 수정이라면 16K로 충분하고, 리포지토리 전체를 훑어야 하는 작업이라면 애초에 다른 구간입니다.
Qwen/Qwen2.5-Coder-7B-Instruct 카드는 vLLM이 정적 YaRN만 지원하므로 배율이 입력 길이와 무관하게 고정되고 짧은 텍스트 성능에 영향을 줄 수 있다고 경고합니다. 자동완성처럼 짧은 요청이 대부분인 서비스에서 확장 설정을 상시 켜 두면 손해를 볼 수 있다는 뜻입니다.
라이선스가 가장 조심스러운 범주
코드 모델은 출력물이 그대로 제품에 들어갑니다. 그래서 라이선스 확인이 다른 범주보다 한 단계 더 중요합니다.
bigcode/starcoder2-7b은 bigcode-openrail-m으로 표기되고 페이지에는 BigCode OpenRAIL-M v1이라는 이름이 적혀 있습니다. 이 계열은 가중치를 널리 공개하면서 특정 용도를 제한하는 조항을 함께 두는 형태라서, 아파치나 MIT와 같은 조건이라고 넘겨짚으면 안 됩니다. google/codegemma-7b은 gemma이고, deepseek-ai/deepseek-coder-6.7b-instruct는 deepseek이라는 자체 식별자를 쓰며 LICENSE-MODEL 문서를 가리킵니다. Qwen 계열 코드 모델들은 apache-2.0으로 표기됩니다.
같은 카드가 밝히는 품질 한계도 함께 읽어야 합니다. bigcode/starcoder2-7b은 생성된 코드가 의도대로 동작한다고 보장되지 않으며 비효율적일 수 있고 버그나 취약점을 포함할 수 있다고 적습니다. 이 문장은 코드 리뷰 절차를 없애도 된다는 기대를 정면으로 부정합니다.
라이선스 전문을 직접 읽고, 상업적 사용은 법무 검토를 거치세요. 이 글은 카드에 적힌 문장을 옮길 뿐이며 법률 자문이 아닙니다.
코드 예시
# 예시: 대화형 코드 모델에 리팩터링을 요청합니다
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "Qwen/Qwen2.5-Coder-7B-Instruct"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype="auto", device_map="auto")
messages = [
{"role": "system", "content": "You are a careful code reviewer."},
{"role": "user", "content": "이 함수의 에러 처리를 보완해 주세요.\n\ndef load(p):\n return open(p).read()"},
]
prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=512)
print(tok.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
고를 때의 순서
- 자동완성인지 대화형인지 에이전트형인지를 먼저 나눕니다.
- 자동완성이면 중간 채우기 표기가 있는 저장소만 남기고, 토큰 형식을 확인합니다.
- 저장소 이름에 Instruct가 있는지 확인하고, 기본 모델을 대화에 쓰지 않습니다.
- 한 작업에 참조할 파일 수를 세어 필요한 컨텍스트를 정합니다.
- license 필드를 그대로 적고 링크된 전문을 열어 사용 제한 조항을 찾습니다.
- 카드가 밝힌 코드 품질 한계를 코드 리뷰 절차 요구사항으로 옮깁니다.
직접 해보기
- 프롬프트 엔지니어링 가이드 — 코드 요청 프롬프트를 다듬는 연습을 합니다.
- LLM GPU 메모리(VRAM) 계산기 — 자동완성용 소형 모델을 개발 장비에 올릴 수 있는지 확인합니다.
- LLM API 비용 계산기 — 자체 호스팅과 API 호출의 비용 구조를 비교합니다.
시리즈 안내
참고 자료
- 표의 모든 값은 2026-08-12에 해당 모델의 Hugging Face 페이지에서 직접 읽었습니다. 페이지에 없던 항목은 명시되어 있지 않음으로 적었습니다.
google/codegemma-7b은 본문의 70억 파라미터 설명과 스펙 칸의 9B params 표기가 서로 다릅니다. 두 표기를 그대로 옮겼습니다.- 라이선스 전문을 직접 읽고, 상업적 사용은 법무 검토를 거치세요.
Choosing Code Models: Completion vs Chat, FIM, and Licenses
- Code Models Are Two Different Products
- Completion Needs Fill-in-the-Middle
- Do Not Chat with a Base Model
- Conversational Code Models
- Agentic Coding Is Yet Another Requirement
- Why Context Length Matters Especially for Code
- The Category Where Licensing Needs the Most Care
- Code Example
- The Order to Decide In
- Try It Yourself
- Series Navigation
- References
Model details were read directly from the Hugging Face pages on 2026-08-12. Model cards and licenses change, so check the original again before you use anything.
Code Models Are Two Different Products
The first fork in choosing a code model is not size but purpose. Completing at the cursor inside an editor and producing an explained answer to a question demand different abilities.
Completion is all latency. The result has to arrive in the pause after the user stops typing, so it usually means a small model, and it has to see the code after the cursor as well as before it. Conversation can afford a few seconds but demands explanation and reasoning. Try to solve both with one model and you usually end up mediocre at each.
Completion Needs Fill-in-the-Middle
Editor completion is hard because there is code after the cursor. Continue from the prefix alone and you collide with a function already defined below. That is why you need training that supplies both prefix and suffix and asks the model to fill the middle.
| Repository | license | Size | Context | FIM as stated |
|---|---|---|---|---|
bigcode/starcoder2-7b | bigcode-openrail-m | 7B | 16,384, sliding window 4,096 | States it was trained using the Fill-in-the-Middle objective |
google/codegemma-7b | gemma | 9B params in the spec box | Not stated | States the dedicated tokens |
deepseek-ai/deepseek-coder-6.7b-instruct | deepseek | 6.7B | 16K | States a fill-in-the-blank task for project-level completion and infilling |
Qwen/Qwen2.5-Coder-1.5B | apache-2.0 | 1.54B (1.31B non-embedding) | 32,768 | Mentioned as an applicable task; token names not stated |
The google/codegemma-7b card goes as far as naming the tokens to use: <|fim_prefix|>, <|fim_suffix|>, <|fim_middle|>, and <|file_separator|>. If you are building an editor extension yourself you have to match that format exactly, and since tokens differ by model, swapping models also means changing the prompt assembly code.
Be careful: instruct variants do not necessarily carry a FIM statement. The Qwen/Qwen2.5-Coder-7B-Instruct page does not state fill-in-the-middle. For completion, checking the base model in the same family is the right move.
Do Not Chat with a Base Model
The bigcode/starcoder2-7b card states outright that it is not an instruction model and that commands like asking it to write a function that computes the square root do not work well. The Qwen/Qwen2.5-Coder-1.5B card likewise states that using base language models for conversations is not recommended.
Miss those sentences, throw a question at a base model, and the model starts continuing your question. Then the team concludes the model is bad. In fact they simply used an object built for a different purpose. Start by checking whether Instruct appears at the end of the repository name.
The bigcode/starcoder2-7b context statement is also worth a look. It says 16,384, but with a note about a 4,096 sliding window attention. The maximum length on the label and the range actually attended to in one pass can differ. The training data is stated as The Stack v2 across 17 programming languages.
Conversational Code Models
| Repository | license | Size | Context | Characteristics as stated |
|---|---|---|---|---|
Qwen/Qwen2.5-Coder-7B-Instruct | apache-2.0 | 7.61B (6.53B non-embedding) | 32,768 baseline, 131,072 with YaRN | Improvements in code generation, reasoning, and fixing; mentions code agent use |
deepseek-ai/deepseek-coder-6.7b-instruct | deepseek | 6.7B | 16K | 2T tokens at 87 percent code and 13 percent natural language; fine-tuned on 2B tokens of instruction data |
The training composition the deepseek-ai/deepseek-coder-6.7b-instruct card gives is unusually concrete. A ratio of 87 percent code to 13 percent English and Chinese natural language tells you something about which languages it will explain code in. The card states that DeepSeek Coder supports commercial use and points to the LICENSE-MODEL document for details.
Agentic Coding Is Yet Another Requirement
Letting a model read files and run commands to drive work forward requires a function-calling format.
Qwen/Qwen3-Coder-30B-A3B-Instruct is apache-2.0 with 30.5B total and 3.3B activated, and mentions tool-calling capability along with a specially designed function call format for agentic coding. It states native support for 262,144 tokens of context, extendable up to 1M tokens using Yarn. The card also states that this model supports only non-thinking mode and does not generate <think></think> blocks, and advises reducing the context to a shorter value such as 32,768 if out-of-memory issues appear.
Because it is an MoE architecture, the arithmetic from the earlier post applies directly. Speed follows the 3.3B activated, but all 30.5B of the weights still have to be in memory.
Why Context Length Matters Especially for Code
In code, context is not conversation length but reference scope. Fixing one function means bringing in its call sites, its type definitions, and its test file, and those three usually live in different files.
So the 16K of deepseek-ai/deepseek-coder-6.7b-instruct and the 262,144 of Qwen/Qwen3-Coder-30B-A3B-Instruct are not a quality gap but a difference in the size of task each can hold. For a single-file edit, 16K is plenty; for work that sweeps a whole repository, you are in a different band from the start.
The Qwen/Qwen2.5-Coder-7B-Instruct card warns that vLLM only supports static YaRN, which means the scaling factor stays constant regardless of input length and can affect performance on shorter texts. For a service dominated by short requests, like completion, leaving the extension setting permanently on can cost you.
The Category Where Licensing Needs the Most Care
Code model output goes straight into your product, which puts license verification one notch above the other categories.
bigcode/starcoder2-7b is marked bigcode-openrail-m, and the page names it BigCode OpenRAIL-M v1. That family publishes weights widely while attaching clauses restricting particular uses, so assuming it works like Apache or MIT is a mistake. google/codegemma-7b is gemma, and deepseek-ai/deepseek-coder-6.7b-instruct uses its own deepseek identifier pointing at a LICENSE-MODEL document. The Qwen code models are marked apache-2.0.
Read the quality limitations on the same cards alongside. bigcode/starcoder2-7b states that generated code is not guaranteed to work as intended, can be inefficient, and may contain bugs or exploits. That sentence directly contradicts any expectation that a code review step can be dropped.
Read the full license text yourself and put commercial use through legal review. This post only relays what the cards say and is not legal advice.
Code Example
# Example: ask a conversational code model for a refactor
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "Qwen/Qwen2.5-Coder-7B-Instruct"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype="auto", device_map="auto")
messages = [
{"role": "system", "content": "You are a careful code reviewer."},
{"role": "user", "content": "Harden the error handling here.\n\ndef load(p):\n return open(p).read()"},
]
prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=512)
print(tok.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
The Order to Decide In
- Split first between completion, conversation, and agentic use.
- For completion, keep only repositories that state fill-in-the-middle, and confirm the token format.
- Check whether Instruct is in the repository name, and do not chat with base models.
- Count how many files one task must reference and set your context requirement from that.
- Record the license field verbatim and open the linked full text to find use restrictions.
- Move the code quality limitations the card states into your code review requirements.
Try It Yourself
- Prompt Engineering Guide — practice shaping code request prompts.
- GPU VRAM Calculator for LLMs — check whether a small completion model fits your dev machine.
- LLM API Cost Calculator — compare the cost structure of self-hosting against API calls.
Series Navigation
- Previous: Vision and Multimodal: Image Understanding, OCR, and VLMs
- Next: Licenses and Deployment: Reading the Types and Verifying Quantized Builds
References
- Every value in the tables was read directly from that model page on Hugging Face on 2026-08-12. Anything absent from the page is written as not stated.
- On
google/codegemma-7bthe prose describing a 7 billion pretrained variant and the 9B params in the spec box disagree. Both are reported as written. - Read the full license text yourself and put commercial use through legal review.