Downloads · 30 days
8
11% of all-time downloads
ayussssssiiii/codecourt-solver-grpo-v1
codecourt-solver-grpo-v1 is a text generation model from ayussssssiiii. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as mit.
A LoRA adapter fine-tuned on Qwen2.5-0.5B-Instruct via GRPO (Group Relative Policy Optimization), trained inside the CodeCourt adversarial self-play environment.
Downloads · 30 days
8
11% of all-time downloads
All-time downloads
76
Public
Repo size
20.1 MB
Likes
0
Public
Click a slice to open those files.
.json14.2 MB · 58%
From the Hugging Face model README
A LoRA adapter fine-tuned on Qwen2.5-0.5B-Instruct via GRPO (Group Relative Policy Optimization), trained inside the CodeCourt adversarial self-play environment.
The Solver was trained in an adversarial setup where a Setter agent generates coding problems and hidden edge-case traps.
| Field | Details |
|---|---|
| Developed by | ayussssssiiii |
| Base model | Qwen/Qwen2.5-0.5B-Instruct |
| Model type | Causal LM + LoRA adapter (PEFT) |
| Language | English + Python (code generation) |
| License | MIT |
| Training method | GRPO via HuggingFace TRL |
| Repository | ayushoncode/CodeCourt |
| Demo | ayussssssiiii/codecourt |
Standard coding benchmarks test what a model has memorized. CodeCourt tests what happens when another LLM is actively trying to break it.
The training loop works as follows:
This creates an adversarial training loop where the Solver is optimized against hidden tests rather than a static benchmark.
| Parameter | Value |
|---|---|
| Base model | Qwen/Qwen2.5-0.5B-Instruct |
| Training method | GRPO (Group Relative Policy Optimization) |
| Training framework | HuggingFace TRL |
| Training steps | 100 |
| Training samples | 54 |
| Max completion length | 768 tokens |
| Adapter type | LoRA |
solver_reward = (
correctness_score # Did ALL tests pass?
+ complexity_match # Right algorithmic complexity?
- brute_force_penalty # O(n²) when O(n log n) expected?
- hidden_test_regression # Passed public, failed hidden?
- unsafe_pattern_penalty # Suspicious imports caught?
)
| Metric | Baseline | Trained (committed artifacts) |
|---|---|---|
| Hidden-test pass rate | 54.7% | — |
| Best solver reward | — | +34.31 (step 26, per training_history.json) |
| Brute-force penalty triggers | 46.7% of episodes | 0.0% (per committed comparison package) |
| Setter win rate | 56.7% | 0.0% (per committed comparison package) |
| Training steps | — | 100 / 100 |
The committed reference/trained-side artifact reaches 100% on the boundary probe (up from 16.7% baseline). These 6 cases were locked before training began and never exposed during the training loop.
| Case | What It Tests | Baseline | Reference/Trained Side |
|---|---|---|---|
graph_shortest_path_single_node | 1-node graph, 0 edges | ❌ | ✅ |
graph_shortest_path_two_hop | Indirect path only | ❌ | ✅ |
graph_bipartite_min_odd_cycle | Odd cycle boundary | ❌ | ✅ |
array_lis_hidden_valley | Valley breaks greedy LIS | ❌ | ✅ |
dp_lcs_order_sensitive | Reversed string pair | ❌ | ✅ |
| Overall | 16.7% | 100.0% |
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load base model
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct")
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-0.5B-Instruct",
torch_dtype="auto",
device_map="auto"
)
# Load LoRA adapter
model = PeftModel.from_pretrained(
base_model,
"ayussssssiiii/codecourt-solver-grpo-v1"
)
# Run inference
prompt = """Solve this coding problem. Write efficient Python code.
Problem: Given an array of integers, find the length of the longest increasing subsequence.
Input: nums = [10, 9, 2, 5, 3, 7, 101, 18]
Expected output: 4
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.1)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
After 100 GRPO steps of adversarial self-play training:
max-completion-length is expected to improve stability@misc{codecourt2026,
author = {ayussssssiiii},
title = {CodeCourt: Adversarial Code Auditing via LLM Self-Play},
year = {2026},
howpublished = {\url{https://github.com/ayushoncode/CodeCourt}},
}
Trained inside an adversarial self-play loop — not a static dataset.