🤖 AI Summary
This paper addresses the high inference cost of large language models (LLMs) in warehouse-scale code generation. We propose a collaborative framework integrating strong and weak LLMs. Methodologically, we design a context-distribution-based, pipeline-orchestrated, and dynamically routed collaboration architecture, coupled with an empirical evaluation framework to systematically analyze cost–performance trade-offs across diverse collaboration paradigms on GitHub issue resolution. Our key contributions are: (1) identification and validation of a dynamic collaboration strategy that matches the performance of the strongest standalone model while reducing inference cost by 40%; (2) the first empirical demonstration that weak models exhibit substantial capability gains under structured collaboration, with context distribution and pipeline orchestration emerging as the most effective enhancement mechanisms; and (3) practical, deployment-oriented guidelines for model selection and collaboration strategy design, accompanied by open-sourcing of the complete codebase.
📝 Abstract
We study cost-efficient collaboration between strong and weak language models for repository-level code generation, where the weak model handles simpler tasks at lower cost, and the most challenging tasks are delegated to the strong model. While many works propose architectures for this task, few analyze performance relative to cost. We evaluate a broad spectrum of collaboration strategies: context-based, pipeline-based, and dynamic, on GitHub issue resolution. Our most effective collaborative strategy achieves equivalent performance to the strong model while reducing the cost by 40%. Based on our findings, we offer actionable guidelines for choosing collaboration strategies under varying budget and performance constraints. Our results show that strong-weak collaboration substantially boosts the weak model's performance at a fraction of the cost, pipeline and context-based methods being most efficient. We release the code for our work at https://github.com/shubhamrgandhi/codegen-strong-weak-collab.