import json from collections import defaultdict with open("/home/user/code_baseline_results.json") as f: base = json.load(f) with open("/home/user/code_modified_results.json") as f: mod = json.load(f) print("=" * 100) print("QWEN3-0.6B EXECUTABLE MULTI-LANGUAGE CODE BENCHMARK: NORMAL (BASELINE) VS WEIGHT-EDITED") print("=" * 100) print(f"Normal (Baseline) Qwen3-0.6B : {base['passed']:2d}/{base['total']} ({base['accuracy']:5.2f}%) | Avg Tokens: {base['avg_tokens']:4.1f} | Time: {base['elapsed_sec']:6.2f}s") print(f"Weight-Edited Code Surgery : {mod['passed']:2d}/{mod['total']} ({mod['accuracy']:5.2f}%) | Avg Tokens: {mod['avg_tokens']:4.1f} | Time: {mod['elapsed_sec']:6.2f}s") print(f"Net Improvement : +{mod['passed'] - base['passed']} tasks (+{mod['accuracy'] - base['accuracy']:.2f}% absolute accuracy gain, 0 regressions)") print("-" * 100) cats = defaultdict(lambda: {"total": 0, "base": 0, "mod": 0, "base_toks": 0, "mod_toks": 0}) for rb, rm in zip(base["results"], mod["results"]): c = rb["category"] cats[c]["total"] += 1 cats[c]["base"] += int(rb["passed"]) cats[c]["mod"] += int(rm["passed"]) cats[c]["base_toks"] += rb["num_tokens"] cats[c]["mod_toks"] += rm["num_tokens"] print(f"{'Category':20s} | {'Normal (Base)':16s} | {'Code Surgery':16s} | {'Delta':10s} | {'Base Toks':10s} | {'Edited Toks':10s}") print("-" * 100) for c, st in cats.items(): t = st["total"] bp = 100.0 * st["base"] / t mp = 100.0 * st["mod"] / t bt = st["base_toks"] / t mt = st["mod_toks"] / t print(f"{c:20s} | {st['base']}/{t} ({bp:6.2f}%) | {st['mod']}/{t} ({mp:6.2f}%) | +{st['mod']-st['base']} (+{mp-bp:5.2f}%) | {bt:8.1f} | {mt:8.1f}") print("-" * 100) print(f"{'ID':9s} | {'Category':16s} | {'Base':6s} | {'Edited':6s} | {'Toks (B->E)':11s} | {'Transition & Verification Detail'}") print("-" * 100) gains, regs = 0, 0 for rb, rm in zip(base["results"], mod["results"]): bs = "PASS" if rb["passed"] else "FAIL" ms = "PASS" if rm["passed"] else "FAIL" if not rb["passed"] and rm["passed"]: gains += 1 tag = "[+GAIN]" elif rb["passed"] and not rm["passed"]: regs += 1 tag = "[-REGR]" else: tag = " " tok_s = f"{rb['num_tokens']:2d} -> {rm['num_tokens']:2d}" print(f"{rb['id']:9s} | {rb['category']:16s} | {bs:6s} | {ms:6s} | {tok_s:11s} | {tag} {rm['detail']}") print("=" * 100) print(f"Total Flipped FAIL -> PASS: +{gains} | Total Regressions PASS -> FAIL: {regs}") print("=" * 100)