Apex-Coder
Apex-Coder is a fine-tuned version of Qwen2.5-Coder-1.5B-Instruct, specialized for competitive programming, Codeforces-style problems, and C++17 code generation.
The model was fine-tuned using Supervised Fine-Tuning (SFT) with LoRA/PEFT and Unsloth.
Model Overview
| Property | Details |
|---|---|
| Model Name | Apex-Coder |
| Base Model | Qwen2.5-Coder-1.5B-Instruct |
| Model Type | Causal Language Model |
| Primary Task | Competitive Programming / Code Generation |
| Primary Language | C++ |
| Fine-Tuning | LoRA |
| Training Method | Supervised Fine-Tuning (SFT) |
| Framework | Transformers |
| Training Framework | TRL |
| Fine-Tuning Library | PEFT |
| Optimization | Unsloth |
| Model Format | Safetensors |
| Model Status | Merged Standalone Model |
About Apex-Coder
Apex-Coder is designed as a lightweight AI assistant for competitive programmers.
The goal of the fine-tuning process was to improve the model's ability to:
- Understand competitive programming problems
- Identify suitable algorithms and data structures
- Develop efficient solution approaches
- Analyze time and space complexity
- Generate C++17 implementations
- Debug C++ solutions
- Optimize existing solutions
- Suggest alternative approaches
- Explain competitive programming concepts
The model is particularly targeted toward Codeforces-style programming problems.
Training
Apex-Coder was fine-tuned using Supervised Fine-Tuning (SFT) with LoRA (Low-Rank Adaptation).
Instead of updating the complete base model, LoRA adds a relatively small number of trainable parameters that learn task-specific behavior.
Training Stack
- Base Model: Qwen2.5-Coder-1.5B-Instruct
- Fine-Tuning: LoRA
- Training Method: Supervised Fine-Tuning (SFT)
- PEFT: PEFT
- Optimization: Unsloth
- Training Framework: TRL
- Model Framework: Transformers
- Programming Language: C++
Training Data
The model was fine-tuned on Codeforces-style competitive programming problems and C++ solutions.
The training examples were designed around the following general workflow:
Problem Statement
│
▼
Algorithm / Approach
│
▼
Complexity Analysis
│
▼
C++17 Implementation
The objective was to teach the model to connect a programming problem with an appropriate algorithmic strategy and implementation.
Model Format
Apex-Coder is provided as a merged standalone model.
After fine-tuning, the LoRA adapter was merged with the base model and exported as a standalone model.
Therefore, users do not need to separately load the LoRA adapter when using this repository.
Repository Structure
apex-qwen2.5/
│
├── README.md
├── config.json
├── generation_config.json
├── model.safetensors
├── tokenizer.json
├── tokenizer_config.json
└── chat_template.jinja
Main Model Weights
model.safetensors
The model weights are provided in Safetensors format.
Usage
Installation
pip install torch transformers accelerate
Load the Model
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "yadavkapil7155/apex-qwen2.5"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
model.eval()
Chat-Style Inference
Apex-Coder supports conversational prompts using the tokenizer's chat template.
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "yadavkapil7155/apex-qwen2.5"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
model.eval()
messages = [
{
"role": "user",
"content": """
Solve this competitive programming problem in C++17.
Given an array of n integers, find the maximum
subarray sum.
Explain the approach, time complexity,
space complexity, and provide the complete
C++17 implementation.
"""
}
]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer(
prompt,
return_tensors="pt"
).to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=2048,
do_sample=False,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(
outputs[0][inputs["input_ids"].shape[1]:],
skip_special_tokens=True
)
print(response)
Example
A user can interact with Apex-Coder using a normal conversational prompt:
Solve this competitive programming problem in C++17.
Given an array of n integers, find the number of
subarrays whose sum is divisible by k.
Constraints:
1 <= n <= 1e5
1 <= k <= 1e5
-1e9 <= a[i] <= 1e9
Explain the approach, time complexity,
space complexity, and provide the complete
C++17 implementation.
A response may contain:
Approach:
...
Why it works:
...
Time Complexity:
...
Space Complexity:
...
C++17 Implementation:
...
This makes Apex-Coder suitable as the backend for a ChatGPT-style competitive programming assistant.
Intended Use
Apex-Coder is intended for:
- Competitive programming
- Codeforces-style problems
- C++17 code generation
- Algorithm learning
- Data structures and algorithms practice
- Debugging C++ code
- Complexity analysis
- Solution optimization
- Educational coding assistants
- Personal AI coding tools
Evaluation
For competitive programming, generating syntactically valid code is not enough.
A proper evaluation pipeline should verify whether generated solutions actually solve the problems.
Problem
│
▼
Model generates C++17 solution
│
▼
Compile
│
▼
Run test cases
│
▼
Compare output
│
▼
Accepted / Wrong Answer / Runtime Error
Recommended Metrics
| Metric | Description |
|---|---|
| Compilation Rate | Percentage of generated solutions that compile successfully |
| Test Case Pass Rate | Percentage of generated solutions passing the available tests |
| Accepted Rate | Percentage of problems solved successfully |
| Runtime | Execution time of generated solutions |
| Memory Usage | Memory consumed by generated solutions |
Formal benchmark results will be added after evaluation on a held-out set of unseen competitive programming problems.
Limitations
Apex-Coder is a relatively small 1.5B parameter model.
It may not reliably solve every competitive programming problem, particularly problems involving:
- Very difficult algorithms
- Complex dynamic programming
- Advanced graph algorithms
- Difficult mathematical reasoning
- Large multi-step reasoning chains
- Unusual edge cases
- Very long problem statements
- Highly optimized implementations
- Problems outside the training distribution
The model may occasionally generate code that looks correct but contains logical or implementation errors.
Always compile, test, and validate generated solutions before submitting them or using them in production.
Apex-Coder should be considered an AI coding assistant, not a guaranteed competitive programming solver.
Deployment
Apex-Coder can be integrated into applications such as:
- Hugging Face Spaces
- Gradio applications
- FastAPI backends
- Docker containers
- Web applications
- Coding assistants
- Educational platforms
A possible deployment architecture:
User
│
▼
ChatGPT-style UI
│
▼
Gradio / Web UI
│
▼
FastAPI API
│
▼
Apex-Coder
│
▼
C++17 Response
The model can also be loaded directly from the Hugging Face Hub for local inference.
Project Architecture
Qwen2.5-Coder
1.5B
│
▼
Codeforces-style Dataset
│
▼
SFT + LoRA
│
▼
Fine-Tuned Model
│
▼
LoRA Merge
│
▼
Apex-Coder
│
┌──────────┴──────────┐
▼ ▼
Problem Understanding Code Generation
│ │
└──────────┬──────────┘
▼
C++17
Repository Files
| File | Purpose |
|---|---|
model.safetensors | Merged model weights |
config.json | Model architecture configuration |
generation_config.json | Generation configuration |
tokenizer.json | Tokenizer vocabulary and configuration |
tokenizer_config.json | Tokenizer settings |
chat_template.jinja | Conversational prompt template |
README.md | Model documentation |
Project Goals
Apex-Coder explores how a relatively small language model can be adapted to a specialized programming domain.
The project focuses on:
- Fine-tuning small language models
- Parameter-efficient fine-tuning with LoRA
- Competitive programming
- C++ code generation
- Codeforces-style problem solving
- Building lightweight AI coding assistants
- Deploying fine-tuned language models
Acknowledgements
Apex-Coder builds upon the following open-source projects and communities:
- Qwen — Qwen2.5-Coder
- Unsloth — Efficient model fine-tuning
- Hugging Face — Transformers and Model Hub
- PEFT — Parameter-efficient fine-tuning
- TRL — Supervised fine-tuning
- Codeforces — Competitive programming ecosystem
Links
GitHub
https://github.com/kapilverse/Apex-Coder
Hugging Face
https://huggingface.co/yadavkapil7155/apex-qwen2.5
Base Model
Qwen2.5-Coder-1.5B-Instruct
Author
Kapil Yadav
Apex-Coder is an independent machine learning project focused on adapting a small language model for competitive programming and C++ code generation.
GitHub:
https://github.com/kapilverse/Apex-Coder
Citation
If you use Apex-Coder in your project, you can cite it as:
@misc{apexcoder2026,
title={Apex-Coder: Fine-Tuned Qwen2.5-Coder for Competitive Programming},
author={Kapil Yadav},
year={2026},
url={https://huggingface.co/yadavkapil7155/apex-qwen2.5}
}
License
Apex-Coder is a fine-tuned model based on Qwen2.5-Coder-1.5B-Instruct.
Please review the licensing terms of the original Qwen model before redistributing or using Apex-Coder commercially.