The Solver was trained in an adversarial setup where a Setter agent generates coding problems and hidden edge-case traps.
Standard coding benchmarks test what a model has memorized. CodeCourt tests what happens when another LLM is actively trying to break it.
This creates an adversarial training loop where the Solver is optimized against hidden tests rather than a static benchmark.
1solver_reward = (
2 correctness_score # Did ALL tests pass?
3 + complexity_match # Right algorithmic complexity?
4 - brute_force_penalty # O(n²) when O(n log n) expected?
5 - hidden_test_regression # Passed public, failed hidden?
6 - unsafe_pattern_penalty # Suspicious imports caught?
7)
1import torch
2from peft import PeftModel
3from transformers import AutoModelForCausalLM, AutoTokenizer
4
5# Load base model
6tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct")
7base_model = AutoModelForCausalLM.from_pretrained(
8 "Qwen/Qwen2.5-0.5B-Instruct",
9 torch_dtype="auto",
10 device_map="auto"
11)
12
13# Load LoRA adapter
14model = PeftModel.from_pretrained(
15 base_model,
16 "ayussssssiiii/codecourt-solver-grpo-v1"
17)
18
19# Run inference
20prompt = """Solve this coding problem. Write efficient Python code.
21
22Problem: Given an array of integers, find the length of the longest increasing subsequence.
23
24Input: nums = [10, 9, 2, 5, 3, 7, 101, 18]
25Expected output: 4
26"""
27
28inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
29outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.1)
30print(tokenizer.decode(outputs[0], skip_special_tokens=True))
1@misc{codecourt2026,
2 author = {ayussssssiiii},
3 title = {CodeCourt: Adversarial Code Auditing via LLM Self-Play},
4 year = {2026},
5 howpublished = {\url{https://github.com/ayushoncode/CodeCourt}},
6}