Can researchers use local open-weight models instead of commercial APIs for LLM text classification? Local models avoid marginal API charges, keep data on the researcher's machine, and make exact model versions easier to preserve. I benchmark five local models against four commercial API models on 34 political science classification tasks. Local models are often competitive, especially on simpler tasks. In a task-specific oracle comparison, local models match or exceed API performance on 9 tasks; on average, the best API model exceeds the best local model by 0.015 F1. The four strongest observed model means fall within 0.021 F1. API models have their clearest edge on complex tasks with many labels or multiple outputs per item. Batching several items in one prompt usually reduces local runtime per item, but specific model-task pairs can return invalid response formats or labels. Taken together, the results make local open-weight models a practical candidate alternative for many political science classification tasks, provided researchers validate candidate models on task-specific labels and check batching reliability before scaling up.
翻译:研究者能否使用本地开源权重模型替代商业API进行LLM文本分类?本地模型可避免边际API费用,将数据保留在研究者机器上,且更易保存确切的模型版本。我在34个政治学分类任务上对五种本地模型与四种商业API模型进行了基准测试。本地模型通常具有竞争力,尤其在较简单任务中表现突出。在任务特定的理想对照比较中,本地模型在9个任务中匹配或超越API性能;平均而言,最佳API模型比最佳本地模型高出0.015的F1值。四个最强观测模型均值差异在0.021 F1以内。API模型在多标签或多输出的复杂任务中优势最为明显。将多个项目批量放入同一提示中通常能减少每个项目的本地运行时间,但特定模型-任务组合可能返回无效响应格式或标签。综合来看,结果表明:只要研究者根据任务特定标签验证候选模型并在扩展前检查批量可靠性,本地开源权重模型即可成为许多政治学分类任务的实用替代方案。