arXiv:2503.10666cs.CLcs.AI2025-03被引 6

优化提示词可显著降低大模型推理能耗,关键在语义而非长度。

Green Prompting: Characterizing Prompt-driven Energy Costs of LLM Inference

  • 通过分析提示词语义与关键词,发现其对能耗影响大于长度。
  • 相同任务下不同提示导致能耗差异高达数倍,语义决定能效。
  • 适合关注绿色AI、模型部署优化的研究者与工程师阅读。

大型语言模型(LLMs)在搜索、代码生成和文本创作等领域广泛应用,但其推理成本高昂,影响可持续性与经济可行性。本文实证研究了不同提示与响应特征对LLM推理能耗的影响,基于三类开源Transformer模型,在问答、情感分析和文本生成三种任务上展开实验。每轮推理中,分析了提示与响应的长度、语义含义、耗时及能耗。结果表明,即使任务相同,不同提示生成的响应特征各异,导致能耗模式显著不同。提示长度的影响小于任务本身的语义含义,且特定任务存在关联的高/低能耗关键词。研究揭示提示设计在优化推理效率中的关键作用,强调应从语义层面探索节能型大模型。

原文摘要 · Abstract (English)

Large Language Models (LLMs) have become widely used across various domains spanning search engines, code generation, and text creation. However, a major concern associated with their adoption is the high cost of inference, impacting both their sustainability and financial feasibility. In this study, we empirically study how different prompt and response characteristics directly impact LLM inference energy cost. We conduct experiments leveraging three open-source transformer-based LLMs across three task types$-$question answering, sentiment analysis, and text generation. For each inference, we analyzed prompt and response characteristics (length, semantic meaning, time taken, energy consumption). Our results demonstrate that even when presented with identical tasks, models generate responses with varying characteristics and subsequently exhibit distinct energy consumption patterns. We found that prompt length is less significant than the semantic meaning of the task itself. In addition, we identified specific keywords associated with higher or lower energy usage that vary between associated tasks. These findings highlight the importance of prompt design in optimizing inference efficiency. We conclude that the semantic meaning of prompts and certain task-related keywords significantly impact inference costs, leading the way for deeper exploration towards creating energy-adaptive LLMs.

大模型推理能耗提示工程绿色AI

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。