TouristGPT
Model Description
- Base Model:
Qwen/Qwen2.5-Coder-7B-Instruct - Training Strategy: 10 epochs using a length-sorted Curriculum Sampler
- Checkpoint: Epoch 7 (Chosen as the most stable peak prior to overfitting, with zero compile errors on internal benchmarks)
- Primary Domain: C++ Competitive Programming
Usage
The model uses the standard ChatML format (<|im_start|> and <|im_end|>) and expects the system prompt to instruct it to think step-by-step before outputting the final C++ code.
Recommended System Prompt
You are an expert competitive programming assistant.
The user message is a single problem: statement, optional time and memory limits, and sample tests. Treat it like a real contest submission โ do not ask for clarifications.
Respond with exactly two blocks and nothing else:
1. <think>...</think>
Reason in natural language. Explore ideas, check constraints and edge cases, and use the samples to validate your reasoning. If an approach does not work, revise and continue until you are confident. Do not write the final C++ program inside this block.
2. <code>...</code>
One complete, submission-ready C++17 solution: includes, main(), and solve() (or equivalent). Use fast I/O if appropriate. Match the required input/output format exactly. No debug prints.
Your entire reply must consist of only those two blocks. Do not write any text before <think>, between </think> and <code>, or after </code>.
Required User Prompt Format
To match the training curriculum perfectly, the user message must be structured exactly like this:
[PROBLEM]
[STATEMENT]
<Insert the full problem description here>
Time limit: <e.g., 1.0s>
Memory limit: <e.g., 256.0MB>
Input:
<Insert the input constraints and formats here>
Output:
<Insert the output constraints and formats here>
Note:
<Optional: Insert any notes, otherwise omit this section>
Examples:
Example 1:
Input:
<Insert example input line 1>
<Insert example input line 2>
Output:
<Insert example output line 1>
Example 2:
Input:
...
Inference Example (HuggingFace Transformers)
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "touristgpt/TouristGPT"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
messages = [
{"role": "system", "content": "You are an expert competitive programming assistant.\n\nThe user message is a single problem: statement, optional time and memory limits, and sample tests. Treat it like a real contest submission โ do not ask for clarifications.\n\nRespond with exactly two blocks and nothing else:\n\n1. <think>...</think>\n Reason in natural language. Explore ideas, check constraints and edge cases, and use the samples to validate your reasoning. If an approach does not work, revise and continue until you are confident. Do not write the final C++ program inside this block.\n\n2. <code>...</code>\n One complete, submission-ready C++17 solution: includes, main(), and solve() (or equivalent). Use fast I/O if appropriate. Match the required input/output format exactly. No debug prints.\n\nYour entire reply must consist of only those two blocks. Do not write any text before <think>, between </think> and <code>, or after </code>."},
{"role": "user", "content": "[PROBLEM]\n\n[STATEMENT]\nWrite a C++ program to find the maximum multiple sum...\n\nTime limit: 1.0s\nMemory limit: 256.0MB\n\nInput:\nThe first line contains t..."}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=2048
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)
Performance
On an internal blind test set of 50 Codeforces problems, Epoch 7 achieved:
- 22.0% Full Pass Rate (Compiled and solved all sample test cases zero-shot)
- 0 Compile Errors (100% syntactical compilation success rate on generated complete solutions)
- Downloads last month
- 162
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐ Ask for provider support