EmbedGrad: Gradient-Based Prompt Optimization in Embedding Space for Large Language Models

2508.03533v1 cs.CL 2025-08-09
Авторы:

Xiaoming Hou, Jiquan Zhang, Zibin Lin, DaCheng Tao, Shengli Zhang

Резюме на русском

Одной из основных проблем в развитии машинного обучения является эффективное приспособление мощных предобученных моделей к различным задачам. Существуют две основные подходы: дискретная оптимизация текстовых приглашений (prompts) и непрерывная адаптация с помощью дополнительных trainable параметров. Однако оба подхода имеют ограничения: дискретные методы не обеспечивают достаточной точности, а параметрические подходы усложняют модели и снижают их интерпретируемость. Предлагаемый EmbedGrad — это новый фреймворк, основанный на градиентной оптимизации текстовых приглашений в пространстве вычислительных слоёв. EmbedGrad разделяет тренировочный процесс и работу модели: в процессе оптимизации лейбленные примеры позволяют точно настраивать приглашения, сохраняя семантический смысл, в то время как во время работы модели используются только оптимизированные приглашения. Опытные испытания показали, что EmbedGrad эффективно улучшает работу моделей в различных задачах, таких как математическое разумение, анализ тональности и вывод причинно-следственных связей. Например, улучшение приглашения для Qwen2.5-Math-1.5B увеличило точность на 44.22 процентные очки в решении математических задач. Эти результаты доказывают, что EmbedGrad может стать мощным инструментом для улучшения task adaptation без необходимости внесения изменений в модель.

Abstract

Effectively adapting powerful pretrained foundation models to diverse tasks remains a key challenge in AI deployment. Current approaches primarily follow two paradigms:discrete optimization of text prompts through prompt engineering, or continuous adaptation via additional trainable parameters. Both exhibit limitations-discrete methods lack refinement precision while parameter-based techniques increase complexity and reduce interpretability. To address these constraints, we propose EmbedGrad, a novel framework that optimizes text prompt embeddings through gradient-based refinement. Our approach uniquely decouples training from deployment:during optimization,labeled examples guide precise embedding adjustments while preserving semantic meaning; during inference, only optimized embeddings integrate with user queries. This enables fine-grained calibration impossible in text space, such as enhancing the reasoning capability of prompts like please reason step by step. Comprehensive evaluations across mathematical reasoning, sentiment analysis, and causal judgment tasks demonstrate EmbedGrad's effectiveness:optimizing this reasoning prompt for Qwen2.5-Math-1.5B increased accuracy from 14.74\% to 58.96\% on mathematical problems. Consistent improvements were observed across model scales (0.5B-14B) and all tasks, with particularly significant gains for smaller models on complex problems like causal judgment. By bridging prompt engineering and parameter efficiency without architectural changes, our work establishes embedding refinement as a powerful new paradigm for task adaptation.

Ссылки и действия