arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2511.20683cs.CL
收藏

动态模板选择用于输出标记生成优化:基于MLP和Transformer的方法

Dynamic Template Selection for Output Token Generation Optimization: MLP-Based and Transformer Approaches

Bharadwaj Yadavalli

AI总结:

本文提出动态模板选择方法,通过MLP和Transformer路由策略优化输出标记生成,实现成本降低与响应质量的平衡。

摘要:

当前大型语言模型的部署通常在多样化的查询类型上采用统一的提示策略,对复杂的分析任务和简单的事实性问题都应用冗长的响应模式。这种一刀切的方法导致了显著的标记效率低下,这一问题在输入和输出标记之间显著的成本差异下变得更加严重--后者在主要提供商中价格高出4-8倍。我们提出了动态模板选择(DTS),它能够适应性地匹配响应模板以匹配查询复杂性,从而在不牺牲响应质量的情况下实现显著的成本降低。我们比较了两种路由方法:一个简单的MLP,它使用预计算的嵌入,以及更复杂的微调后的RoBERTa变压器。通过在1000个MMLU问题上的全面评估,我们发现MLP路由在保留测试数据上的路由准确率为90.5%,略微超过RoBERTa的表现(89.5%),尽管其使用了125M个参数更少。值得注意的是,我们的实证分析揭示了模板选择的提供商无关行为--路由决策在3个主要LLM提供商(OpenAI GPT-4、Google Gemini和Anthropic Claude)上都能有效泛化,这通过9000次生产API调用得到验证。虽然路由准确性在各提供商上保持一致为90.5%,但观察到的标记减少率从32.6%到33.9%不等,反映了提供商特定的生成特征。这项工作贡献了几个关键要素:具有机器学习理论基础的正式问题公式化,四种算法及其相应的复杂度分析,以及在生产系统中的广泛实证验证。

英文摘要:

Contemporary large language model deployments typically employ uniform prompting strategies across diverse query types, applying verbose response patterns to both complex analytical tasks and straightforward factual questions. This one-size-fits-all methodology leads to substantial token inefficiency, a concern amplified by the significant cost differential between input and output tokens--the latter commanding 4-8x higher prices across major providers. We present Dynamic Template Selection (DTS), which adaptively matches response templates to query complexity, achieving significant cost reductions without compromising response quality. We compared two routing approaches: a simple MLP that uses pre-computed embeddings and a more complex fine-tuned RoBERTa transformer. Through comprehensive evaluation on 1,000 MMLU questions, we find that the MLP router achieves 90.5% routing accuracy on held-out test data, marginally exceeding RoBERTa's performance (89.5%) despite utilizing 125M fewer parameters. Notably, our empirical analysis reveals provider-agnostic behavior in template selection--routing decisions generalize effectively across 3 major LLM providers (OpenAI GPT-4, Google Gemini, and Anthropic Claude), as validated through 9,000 production API calls. While routing accuracy remains consistent at 90.5% across providers, observed token reductions vary from 32.6% to 33.9%, reflecting provider-specific generation characteristics. This work contributes several key elements: formal problem formulation with theoretical grounding in machine learning, four algorithms with corresponding complexity analyses, and extensive empirical validation across production systems.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑