Prompt Template Optimization Using LLM-Guided Gradient Descent

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Integrating large language models (LLMs) into enterprise platforms is challenging due to the complexity of prompts, which require substantial resource consumption and a time-consuming trial-and-error process for optimization.

Innovation Solution

An automatic prompt optimization (APO) platform uses a non-parameterized version of gradient descent to iteratively update prompt templates based on LLM evaluations, simulating conventional ML training processes to optimize prompt templates efficiently.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Manufacturing precision

If prompt templates are optimized using trial-and-error process, then prompt effectiveness is improved, but time consumption and resource consumption increase

Engineering Contradiction:
Improveprompt effectivenessVSAvoidoptimization time
Core Design Contradiction:
Manufacturing precisionVSLoss of time

Solution Approach 1:

The patent replaces the manual trial-and-error mechanical process with an automated gradient descent optimization system. The gradient descent algorithm automatically computes gradients of evaluation metrics with respect to prompt parameters and iteratively updates prompts to maximize effectiveness, eliminating the need for manual trial-and-error experimentation while reducing time consumption and resource usage.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Solution Approach 2:

The optimization system performs self-service by automatically generating improved prompt versions through gradient-based optimization. The system autonomously evaluates prompt effectiveness, computes optimization directions, and generates updated prompts without requiring external human intervention or repeated manual trial-and-error attempts, thereby reducing both time and resource consumption.

Inventive Principle:
Principle #25Self-service

2Manufacturing precision

If prompt templates are optimized using trial-and-error process, then prompt effectiveness is improved, but resource consumption increases

Engineering Contradiction:
Improveprompt effectivenessVSAvoidresource consumption
Core Design Contradiction:
Manufacturing precisionVSUse of energy by moving object

Solution Approach 1:

The patent replaces resource-intensive manual trial-and-error processes with an efficient gradient descent optimization system. The algorithm computes precise gradient directions to guide prompt optimization, requiring fewer iterations and less computational resource consumption compared to exhaustive trial-and-error methods, while achieving the same or better prompt effectiveness.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Solution Approach 2:

The optimization system efficiently explores the prompt parameter space by computing gradients with respect to prompt parameters and making targeted parameter updates. This parameter-based optimization approach is more resource-efficient than trial-and-error methods that randomly or systematically test different prompt configurations, reducing overall resource consumption while improving prompt effectiveness.

Inventive Principle:
Principle #35Parameter changes

3Adaptability or versatility

If complex prompts are used for enterprise platforms, then AI capabilities are improved, but integration complexity increases

Engineering Contradiction:
ImproveAI capabilitiesVSAvoidintegration complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent replaces complex manual prompt engineering and integration processes with an automated gradient descent optimization system. This system handles the complexity of optimizing sophisticated prompts for enterprise AI applications automatically, reducing integration complexity while maintaining or enhancing AI capabilities through systematically optimized prompts.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

4Manufacturing precision

If manual prompt optimization is performed, then prompt effectiveness is improved, but productivity decreases

Engineering Contradiction:
Improveprompt effectivenessVSAvoiddevelopment speed
Core Design Contradiction:
Manufacturing precisionVSProductivity

Solution Approach 1:

The optimization system performs self-service by automatically generating improved prompt versions through gradient-based optimization. It autonomously evaluates prompt effectiveness, computes optimization directions, and generates updated prompts without requiring external human intervention or repeated manual trial-and-error attempts, thereby reducing both time and resource consumption.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The patent replaces manual trial-and-error mechanical processes with an automated gradient descent optimization system. The gradient descent algorithm automatically computes gradients of evaluation metrics with respect to prompt parameters and iteratively updates prompts to maximize effectiveness, eliminating the need for manual trial-and-error experimentation while reducing time consumption and resource usage.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Data Source

PatentUS20250371356A1Prompt template optimization with non-parameterized gradient descent for enterprise-level ai use cases
Publication Date: 2025.12.04 SAP SE
  • US20250371356A1 patent drawing
  • US20250371356A1 patent drawing
  • US20250371356A1 patent drawing

AI summary

Methods, systems, and computer-readable storage media for providing an initial version of a prompt template, the prompt template including dynamic input and first static input, generating a prompt using the initial version of the prompt template at least partially by populating the dynamic input with training data, receiving, from a large language model (LLM), an output that is responsive to the prompt, providing an evaluation at least partially based on the output, and selectively updating the prompt template to provide an updated version of the prompt template by prompting the LLM at least partially based on the evaluation, the updated version of the prompt template including second static input that is generated by the LLM and that is different from the first static input.