| 47 | |
| 48 | |
| 49 | def parse_args(): |
| 50 | parser = argparse.ArgumentParser(description="KVCOMM Experiments on GSM8K") |
| 51 | parser.add_argument("--dataset_json", type=str, default="datasets/gsm8k/gsm8k.jsonl") |
| 52 | parser.add_argument("--llm_name", type=str, default="meta-llama/Llama-3.1-8B-Instruct") |
| 53 | parser.add_argument( |
| 54 | "--mode", |
| 55 | type=str, |
| 56 | default="FullConnected", |
| 57 | choices=["DirectAnswer", "FullConnected", "Random", "Chain", "Debate", "Layered", "Star"], help="The communication topology among agents." |
| 58 | ) |
| 59 | parser.add_argument("--batch_size", type=int, default=1, help="Batch size.") |
| 60 | parser.add_argument("--domain", type=str, default="gsm8k") |
| 61 | parser.add_argument( |
| 62 | "--agent_names", |
| 63 | nargs="+", |
| 64 | type=str, |
| 65 | default=["MathSolver"], |
| 66 | help="List of agent names in the graph.", |
| 67 | ) |
| 68 | parser.add_argument( |
| 69 | "--agent_nums", |
| 70 | nargs="+", |
| 71 | type=int, |
| 72 | default=[3], |
| 73 | help="List of agent counts corresponding to agent names.", |
| 74 | ) |
| 75 | parser.add_argument( |
| 76 | "--decision_method", |
| 77 | type=str, |
| 78 | default="FinalRefer", |
| 79 | help="Decision method for the graph.", |
| 80 | ) |
| 81 | parser.add_argument( |
| 82 | "--execution_mode", |
| 83 | type=str, |
| 84 | default="default", |
| 85 | choices=["default", "allow_kv_reuse"], |
| 86 | help="Execution strategy for the graph.", |
| 87 | ) |
| 88 | parser.add_argument("--output_dir", type=str, default=str(PROJECT_ROOT / "result" / "gsm8k"), help="Directory to save the output results.") |
| 89 | parser.add_argument("--prefix", type=str, default="Q:\n", help="The prefix text for the input query, kept the same as the default dense prefill mode.") |
| 90 | parser.add_argument("--kv-threshold", type=float, default=None, help="Threshold for key-value memory usage.") |
| 91 | parser.add_argument("--kv-max-anchor-num", type=int, default=None, help="Maximum number of anchors for key-value memory.") |
| 92 | parser.add_argument("--kv-window-size", type=int, default=None, help="Window size for key-value memory update.") |
| 93 | parser.add_argument("--kv-thread-workers", type=int, default=None, help="Number of thread workers for key-value memory processing.") |
| 94 | parser.add_argument("--kv-worker-timeout", type=float, default=None, help="Timeout for key-value memory workers processing.") |
| 95 | args = parser.parse_args() |
| 96 | |
| 97 | if len(args.agent_names) != len(args.agent_nums): |
| 98 | parser.error("The number of agent names must match the number of agent counts.") |
| 99 | return args |
| 100 | |
| 101 | |
| 102 | async def main(): |