DeepParmar commited on
Commit
88518e4
·
1 Parent(s): 8cddc5b

Add compiled benchmark_comparison, HF Native serverless testing logs

Browse files
benchmark_comparison.md CHANGED
The diff for this file is too large to render. See raw diff
 
deepseektest.txt ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ =======================================================================
2
+ CODE REVIEW OPENENV - EXTREME BENCHMARK: DEEPSEEK R1 & V3
3
+ =======================================================================
4
+
5
+ Target Environment: https://ksiki-code-test.hf.space
6
+ Target LLM Gateway: https://openrouter.ai/api/v1
7
+
8
+
9
+ =======================================================================
10
+ --- RUNNING ELITE EXTREME TEST ON MODEL: DeepSeek-R1 (deepseek/deepseek-r1) ---
11
+ --- Execution Time: 338.36s ---
12
+ --- STDOUT (Environment Steps & Actions) ---
13
+ [START] task=easy env=code-review-env model=deepseek/deepseek-r1
14
+ [STEP] step=1 action={"operation":"add_comment","line_number":23,"severity":"critical","category":"bug","message":"Syntax error: assignment in if condition is invalid. Use 'if delta > 0:' or, if an assignment expression is intended, 'if (include := delta > 0):' with Python 3.8+ walrus operator.","confidence":100} reward=0.25 done=false error=null
15
+ [STEP] step=2 action={"operation":"done"} reward=0.01 done=true error=Could not extract valid JSON from model output
16
+ [END] success=false steps=2 score=0.001 rewards=0.25,0.01
17
+ [START] task=medium env=code-review-env model=deepseek/deepseek-r1
18
+ [STEP] step=1 action={"operation":"add_comment","line_number":21,"severity":"critical","category":"security","message":"SQL injection vulnerability: the query is constructed by directly concatenating user input 'requested_user_id' into the SQL string. This allows attackers to inject malicious SQL code. Use parameterized queries or prepared statements to safely handle user inputs.","confidence":95} reward=0.30 done=false error=null
19
+ [STEP] step=2 action={"operation":"add_comment","line_number":21,"severity":"critical","category":"security","message":"Hardcoded API key: The secret 'sk_live_51HARD_CODED_SECRET' is embedded directly in the source code. This is a security risk as secrets should be stored in environment variables or secure configuration files to prevent exposure in case of code leaks.","confidence":95} reward=0.01 done=false error=null
20
+ [STEP] step=3 action={"operation":"add_comment","line_number":23,"severity":"major","category":"security","message":"Cross-Site Scripting (XSS) vulnerability: user input 'q' is passed to render_profile_html without sanitization, which directly embeds it into HTML using f-string. This allows attackers to inject malicious scripts. Always escape or sanitize user inputs when outputting to HTML to prevent XSS attacks.","confidence":90} reward=0.30 done=false error=null
21
+ [STEP] step=4 action={"operation":"done"} reward=0.99 done=true error=Error code: 402 - {'error': {'message': 'This request requires more credits, or fewer max_tokens. You requested up to 512 tokens, but can only afford 471. To increase, visit https://openrouter.ai/settings/credits and upgrade to a paid account', 'code': 402, 'metadata': {'provider_name': None}}, 'user_id': 'user_3CFQ0QbPlXSfvRHa2IU75vkHaCP'}
22
+ [END] success=true steps=4 score=0.889 rewards=0.30,0.01,0.30,0.99
23
+ [START] task=hard env=code-review-env model=deepseek/deepseek-r1
24
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 402 - {'error': {'message': 'This request requires more credits, or fewer max_tokens. You requested up to 512 tokens, but can only afford 198. To increase, visit https://openrouter.ai/settings/credits and upgrade to a paid account', 'code': 402, 'metadata': {'provider_name': None}}, 'user_id': 'user_3CFQ0QbPlXSfvRHa2IU75vkHaCP'}
25
+ [END] success=false steps=1 score=0.001 rewards=0.01
26
+
27
+ --- STDERR (Telemetry, Confidence & Parsing Status) ---
28
+ >> confidence=100% | correct=True
29
+
30
+ [DEBUG PARSE FAIL] Raw text from model:
31
+ -------
32
+
33
+ -------
34
+
35
+ >> CALIBRATION SUMMARY: avg_confidence=100% | high_conf_correct=1 | high_conf_wrong=0 | calibration_score=0.999
36
+ >> confidence=95% | correct=True
37
+ >> confidence=95% | correct=False
38
+ >> confidence=90% | correct=False
39
+ >> CALIBRATION SUMMARY: avg_confidence=93% | high_conf_correct=1 | high_conf_wrong=2 | calibration_score=0.667
40
+
41
+
42
+ =======================================================================
43
+ --- RUNNING ELITE EXTREME TEST ON MODEL: DeepSeek-V3 (deepseek/deepseek-chat) ---
44
+ --- Execution Time: 39.84s ---
45
+ --- STDOUT (Environment Steps & Actions) ---
46
+ [START] task=easy env=code-review-env model=deepseek/deepseek-chat
47
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 402 - {'error': {'message': 'Insufficient credits. This account never purchased credits. Make sure your key is on the correct account or org, and if so, purchase more at https://openrouter.ai/settings/credits', 'code': 402}}
48
+ [END] success=false steps=1 score=0.001 rewards=0.01
49
+ [START] task=medium env=code-review-env model=deepseek/deepseek-chat
50
+ [STEP] step=1 action={"operation":"add_comment","line_number":20,"severity":"major","category":"security","message":"Hard-coded API key 'sk_live_51HARD_CODED_SECRET' exposes sensitive information. Use environment variables or a secure vault instead.","confidence":95} reward=0.30 done=false error=null
51
+ [STEP] step=2 action={"operation":"add_comment","line_number":21,"severity":"critical","category":"security","message":"SQL query is vulnerable to injection via 'requested_user_id'. Use parameterized queries or an ORM to prevent SQL injection.","confidence":98} reward=0.30 done=false error=null
52
+ [STEP] step=3 action={"operation":"add_comment","line_number":23,"severity":"major","category":"security","message":"Exposing 'api_key' in the response payload is a security risk. Remove sensitive data from responses or ensure proper access controls.","confidence":90} reward=0.30 done=false error=null
53
+ [STEP] step=4 action={"operation":"done"} reward=0.92 done=true error=null
54
+ [END] success=true steps=4 score=0.824 rewards=0.30,0.30,0.30,0.92
55
+ [START] task=hard env=code-review-env model=deepseek/deepseek-chat
56
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 402 - {'error': {'message': 'Insufficient credits. This account never purchased credits. Make sure your key is on the correct account or org, and if so, purchase more at https://openrouter.ai/settings/credits', 'code': 402}}
57
+ [END] success=false steps=1 score=0.001 rewards=0.01
58
+
59
+ --- STDERR (Telemetry, Confidence & Parsing Status) ---
60
+ >> confidence=95% | correct=True
61
+ >> confidence=98% | correct=True
62
+ >> confidence=90% | correct=True
63
+ >> CALIBRATION SUMMARY: avg_confidence=94% | high_conf_correct=3 | high_conf_wrong=0 | calibration_score=0.999
hf_api_test.txt ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ =======================================================================
2
+ CODE REVIEW OPENENV - NATIVE HUGGING FACE INFERENCE BENCHMARK
3
+ =======================================================================
4
+
5
+ Target Environment: https://ksiki-code-test.hf.space
6
+ Target LLM Gateway: https://api-inference.huggingface.co/v1/
7
+
8
+
9
+ =======================================================================
10
+ --- RUNNING ELITE EXTREME TEST ON MODEL: DeepSeek-V3 (deepseek-ai/DeepSeek-V3) ---
11
+ --- Execution Time: 15.14s ---
12
+ --- STDOUT (Environment Steps & Actions) ---
13
+ [START] task=easy env=code-review-env model=deepseek-ai/DeepSeek-V3
14
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 410 - {'error': 'https://api-inference.huggingface.co is no longer supported. Please use https://router.huggingface.co instead.'}
15
+ [END] success=false steps=1 score=0.001 rewards=
16
+ [START] task=medium env=code-review-env model=deepseek-ai/DeepSeek-V3
17
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 410 - {'error': 'https://api-inference.huggingface.co is no longer supported. Please use https://router.huggingface.co instead.'}
18
+ [END] success=false steps=1 score=0.001 rewards=
19
+ [START] task=hard env=code-review-env model=deepseek-ai/DeepSeek-V3
20
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 410 - {'error': 'https://api-inference.huggingface.co is no longer supported. Please use https://router.huggingface.co instead.'}
21
+ [END] success=false steps=1 score=0.001 rewards=
22
+
23
+ --- STDERR (Telemetry, Confidence & Parsing Status) ---
24
+
25
+
26
+ =======================================================================
27
+ --- RUNNING ELITE EXTREME TEST ON MODEL: Qwen-2.5-72B (Qwen/Qwen2.5-72B-Instruct) ---
28
+ --- Execution Time: 14.51s ---
29
+ --- STDOUT (Environment Steps & Actions) ---
30
+ [START] task=easy env=code-review-env model=Qwen/Qwen2.5-72B-Instruct
31
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 410 - {'error': 'https://api-inference.huggingface.co is no longer supported. Please use https://router.huggingface.co instead.'}
32
+ [END] success=false steps=1 score=0.001 rewards=
33
+ [START] task=medium env=code-review-env model=Qwen/Qwen2.5-72B-Instruct
34
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 410 - {'error': 'https://api-inference.huggingface.co is no longer supported. Please use https://router.huggingface.co instead.'}
35
+ [END] success=false steps=1 score=0.001 rewards=
36
+ [START] task=hard env=code-review-env model=Qwen/Qwen2.5-72B-Instruct
37
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 410 - {'error': 'https://api-inference.huggingface.co is no longer supported. Please use https://router.huggingface.co instead.'}
38
+ [END] success=false steps=1 score=0.001 rewards=
39
+
40
+ --- STDERR (Telemetry, Confidence & Parsing Status) ---
41
+
42
+
43
+ =======================================================================
44
+ --- RUNNING ELITE EXTREME TEST ON MODEL: Llama-3.3-70B (meta-llama/Llama-3.3-70B-Instruct) ---
45
+ --- Execution Time: 13.95s ---
46
+ --- STDOUT (Environment Steps & Actions) ---
47
+ [START] task=easy env=code-review-env model=meta-llama/Llama-3.3-70B-Instruct
48
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 410 - {'error': 'https://api-inference.huggingface.co is no longer supported. Please use https://router.huggingface.co instead.'}
49
+ [END] success=false steps=1 score=0.001 rewards=
50
+ [START] task=medium env=code-review-env model=meta-llama/Llama-3.3-70B-Instruct
51
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 410 - {'error': 'https://api-inference.huggingface.co is no longer supported. Please use https://router.huggingface.co instead.'}
52
+ [END] success=false steps=1 score=0.001 rewards=
53
+ [START] task=hard env=code-review-env model=meta-llama/Llama-3.3-70B-Instruct
54
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 410 - {'error': 'https://api-inference.huggingface.co is no longer supported. Please use https://router.huggingface.co instead.'}
55
+ [END] success=false steps=1 score=0.001 rewards=
56
+
57
+ --- STDERR (Telemetry, Confidence & Parsing Status) ---
58
+
59
+
60
+ =======================================================================
61
+ --- RUNNING ELITE EXTREME TEST ON MODEL: Mistral-Small (mistralai/Mistral-Small-Instruct-2409) ---
62
+ --- Execution Time: 35.65s ---
63
+ --- STDOUT (Environment Steps & Actions) ---
64
+ [START] task=easy env=code-review-env model=mistralai/Mistral-Small-Instruct-2409
65
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 410 - {'error': 'https://api-inference.huggingface.co is no longer supported. Please use https://router.huggingface.co instead.'}
66
+ [END] success=false steps=1 score=0.001 rewards=
67
+ [START] task=medium env=code-review-env model=mistralai/Mistral-Small-Instruct-2409
68
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 410 - {'error': 'https://api-inference.huggingface.co is no longer supported. Please use https://router.huggingface.co instead.'}
69
+ [END] success=false steps=1 score=0.001 rewards=
70
+ [START] task=hard env=code-review-env model=mistralai/Mistral-Small-Instruct-2409
71
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 410 - {'error': 'https://api-inference.huggingface.co is no longer supported. Please use https://router.huggingface.co instead.'}
72
+ [END] success=false steps=1 score=0.001 rewards=
73
+
74
+ --- STDERR (Telemetry, Confidence & Parsing Status) ---
75
+
76
+
77
+ =======================================================================
78
+ --- RUNNING ELITE EXTREME TEST ON MODEL: GPT-4o-Mini (via HF) (openai/gpt-4o-mini) ---
79
+ --- Execution Time: 39.40s ---
80
+ --- STDOUT (Environment Steps & Actions) ---
81
+ [START] task=easy env=code-review-env model=openai/gpt-4o-mini
82
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 410 - {'error': 'https://api-inference.huggingface.co is no longer supported. Please use https://router.huggingface.co instead.'}
83
+ [END] success=false steps=1 score=0.001 rewards=
84
+ [START] task=medium env=code-review-env model=openai/gpt-4o-mini
85
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 410 - {'error': 'https://api-inference.huggingface.co is no longer supported. Please use https://router.huggingface.co instead.'}
86
+ [END] success=false steps=1 score=0.001 rewards=
87
+ [START] task=hard env=code-review-env model=openai/gpt-4o-mini
88
+ [STEP] step=1 action={"operation":"done"} reward=0.01 done=true error=Error code: 410 - {'error': 'https://api-inference.huggingface.co is no longer supported. Please use https://router.huggingface.co instead.'}
89
+ [END] success=false steps=1 score=0.001 rewards=
90
+
91
+ --- STDERR (Telemetry, Confidence & Parsing Status) ---
run_hf_live_benchmark.py DELETED
@@ -1,126 +0,0 @@
1
- import os
2
- import subprocess
3
- import time
4
- import sys
5
-
6
- def main():
7
- models_to_test = [
8
- "deepseek/deepseek-chat",
9
- "qwen/qwen-2.5-72b-instruct",
10
- "openai/gpt-4o-mini",
11
- "meta-llama/llama-3.3-70b-instruct",
12
- "mistralai/mistral-small-3.1-24b-instruct"
13
- ]
14
-
15
- api_key = os.environ.get("OPENROUTER_API_KEY", "")
16
- hf_token = os.environ.get("HF_TOKEN_LIVE", "")
17
-
18
- output_lines = []
19
- output_lines.append("=======================================================================")
20
- output_lines.append("CODE REVIEW OPENENV - LIVE HUGGING FACE INFERENCE BENCHMARK TESTING")
21
- output_lines.append("=======================================================================\n")
22
- output_lines.append(f"Target Environment: https://ksiki-code-test.hf.space")
23
- output_lines.append(f"Target LLM Gateway: https://openrouter.ai/api/v1\n")
24
-
25
- print("Executing tests sequentially against Live HF Space...")
26
-
27
- for model in models_to_test:
28
- print(f"[{model}] Starting inference...")
29
-
30
- env_vars = os.environ.copy()
31
- env_vars["API_BASE_URL"] = "https://openrouter.ai/api/v1"
32
- env_vars["MODEL_NAME"] = model
33
- env_vars["HF_TOKEN"] = api_key # This goes to the LLM (OpenRouter)
34
- env_vars["ENV_BASE_URL"] = "https://ksiki-code-test.hf.space"
35
- env_vars["TASK_IDS"] = "easy,medium,hard"
36
-
37
- # Give the HF space a moment to guarantee clean reset
38
- time.sleep(2)
39
-
40
- start_time = time.time()
41
- try:
42
- result = subprocess.run(
43
- [sys.executable, "code-review-env/inference.py"],
44
- env=env_vars,
45
- capture_output=True,
46
- text=True,
47
- timeout=1800 # 30 mins per model
48
- )
49
- elapsed = time.time() - start_time
50
- print(f"[{model}] Completed in {elapsed:.1f}s.")
51
-
52
- output_lines.append(f"\n=======================================================================")
53
- output_lines.append(f"--- RUNNING ELITE EXTREME TEST ON MODEL: {model} ---")
54
- output_lines.append(f"--- Execution Time: {elapsed:.2f}s ---")
55
- output_lines.append("--- STDOUT (Environment Steps & Actions) ---")
56
- output_lines.append(result.stdout)
57
- output_lines.append("--- STDERR (Telemetry, Confidence & Parsing Status) ---")
58
- output_lines.append(result.stderr)
59
-
60
- except subprocess.TimeoutExpired as e:
61
- print(f"[{model}] TIMEOUT after {time.time() - start_time:.1f}s.")
62
- output_lines.append(f"\n[CRITICAL ERROR] {model} timed out.")
63
- except Exception as e:
64
- print(f"[{model}] ERROR: {str(e)}")
65
- output_lines.append(f"\n[CRITICAL ERROR] {model} threw exception: {str(e)}")
66
-
67
- explanation = """
68
- =======================================================================
69
- HOW THE GRADING, DECISION, AND CONFIDENCE LOGIC WORKS (Detailed Math)
70
- =======================================================================
71
-
72
- 1. THE MULTI-FILE CODE REVIEW ARCHITECTURE:
73
- An agent is presented with PRs. The Hard Task spans 3 distinct files
74
- (`crypto_service.py`, `config_loader.py`, `audit_logger.py`). The agent
75
- must use `inspect_file` and `inspect_lines` to traverse the repository,
76
- understand cross-file dependencies (e.g. secret keys generated in one file
77
- and misused in another), and find 6 major/critical bugs while ignoring 1
78
- deliberately planted Red Herring trap.
79
-
80
- 2. BUG MATCHING & DECISIONS:
81
- When an agent submits an `add_comment` action, the environment:
82
- - Proximity Check: Verifies the provided line_number is within +/- 5 lines
83
- of a confirmed Ground Truth Bug.
84
- - Attribute Check: Exact match required for `severity` and `category`.
85
- - Semantic Explanation Tiering: The message must contain specific technical
86
- keywords to prove the agent understands *why* it's broken, not just *where*.
87
- Higher explanation tiers grant full marks, missing semantic keywords results
88
- in a -0.10 penalty.
89
-
90
- 3. CONFIDENCE CALIBRATION & MODIFIER:
91
- If the model provides a "confidence" field (0-100), the system evaluates the
92
- Agent's self-awareness:
93
- - If confidence >= 80% and the comment is CORRECT -> +0.05 calibration bonus.
94
- - If confidence >= 80% and the comment is WRONG -> -0.10 heavy penalty.
95
- - The episode tracks `calibration_events` and calculates a final calibration_score
96
- (printed in STDERR) based on proper probabilistic alignment.
97
-
98
- 4. FALSE POSITIVES & THE RED HERRING:
99
- - Each incorrect comment generates a False Positive (FP). FPs are weighted
100
- by severity: Critical=3, Major=2, Minor=1, Nit=0.5.
101
- - The Red Herring is a deliberately suspicious block of code (try: ... except: pass
102
- in a backoff loop). If an agent flags it, they trigger a catastrophic penalty of -0.20,
103
- heavily crashing their precision score.
104
-
105
- 5. FINAL SCORE CALCULATION (Weighted F1 Grader):
106
- The formula strictly limits ceiling inflation:
107
- - Weighted True Positives (WTP) = sum of weights of correctly found bugs.
108
- - Weighted False Positives (WFP) = sum of weights of false positive comments.
109
- - Weighted False Negatives (WFN) = sum of weights of bugs completely missed.
110
-
111
- Precision (P) = WTP / (WTP + WFP)
112
- Recall (R) = WTP / (WTP + WFN)
113
- F1 Score = 2 * (P * R) / (P + R)
114
-
115
- Final Output = F1 Score + Efficiency Bonus (if done in few steps) + Calibration Modifier.
116
- Values strictly clamped to max 0.999 to prevent gamification. No LLM hits 1.0!
117
- """
118
- output_lines.append(explanation)
119
-
120
- with open("final test-2last.txt", "w", encoding="utf-8") as f:
121
- f.write("\n".join(output_lines))
122
-
123
- print("Done! Check final test-2last.txt")
124
-
125
- if __name__ == "__main__":
126
- main()