NecroMOnk commited on
Commit
de4ccc7
·
verified ·
1 Parent(s): 134f25e

Upload code-stress-bench

Browse files
Files changed (2) hide show
  1. README.md +57 -0
  2. test.jsonl +50 -0
README.md ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ task_categories:
6
+ - text-generation
7
+ tags:
8
+ - benchmark
9
+ - code
10
+ - evaluation
11
+ - debugging
12
+ size_categories:
13
+ - n<1K
14
+ ---
15
+
16
+ # Code Stress Benchmark
17
+
18
+ 50-task evaluation benchmark for code-focused LLMs. Built to test whether a fine-tune holds up across realistic workflow scenarios — not just isolated bug-fix puzzles.
19
+
20
+ ## Categories
21
+
22
+ | Category | Tasks | What it tests |
23
+ |---|---|---|
24
+ | easy_bug | 5 | Common Python/JS pitfalls |
25
+ | tricky_bug | 5 | Race conditions, default args, scoping |
26
+ | medium_script | 10 | Multi-step Python/JS/SQL/Bash |
27
+ | hard_algorithm | 10 | LRU cache, DP, graph traversal, LCA |
28
+ | edge_cases | 5 | Boundary conditions, error handling |
29
+ | architecture_review | 5 | Code review on small services |
30
+ | engineering_judgment | 5 | "Should I do X or Y?" prompts |
31
+ | design_reasoning | 5 | Open-ended system design |
32
+
33
+ ## Format
34
+
35
+ ```json
36
+ {
37
+ "id": "bug_easy_01",
38
+ "category": "easy_bug",
39
+ "language": "python",
40
+ "prompt": "Find and fix the bug:\n\n```python\ndef average(nums):\n return sum(nums) / len(nums)\n\nprint(average([]))\n```"
41
+ }
42
+ ```
43
+
44
+ ## Use
45
+
46
+ Designed for A/B comparison: run the same task through base and tuned models, then measure:
47
+ - **length ratio** (lora / base) — does the tune produce more focused answers?
48
+ - **lazy regression** — does the tune drop code blocks the base produced?
49
+ - **correctness** — manual review
50
+
51
+ Used to evaluate [NecroMOnk/Residual](https://huggingface.co/NecroMOnk/Residual) and [NecroMOnk/Tersa](https://huggingface.co/NecroMOnk/Tersa).
52
+
53
+ ```python
54
+ from datasets import load_dataset
55
+
56
+ ds = load_dataset("NecroMOnk/code-stress-bench")
57
+ ```
test.jsonl ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"id": "bug_easy_01", "category": "easy_bug", "language": "python", "prompt": "Find and fix the bug:\n\n```python\ndef average(nums):\n return sum(nums) / len(nums)\n\nprint(average([]))\n```"}
2
+ {"id": "bug_easy_02", "category": "easy_bug", "language": "python", "prompt": "Why does this function behave incorrectly?\n\n```python\ndef append_item(item, lst=[]):\n lst.append(item)\n return lst\n\nprint(append_item(1))\nprint(append_item(2))\n```"}
3
+ {"id": "bug_easy_03", "category": "easy_bug", "language": "javascript", "prompt": "Find the bug in this JavaScript code:\n\n```js\nfor (var i = 0; i < 3; i++) {\n setTimeout(() => console.log(i), 100);\n}\n```"}
4
+ {"id": "bug_easy_04", "category": "easy_bug", "language": "python", "prompt": "This function sometimes returns the wrong result. Why?\n\n```python\ndef is_even(n):\n return n % 2\n```"}
5
+ {"id": "bug_easy_05", "category": "easy_bug", "language": "python", "prompt": "Identify the problem in this code:\n\n```python\ndef sum_list(lst):\n total = 0\n for i in range(1, len(lst)):\n total += lst[i]\n return total\n```"}
6
+ {"id": "bug_tricky_01", "category": "tricky_bug", "language": "python", "prompt": "This code uses caching but can fail in concurrent environments. Why?\n\n```python\ncache = {}\n\ndef fib(n):\n if n in cache:\n return cache[n]\n if n <= 1:\n return n\n cache[n] = fib(n-1) + fib(n-2)\n return cache[n]\n```"}
7
+ {"id": "bug_tricky_02", "category": "tricky_bug", "language": "python", "prompt": "Why can this code produce inconsistent results?\n\n```python\nfrom threading import Thread\ncounter = 0\n\ndef inc():\n global counter\n for _ in range(100000):\n counter += 1\n\nthreads = [Thread(target=inc) for _ in range(2)]\nfor t in threads: t.start()\nfor t in threads: t.join()\nprint(counter)\n```"}
8
+ {"id": "bug_tricky_03", "category": "tricky_bug", "language": "python", "prompt": "There is a subtle logic bug here. What is it?\n\n```python\ndef normalize(values):\n total = sum(values)\n return [v / total for v in values if total]\n```"}
9
+ {"id": "bug_tricky_04", "category": "tricky_bug", "language": "c", "prompt": "Find the bug:\n\n```c\nint sum(int *arr, int n) {\n int total;\n for (int i = 0; i < n; i++) {\n total += arr[i];\n }\n return total;\n}\n```"}
10
+ {"id": "bug_tricky_05", "category": "tricky_bug", "language": "python", "prompt": "Why is this async code broken?\n\n```python\nimport asyncio\n\nasync def work():\n asyncio.sleep(1)\n print(\"done\")\n\nasyncio.run(work())\n```"}
11
+ {"id": "script_medium_01", "category": "medium_script", "language": "python", "prompt": "Write a Python script that reads a CSV file, groups rows by a column name, and computes the median of another column."}
12
+ {"id": "script_medium_02", "category": "medium_script", "language": "python", "prompt": "Write a Python script that scans a directory recursively and prints the 5 largest files with their sizes."}
13
+ {"id": "script_medium_03", "category": "medium_script", "language": "python", "prompt": "Write a Python script that parses a log file and counts how many ERROR, WARNING, and INFO lines it contains."}
14
+ {"id": "script_medium_04", "category": "medium_script", "language": "python", "prompt": "Write a Python CLI tool that accepts a JSON file path and prints all keys that appear more than once at any nesting level."}
15
+ {"id": "script_medium_05", "category": "medium_script", "language": "python", "prompt": "Write a Python script that fetches data from a public HTTP API and caches responses locally to avoid repeated requests."}
16
+ {"id": "script_medium_06", "category": "medium_script", "language": "javascript", "prompt": "Write a Node.js script that reads a JSON file, filters objects by a field value, and writes the result to a new file."}
17
+ {"id": "script_medium_07", "category": "medium_script", "language": "javascript", "prompt": "Write a JavaScript function that debounces another function with a configurable delay."}
18
+ {"id": "script_medium_08", "category": "medium_script", "language": "sql", "prompt": "Write an SQL query that returns the top 3 users by total purchase amount per month from a purchases table."}
19
+ {"id": "script_medium_09", "category": "medium_script", "language": "bash", "prompt": "Write a Bash script that finds all files modified in the last 24 hours and archives them into a tar.gz file."}
20
+ {"id": "script_medium_10", "category": "medium_script", "language": "python", "prompt": "Write a Python script that validates a configuration dictionary against a required schema and reports missing or invalid fields."}
21
+ {"id": "algo_hard_01", "category": "hard_algorithm", "language": "python", "prompt": "Implement a function that finds the maximum sum subarray with a maximum length k.\n\nInput: array of integers, integer k.\nOutput: maximum possible sum."}
22
+ {"id": "algo_hard_02", "category": "hard_algorithm", "language": "python", "prompt": "Implement a function that detects whether a directed graph contains a cycle.\n\nThe graph is given as an adjacency list."}
23
+ {"id": "algo_hard_03", "category": "hard_algorithm", "language": "python", "prompt": "Given a list of intervals, merge all overlapping intervals and return the result."}
24
+ {"id": "algo_hard_04", "category": "hard_algorithm", "language": "python", "prompt": "Implement an LRU cache with get and put operations in O(1) time."}
25
+ {"id": "algo_hard_05", "category": "hard_algorithm", "language": "python", "prompt": "Write a function that finds the lowest common ancestor (LCA) of two nodes in a binary tree."}
26
+ {"id": "algo_hard_06", "category": "hard_algorithm", "language": "python", "prompt": "Implement Dijkstra’s algorithm for shortest paths from a source node in a weighted graph."}
27
+ {"id": "algo_hard_07", "category": "hard_algorithm", "language": "python", "prompt": "Given a string, find the length of the longest substring without repeating characters."}
28
+ {"id": "algo_hard_08", "category": "hard_algorithm", "language": "cpp", "prompt": "Implement a function that reverses a singly linked list iteratively and recursively."}
29
+ {"id": "algo_hard_09", "category": "hard_algorithm", "language": "python", "prompt": "Given a matrix, rotate it 90 degrees clockwise in place."}
30
+ {"id": "algo_hard_10", "category": "hard_algorithm", "language": "python", "prompt": "Implement a function that computes edit distance (Levenshtein distance) between two strings."}
31
+ {"id": "arch_review_01", "category": "architecture_review", "language": "python", "prompt": "Review this function and suggest how to improve its readability and maintainability:\n\n```python\ndef process(data):\n res = []\n for i in data:\n if i[\"type\"] == \"A\":\n if i[\"value\"] > 10:\n res.append(i)\n else:\n if i[\"value\"] < 5:\n res.append(i)\n return res\n```"}
32
+ {"id": "arch_review_02", "category": "architecture_review", "language": "python", "prompt": "This function works but is hard to test. Why, and how would you refactor it?\n\n```python\ndef send_report():\n import requests\n data = load_data_from_db()\n requests.post(\"https://api.example.com/report\", json=data)\n```"}
33
+ {"id": "arch_review_03", "category": "architecture_review", "language": "javascript", "prompt": "What are the design problems in this code, and how would you improve it?\n\n```js\nfunction handle(req) {\n if (req.type === 'A') {\n if (req.flag) {\n doA1();\n } else {\n doA2();\n }\n } else if (req.type === 'B') {\n doB();\n } else {\n doDefault();\n }\n}\n```"}
34
+ {"id": "arch_review_04", "category": "architecture_review", "language": "python", "prompt": "Refactor this code to make error handling explicit and easier to follow:\n\n```python\ndef load_config(path):\n try:\n with open(path) as f:\n return json.load(f)\n except:\n return {}\n```"}
35
+ {"id": "arch_review_05", "category": "architecture_review", "language": "python", "prompt": "This function mixes concerns. Identify them and suggest a cleaner structure:\n\n```python\ndef process_order(order):\n if order['paid']:\n save_to_db(order)\n send_email(order['email'])\n print('done')\n```"}
36
+ {"id": "arch_reasoning_06", "category": "design_reasoning", "language": "any", "prompt": "You need to design a small service that processes background jobs. What components would you separate and why?"}
37
+ {"id": "arch_reasoning_07", "category": "design_reasoning", "language": "any", "prompt": "Given a growing codebase, how would you decide when to refactor versus when to leave code as-is?"}
38
+ {"id": "arch_reasoning_08", "category": "design_reasoning", "language": "any", "prompt": "What trade-offs do you consider when choosing between synchronous and asynchronous code?"}
39
+ {"id": "arch_reasoning_09", "category": "design_reasoning", "language": "any", "prompt": "How would you approach making a legacy system more testable without rewriting it?"}
40
+ {"id": "arch_reasoning_10", "category": "design_reasoning", "language": "any", "prompt": "Describe a situation where adding abstraction makes code worse instead of better."}
41
+ {"id": "eng_edge_01", "category": "engineering_judgment", "language": "any", "prompt": "You are asked to optimize a piece of code that runs once a day and takes 2 seconds. Would you do it? Why or why not?"}
42
+ {"id": "eng_edge_02", "category": "engineering_judgment", "language": "any", "prompt": "A bug appears once a month in production and cannot be reproduced locally. How would you approach debugging it?"}
43
+ {"id": "eng_edge_03", "category": "engineering_judgment", "language": "any", "prompt": "When is it acceptable to leave technical debt in a codebase?"}
44
+ {"id": "eng_edge_04", "category": "engineering_judgment", "language": "any", "prompt": "You can fix a bug quickly with a hack or properly with a refactor that takes longer. How do you decide?"}
45
+ {"id": "eng_edge_05", "category": "engineering_judgment", "language": "any", "prompt": "Describe a situation where adding tests could slow development instead of helping it."}
46
+ {"id": "edge_case_06", "category": "edge_cases", "language": "python", "prompt": "What edge cases should be considered when writing a function that parses user-provided dates?"}
47
+ {"id": "edge_case_07", "category": "edge_cases", "language": "sql", "prompt": "What edge cases can cause incorrect results in SQL queries that use GROUP BY and aggregation?"}
48
+ {"id": "edge_case_08", "category": "edge_cases", "language": "javascript", "prompt": "What edge cases should be handled when working with floating point numbers in JavaScript?"}
49
+ {"id": "edge_case_09", "category": "edge_cases", "language": "bash", "prompt": "What common edge cases break Bash scripts when handling file names?"}
50
+ {"id": "edge_case_10", "category": "edge_cases", "language": "any", "prompt": "Give an example of a bug caused by incorrect assumptions about input data."}