Commit 83695b0f authored by Data Governance Dev's avatar Data Governance Dev

perf: LLM 批量上限 15 → 30,减少一半调用

Step2 / Step5 两个 LLM 必跑步骤把单次请求承载量翻倍:

- step2_merge_redundancy.py: BATCH = 15 → 30
  (高频字段分类,21 个字段 → 1 次 LLM 调用,原来 2 次)
- step5_missing_comments.py: BATCH = 15 → 30
  (缺失注释推测,119 个字段 → 4 次 LLM 调用,原来 8 次)

每次调用时间略增(更多 input/output tokens),但消除了网络
往返 + LLM 服务侧 per-call 启动成本,总耗时预计缩短 30-50%。

未上更大 batch 的考虑:Step2 每条 item 约 100 tokens,
30 条后 prompt 已 ~3000 tokens,再大会撞输出 token 上限
并触发 LLM 注意力衰减。

首次跑后请观察 start.log 中 LLM 命中成功率(之前 119/119),
若下降到 100/119 以下需回调 BATCH。

AST 全部通过。
parent 01c9b105
......@@ -236,7 +236,7 @@ def _find_redundancy(by_table: dict, llm, log: Callable | None) -> list[dict]:
}
for f, n in candidates
]
BATCH = 15
BATCH = 30
annotated: list[dict | None] = []
total_batches = (len(llm_inputs) + BATCH - 1) // BATCH
for batch_idx in range(0, len(llm_inputs), BATCH):
......
......@@ -68,7 +68,7 @@ def run_step5(dict_data: dict, llm: LLMClient | None = None,
log("INFO", " · 无缺失注释字段,跳过 LLM", step="5")
return _empty_result(by_table)
BATCH = 15
BATCH = 30
predicted = []
unpredicted = []
llm_called = 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment