@@ -112,6 +112,11 @@ def parse_args() -> argparse.Namespace:
112112 "crossings per block. Requires --s5-exact-full-attn "
113113 "(the all-MLX path uses native-S5 injection; the "
114114 "f_theta sliding restoration path stays torch)." )
115+ ap .add_argument ("--code-prompts" , action = "store_true" ,
116+ help = "Replace the NIAH dataset with code-completion prompts "
117+ "(naturally-long, predictable generation = the spec-decode "
118+ "sweet spot). Recall metric is N/A; measures honest "
119+ "decode-only throughput + acceptance on a real workload." )
115120 ap .add_argument ("--ignore-turn-stop" , action = "store_true" ,
116121 help = "Do not include Gemma4 <turn|> as a stop token. "
117122 "Useful for throughput evidence runs that require "
@@ -391,12 +396,41 @@ def restored_forward(ids: List[int], rk, rv, t_src, *, return_all: bool):
391396 )
392397
393398 # ---------- Dataset ----------
394- samples : List [NIAHSample ] = make_niah_dataset (
395- n_samples = args .n_samples ,
396- haystack_min_lines = args .haystack_min_lines ,
397- haystack_max_lines = args .haystack_max_lines ,
398- seed = args .seed ,
399- )
399+ if args .code_prompts :
400+ _CODE = [
401+ "Write a complete Python implementation of a binary search tree class "
402+ "with insert, search, and in-order traversal methods. Include type "
403+ "hints and docstrings." ,
404+ "Implement a Python LRU cache class with get and put methods using an "
405+ "OrderedDict. Include type hints and docstrings." ,
406+ "Write a Python function that parses a CSV string into a list of dicts, "
407+ "correctly handling quoted fields and embedded commas. Add error handling." ,
408+ "Implement quicksort in Python with an in-place partition helper. "
409+ "Include docstrings and a small example in a __main__ block." ,
410+ "Write a Python class for a fixed-capacity ring buffer with push, pop, "
411+ "and is_full methods, raising on overflow. Include type hints." ,
412+ "Implement a recursive descent parser in Python for arithmetic "
413+ "expressions with + - * / and parentheses. Return the evaluated value." ,
414+ "Write a Python decorator `retry` that retries a function up to n times "
415+ "with exponential backoff on exception. Include type hints and docstring." ,
416+ "Implement a thread-safe counter class in Python using threading.Lock, "
417+ "with increment, decrement, and value methods." ,
418+ ]
419+ n = min (args .n_samples , len (_CODE ))
420+ samples : List [NIAHSample ] = [
421+ NIAHSample (prompt_text = p , answer_text = "" , needle_line_index = 0 ,
422+ needle_text = "" )
423+ for p in _CODE [:n ]
424+ ]
425+ print (f"[mac] CODE-PROMPTS workload: { n } prompts (recall N/A; "
426+ f"measuring decode throughput + acceptance)" , file = sys .stderr )
427+ else :
428+ samples = make_niah_dataset (
429+ n_samples = args .n_samples ,
430+ haystack_min_lines = args .haystack_min_lines ,
431+ haystack_max_lines = args .haystack_max_lines ,
432+ seed = args .seed ,
433+ )
400434
401435 def encode (prompt_text : str ) -> List [int ]:
402436 if args .direct_answer_prompt :
@@ -1036,12 +1070,17 @@ def _mx_peak_mb() -> Optional[float]:
10361070 print (f"\n [mac] DONE. { sut_label } ={ cross_res .recall :.3f} "
10371071 f"oracle={ oracle_res .recall if oracle_res else 'skipped' } "
10381072 f"-> { out_path } " , file = sys .stderr )
1039- if violations :
1073+ if violations and args .code_prompts :
1074+ print ("[mac] code-prompts throughput probe: recall is N/A by design; "
1075+ "evidence gate informational only (not aborting):\n "
1076+ + summarize_violations (violations ), file = sys .stderr )
1077+ elif violations :
10401078 print ("[mac] EVIDENCE GATE FAILED — this report is NOT admissible "
10411079 "as evidence:\n " + summarize_violations (violations ),
10421080 file = sys .stderr )
10431081 return 2
1044- print ("[mac] evidence gate: PASS" , file = sys .stderr )
1082+ else :
1083+ print ("[mac] evidence gate: PASS" , file = sys .stderr )
10451084 return 0
10461085
10471086
0 commit comments