Skip to content

Commit 831495a

Browse files
committed
Update benchmark to hardened v2: 1,800 new
tasks, 9 current-gen models, reorganized evaluation - Replace all benchmark tasks with hardened versions (dramatically improved assertion coverage) - Update completions to 9 current-gen models (claude-opus-4-7, gpt-5.5, deepseek-v4-pro, etc.) - Reorganize evaluation scripts into evaluation/ directory - Add compute_pass_at_1.py, evaluate_similarity.py, analysis scripts - Add Dockerfile for reproducible execution - Rewrite LLM judge to use Gemini 2.5 Flash (publicly accessible) - Remove Azure-specific infrastructure (generate_completions.py) - Update README with Docker-first setup, de-anonymized citation
1 parent b22ecf8 commit 831495a

747 files changed

Lines changed: 176282 additions & 197015 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 13 additions & 395 deletions
Large diffs are not rendered by default.

Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM python:3.10-slim
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
# Node.js (JavaScript + TypeScript)
5+
nodejs npm \
6+
# Java
7+
default-jdk \
8+
# C++
9+
g++ \
10+
# C# (.NET SDK)
11+
wget apt-transport-https \
12+
&& rm -rf /var/lib/apt/lists/*
13+
14+
# Install .NET SDK 8.0
15+
RUN wget -q https://dot.net/v1/dotnet-install.sh -O /tmp/dotnet-install.sh \
16+
&& chmod +x /tmp/dotnet-install.sh \
17+
&& /tmp/dotnet-install.sh --channel 8.0 --install-dir /usr/share/dotnet \
18+
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
19+
&& rm /tmp/dotnet-install.sh
20+
21+
# Install TypeScript 5.x globally (TS 6+ deprecates --moduleResolution node)
22+
RUN npm install -g typescript@5
23+
24+
WORKDIR /devbench
25+
COPY requirements.txt .
26+
RUN pip install --no-cache-dir -r requirements.txt
27+
28+
COPY . .
29+
30+
# Verify all runtimes are available
31+
RUN python --version \
32+
&& node --version \
33+
&& javac -version \
34+
&& g++ --version | head -1 \
35+
&& dotnet --version \
36+
&& tsc --version
37+
38+
CMD ["python", "evaluation/compute_pass_at_1.py"]

README.md

Lines changed: 124 additions & 415 deletions
Large diffs are not rendered by default.
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
#!/usr/bin/env python3
2+
"""Compute pairwise Spearman correlations of Pass@1 across task categories
3+
(Table 9) and PCA analysis.
4+
5+
Uses per-model-per-language-per-category Pass@1 data
6+
(9 models x 6 languages = 54 observations).
7+
Output: correlation matrix + PCA explained variance for the paper's
8+
category relationship analysis.
9+
10+
Usage:
11+
cd analysis
12+
python compute_category_correlations.py
13+
"""
14+
15+
import json
16+
import os
17+
import numpy as np
18+
from scipy import stats
19+
from sklearn.decomposition import PCA
20+
from sklearn.preprocessing import StandardScaler
21+
from collections import defaultdict
22+
23+
# --- paths (relative to this script's directory) ---
24+
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
25+
PASS_AT_1_FILE = os.path.join(SCRIPT_DIR, '..', 'evaluation', 'pass_at_1_results.json')
26+
27+
# --- 9 paper models ---
28+
MODELS_9 = [
29+
'gpt-5.5', 'gpt-5.4-mini', 'gpt-5.4-nano',
30+
'claude-opus-4-7', 'claude-sonnet-4-6',
31+
'deepseek-v4-pro', 'llama-4-maverick',
32+
'mistral-medium-3.5', 'qwen3.6-27b',
33+
]
34+
35+
CATS = [
36+
'api_usage', 'code2NL_NL2code', 'code_purpose_understanding',
37+
'low_context', 'pattern_matching', 'syntax_completion',
38+
]
39+
CAT_SHORT = ['API', 'Code2NL', 'Purpose', 'Low Ctx', 'Pattern', 'Syntax']
40+
CAT_DISPLAY = ['API Usage', 'Code2NL', 'Purpose', 'Low Context', 'Pattern', 'Syntax']
41+
LANGS = ['python', 'javascript', 'typescript', 'java', 'cpp', 'c_sharp']
42+
43+
44+
def load_matrix():
45+
"""Build an (N_models * N_langs) x N_cats matrix of Pass@1 scores."""
46+
with open(PASS_AT_1_FILE) as f:
47+
data = json.load(f)
48+
49+
matrix = []
50+
row_labels = []
51+
52+
for m in MODELS_9:
53+
if m not in data.get('models', {}):
54+
print(f'WARNING: {m} not found in data, skipping')
55+
continue
56+
tc = data['models'][m]['test_cases']
57+
if not tc:
58+
print(f'WARNING: {m} has empty test_cases, skipping')
59+
continue
60+
61+
scores = defaultdict(lambda: defaultdict(list))
62+
for t in tc:
63+
scores[t['language']][t['category']].append(t['pass_at_k_score'])
64+
65+
for lang in LANGS:
66+
row = []
67+
for cat in CATS:
68+
if scores[lang][cat]:
69+
row.append(np.mean(scores[lang][cat]) * 100)
70+
else:
71+
row.append(0)
72+
matrix.append(row)
73+
row_labels.append(f'{m}/{lang}')
74+
75+
return np.array(matrix), row_labels
76+
77+
78+
def print_correlation_matrix(corr, p_vals):
79+
"""Print lower-triangular correlation matrix."""
80+
print('=== PAIRWISE SPEARMAN CORRELATIONS ===')
81+
print(f'{"":>10}', ' '.join(f'{s:>8}' for s in CAT_SHORT))
82+
for i, name in enumerate(CAT_SHORT):
83+
row = f'{name:>10}'
84+
for j in range(6):
85+
if j <= i:
86+
row += f' {corr[i][j]:>8.2f}'
87+
else:
88+
row += f' {"":>8}'
89+
print(row)
90+
91+
upper = [corr[i][j] for i in range(6) for j in range(i + 1, 6)]
92+
print(f'\nMean pairwise rho: {np.mean(upper):.2f}')
93+
print(f'Min pairwise rho: {min(upper):.2f}')
94+
print(f'Max pairwise rho: {max(upper):.2f}')
95+
print()
96+
97+
for i in range(6):
98+
for j in range(i + 1, 6):
99+
p = p_vals[i][j]
100+
sig = '***' if p < 0.001 else '**' if p < 0.01 else '*' if p < 0.05 else 'ns'
101+
print(f' {CAT_SHORT[i]:>8} vs {CAT_SHORT[j]:<8}: '
102+
f'rho={corr[i][j]:.2f} p={p:.4f} {sig}')
103+
104+
105+
def print_pca(matrix):
106+
"""Run PCA and print explained variance."""
107+
print('\n=== PCA ===')
108+
scaler = StandardScaler()
109+
X = scaler.fit_transform(matrix)
110+
pca = PCA()
111+
pca.fit(X)
112+
print('Explained variance ratios:',
113+
[f'{v:.3f}' for v in pca.explained_variance_ratio_])
114+
print(f'First 2 components: {sum(pca.explained_variance_ratio_[:2]) * 100:.1f}%')
115+
print(f'First 3 components: {sum(pca.explained_variance_ratio_[:3]) * 100:.1f}%')
116+
117+
118+
def print_latex_table(corr):
119+
"""Print LaTeX source for the correlation table."""
120+
print('\n=== LATEX TABLE ===')
121+
print(r'\begin{table}[h]')
122+
print(r'\caption{Pairwise Spearman correlations of Pass@1 across categories '
123+
r'($n = 54$ model--language pairs).}')
124+
print(r'\label{tab:category-correlations}')
125+
print(r'\centering')
126+
print(r'\small')
127+
print(r'\begin{tabular}{lcccccc}')
128+
print(r'\toprule')
129+
print(r' & API & Code2NL & Purpose & Low Ctx & Pattern & Syntax \\')
130+
print(r'\midrule')
131+
for i, name in enumerate(CAT_DISPLAY):
132+
row = f'{name}'
133+
for j in range(6):
134+
if j < i:
135+
row += f' & {corr[i][j]:.2f}'
136+
elif j == i:
137+
row += ' & 1.00'
138+
else:
139+
row += ' &'
140+
row += r' \\'
141+
print(row)
142+
print(r'\bottomrule')
143+
print(r'\end{tabular}')
144+
print(r'\end{table}')
145+
146+
147+
def main():
148+
matrix, row_labels = load_matrix()
149+
n_models = len(matrix) // len(LANGS)
150+
print(f'Matrix shape: {matrix.shape} ({n_models} models x {len(LANGS)} languages)')
151+
print()
152+
153+
# Pairwise Spearman correlations
154+
corr = np.zeros((6, 6))
155+
p_vals = np.zeros((6, 6))
156+
for i in range(6):
157+
for j in range(6):
158+
rho, p = stats.spearmanr(matrix[:, i], matrix[:, j])
159+
corr[i][j] = rho
160+
p_vals[i][j] = p
161+
162+
print_correlation_matrix(corr, p_vals)
163+
print_pca(matrix)
164+
print_latex_table(corr)
165+
166+
167+
if __name__ == '__main__':
168+
main()

0 commit comments

Comments
 (0)