Prompt optimization method, system and device, storage medium and program product

Through multiple rounds of optimization mechanisms and feedback guidance mechanisms, the optimization strategy of the natural language generation system is intelligently adjusted, which solves the problem of unclear propt conversion in complex tasks of the existing system, realizes high-quality natural language generation, and improves the user experience.

CN120146224APending Publication Date: 2025-06-13HUA DATA TECH (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510242110.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-28
Publication Date
2025-06-13

AI Technical Summary

Technical Problem

When existing natural language generation systems deal with complex tasks, it is difficult to clearly convert user problems into effective propts, resulting in unrelated, lengthy, lack of logic or unclear expression of generated content, and lack of flexible feedback mechanisms, and unable to dynamically adjust optimization strategies.

Method used

Using multiple rounds of optimization mechanisms and feedback guidance mechanisms, the initial Prompt input module, multiple rounds of optimization modules, feedback guidance modules, expected output guidance modules and custom template support modules are used to receive user feedback, intelligently adjust optimization strategies, and realize an intelligent iterative optimization process.

Benefits of technology

Through intelligent iterative optimization, the generated propt gradually approaches user expectations, improving the quality and accuracy of generated content, meeting the needs of complex tasks, and improving user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120146224A_ABST
    Figure CN120146224A_ABST
Patent Text Reader

Abstract

The invention provides a prompt optimization method, system and device, a storage medium and a program product, and relates to the technical field of natural language processing. The optimization method comprises the following steps: receiving a preliminary prompt by using an initial input module; performing multi-round optimization by using a multi-round optimization module, and dynamically adjusting an optimization strategy according to user feedback; a feedback guiding module is used for analyzing and collecting feedback information of the user, and an optimization strategy is adjusted; using an expected output guiding module to guide the optimization process; the method also supports the user to create a self-defined optimization template, provides multiple preset optimization templates, and supports the user to select in multiple optimization models by himself or automatically adjust according to task requirements. According to the method, a multi-round optimization mechanism and a feedback guide mechanism are adopted, specific feedback information provided by a user after each round of optimization is received, and an optimization strategy is intelligently adjusted according to the feedback information, so that an intelligent iterative optimization process is realized, and the prompt generated by optimization is gradually close to the expectation of the user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing, and in particular, to a prompt optimization method, system, device, storage medium, and program product. Background Art

[0002] Natural Language Generation (NLG) technologies implemented based on large language models (such as GPT, Wenxin Yiyan) have been widely used in multiple fields. Most natural language generation systems rely on the initial prompt input by users. However, users often have difficulty providing clear, accurate, and structured prompts, which may lead to problems such as irrelevant, lengthy, illogical, or unclear content generated by the model. Especially in complex tasks, how to effectively convert problems into clear prompts remains a technical challenge.

[0003] To solve the problem of prompt optimization, most current systems use simple static optimization strategies. The optimization process is usually one-time, such as optimizing based on preset templates or rules. These optimization processes lack a flexible feedback mechanism and cannot dynamically adjust the optimization strategy according to user feedback and expectations, resulting in the quality and accuracy of the generated content being difficult to meet user expectations and unable to effectively meet the requirements of complex tasks, especially when the gap between the generation effect and the expected output is large. Summary of the Invention

[0004] In view of the deficiencies of the prior art, the present invention proposes a prompt optimization method, system, device, storage medium, and program product. It adopts a multi-round optimization mechanism and a feedback guidance mechanism, receives specific feedback information provided by users after each round of optimization, and intelligently adjusts the optimization strategy according to the feedback information to achieve an intelligent iterative optimization process, making the optimized generated prompt gradually approach user expectations.

[0005] In a first aspect, the present invention provides a prompt optimization method, including the following modules:

[0006] An initial Prompt input module, configured to receive the initial prompt input by the user;

[0007] A multi-round optimization module, configured to perform multi-round optimization on the input prompt according to a preset optimization template and an optimization model, and dynamically adjust the optimization strategy according to user feedback;

[0008] A feedback guidance module, configured to analyze and collect the feedback information of the user, and adjust the optimization strategy based on the feedback content;

[0009] An expected output guidance module, configured to guide the optimization process according to the expected output requirements provided by the user to ensure that the generated content meets the needs of the user;

[0010] A custom template and multiple optimization template support modules, which are used to support users in creating custom optimization templates and provide multiple preset optimization templates for users to choose from;

[0011] An optimization model selection and adjustment module, which supports users to select by themselves among multiple optimization models and also supports automatically adjusting the optimization module according to task requirements.

[0012] As a further improvement of the present invention, the multi-round optimization module analyzes user feedback through a feedback guidance module and adjusts the content of each round of optimization according to the user feedback until the final content that meets the user requirements is generated.

[0013] As a further improvement of the present invention, the feedback guidance module includes:

[0014] Feedback collection: Collect the feedback provided by the user after each round of optimization;

[0015] Feedback analysis: The system uses natural language processing technology to analyze the user feedback content and identify the key information therein;

[0016] Feedback guidance: Based on the key information obtained from the feedback analysis, the optimization strategy is intelligently adjusted to make the content generated in each round closer to the user's expectations.

[0017] As a further improvement of the present invention, the expected output guidance module guides the optimization strategy according to the expected output requirements input by the user; the expected output requirements include but are not limited to the length, tone, style, grammatical structure, use of specific keywords, etc. of the generated text.

[0018] As a further improvement of the present invention, the custom template and multiple optimization template support modules include:

[0019] Custom template: Users create and use custom optimization templates, defining the structure, requirements, and optimization focuses of the templates;

[0020] Preset optimization templates: The module provides multiple preset optimization templates for users to choose and use;

[0021] Template selection and switching: During multi-round optimization, users can switch different optimization templates at any time and adjust the optimization focuses according to actual needs.

[0022] The template in the present invention can be understood as a combination of a series of expected outputs. The custom template created by the user is not just a fixed-structure template in the traditional sense, but defines a set of optimization strategies according to the specific needs and feedback of the user.

[0023] As a further improvement of the present invention, the optimization model selection and adjustment module automatically selects a suitable optimization model according to the specific requirements of the task.

[0024] In a second aspect, the present invention provides a prompt optimization system for implementing the method described in any one of claims 1 - 6, characterized by comprising:

[0025] A front - end system: provides an interactive interface for users, allowing users to input an initial prompt, expected output requirements, user feedback information, allowing users to select optimization templates and optimization models, and providing optimization results for users;

[0026] A back - end system: responsible for processing the optimization process, calling optimization models and optimization templates, and applying optimization strategies;

[0027] An optimization model: the back - end system integrates multiple optimization models and supports multiple optimization strategies;

[0028] As a further improvement of the present invention, the system further comprises:

[0029] The system adopts streaming response technology to achieve real - time optimization feedback and generation.

[0030] In a third aspect, the present invention provides a computer device, comprising a memory, a processor, and a computer program stored on the memory, wherein the processor executes the computer program to implement the steps of the methods described in the first and second aspects.

[0031] In a fourth aspect, the present invention provides a computer - readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the methods described in the first and second aspects.

[0032] In a fifth aspect, the present invention provides a computer program product, and when the computer program is executed by a processor, it implements the steps of the methods described in the first and second aspects.

[0033] Compared with the prior art, the present invention realizes the intelligent iterative optimization of prompts through technical means such as multi - round optimization mechanisms, feedback - guiding mechanisms, expected output guiding, and custom template support, provides high - quality prompt optimization results, can also flexibly select and adjust optimization models according to actual needs, and meets complex optimization requirements in different scenarios, thus enhancing the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 It is a flowchart of a prompt optimization method disclosed by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0035] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the present invention will, in conjunction with the accompanying drawings, clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Among them, the sub-item numbers S1, S2... / P1, P2 in the embodiments described in the present invention do not limit the only implementation solution of the present invention; the various models, simulation environments, and software described in the present invention are not the only limiting means of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of the present invention.

[0036] In the present invention, a computer device / equipment / system refers to a related entity applied to a computer, such as hardware, a combination of hardware and software, software, or software in execution, etc. Specifically, for example, software includes, but is not limited to, a process running on a processor, a processor, an object, executable software, an execution thread, a program, and / or a computer. Also, an application program or a script program running on a server, and the server can both be software. One or more software can be in the process of execution and / or thread, and the software can be localized on one computer and / or distributed between two or more computers, and can be run by various computer-readable media.

[0037] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments can be combined with each other.

[0038] In a first aspect, the present invention provides an embodiment of a prompt optimization method, as Figure 1 shown, including the following modules:

[0039] S1: Initial prompt input module: The user inputs a preliminary prompt through the interface, and this prompt is the basis for generating content.

[0040] S2: Multi-round optimization module: Optimize the input prompt according to a preset optimization template and optimization model to generate an improved prompt. According to the user feedback and the result of the previous optimization, continue to optimize the generated prompt, adjust the text structure, word usage, etc., to generate a new optimized version.

[0041] S3: Feedback guidance module: The user views the result of the previous optimization and provides feedback, such as modifying grammar, adjusting the structure, adding or reducing information, etc. Intelligently adjust the optimization strategy according to the feedback and perform the next round of optimization until the final result that meets the user's needs is generated. Specifically, it includes:

[0042] Regarding the content of feedback: After each round of optimization, users can provide specific feedback. The feedback information can be suggestions for modifying the optimization results, format requirements, grammar adjustments, expression methods, etc.

[0043] Analysis of feedback content: Use deep learning models and natural language processing technologies to understand and analyze user feedback, and identify key information therein (such as parts that need to be optimized, expected expression methods, etc.). Based on this key information, intelligently adjust the optimization strategy.

[0044] Feedback-guided iteration: After each round of optimization, display the optimized results to the user and request feedback. Determine the optimization direction based on the feedback and gradually adjust the quality of the generated content. Through continuous iterative optimization processes, the finally generated content can highly meet the user's needs.

[0045] The expected output guidance module includes:

[0046] User requirement input:

[0047] The expected output content is an optional item. In cases where a macro requirement for the entire optimization goal is needed, after the user inputs a preliminary prompt, they can immediately input the expected output requirements. The expected output includes but is not limited to the length, style, tone, grammar structure, use of specific keywords, etc. of the generated text.

[0048] Guidance process:

[0049] According to the expected output information input by the user, adjust the optimization strategy to ensure that the content generated by the optimized prompt meets the user's expectations. For example, if the user requests the text to be more formal or have a certain specific style, then guide the generation of text that conforms to this style during the optimization process.

[0050] Intelligent optimization:

[0051] Combine the expected output with the optimization strategy and automatically adjust the generated content to meet the requirements of the expected output. The expected output guidance not only affects the style and tone of the generated content but also can control the structure and expression method of the generated content to a certain extent.

[0052] The custom template and multiple optimization template support module includes:

[0053] Custom template:

[0054] Support users to create and use custom optimization templates. Users can define the structure, requirements, and optimization focuses of the templates. For example, users can define templates to focus on grammar optimization, simplifying expressions, or enhancing the efficiency of information transmission, etc. Adapt to the needs of different users through flexible custom templates.

[0055] S52 Preset Optimization Templates:

[0056] In addition to the custom templates, multiple preset optimization templates are provided (e.g., CoT Thought Chain Optimization Template, CO-STAR Structure Optimization Template, OPENAI / Microsoft / Claude Optimization Template, etc.) for users to choose from. Users can select the most suitable optimization template according to different task requirements to adjust the prompt.

[0057] S53 Template Selection and Switching:

[0058] In multi-round optimization, users can switch different optimization templates at any time to adjust the focus of optimization according to actual needs. For example, users can select the "Syntax Optimization" template for the first optimization and the "Structure Optimization" template for the second optimization, thus flexibly controlling the optimization process.

[0059] S6 Optimization Model Selection and Adjustment Module, including:

[0060] S61 Selection of Optimization Model:

[0061] Multiple optimization models are provided, and users can select different optimization models according to their own needs to optimize the prompt. For example, users can choose to use a model with stronger generation ability (such as GPT-4) or a more lightweight model (such as qwen-turbo) for optimization, and different models form different optimization directions and strategies.

[0062] S62 Adaptive Adjustment of Optimization Model:

[0063] According to the specific requirements of the task, through an adaptive algorithm, intelligently judge and switch the optimization model to ensure that the best effect can be achieved in each round of optimization.

[0064] For example, some tasks may require more creative outputs, while some tasks may require higher accuracy and logic. Automatically evaluate and select the appropriate optimization model according to the specific nature of the task (such as creativity requirements, accuracy requirements, etc.).

[0065] In an embodiment of the present invention, in combination with task classification and task requirements, the most suitable model is automatically matched. The specific steps include:

[0066] S621: Task Classification: Use a multi-classification model of deep learning or a rule-based engine to determine which category the current task belongs to (such as text generation, sentiment analysis, grammar repair, etc.);

[0067] S622: Model Evaluation: Evaluate the performance of different models based on indicators such as the accuracy, recall rate, generation quality, and optimization efficiency of the models. For example, for generating creative text, GPT-4 with strong generation ability obtains higher evaluation results; in sentiment analysis, BERT obtains higher evaluation results because of its better performance in understanding sentiment and context; for relatively simple generation tasks (such as grammar repair), lightweight models (such as qwen-turbo) obtain higher evaluation results.

[0068] S623: Model Switching: Select the most suitable optimized model for the current user and task requirements through a collaborative filtering algorithm (such as model selection based on user preferences). At the same time, adopt the multi-task learning (MTL) algorithm to enable the adaptive algorithm to share information between different tasks and perform joint training. According to the common features of multiple tasks, intelligently judge and switch models.

[0069] In the second aspect, the present invention provides a prompt optimization system, including:

[0070] P1 Front-end System:

[0071] The front-end system provides an interactive interface for users, allowing users to input initial prompts, select optimization templates, feedback optimization results, etc. The front-end system and the back-end perform data interaction through the API.

[0072] P2 Back-end System:

[0073] The back-end system is responsible for processing the optimization process, calling the optimization model and applying the optimization strategy. The back-end system will adjust the optimization strategy according to the user's feedback and perform multiple rounds of optimization.

[0074] The back-end system integrates multiple optimization models and supports multiple optimization strategies. Each optimization model is trained to be able to effectively optimize according to the input prompt and user requirements.

[0075] P3 Streaming Response and Real-time Optimization:

[0076] The system adopts streaming response technology (such as WebSocket or SSE) to achieve real-time optimization feedback and generation. Users can immediately see the optimization results in each round of optimization and quickly provide feedback.

[0077] In the third aspect, the present invention provides a computer device embodiment, including a memory, a processor, and a computer program stored on the memory. The processor executes the computer program to implement the steps of the methods described in the first and second aspects.

[0078] Fourthly, an embodiment of a computer-readable storage medium is provided by the present invention, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the methods described in the first and second aspects are implemented.

[0079] Fifthly, an embodiment of a computer program product is provided by the present invention, and when the computer program is executed by a processor, the steps of the methods described in the first and second aspects are implemented.

[0080] Through technical means such as a multi-round optimization mechanism, a feedback guidance mechanism, an expected output guidance, and a custom template support, the present invention solves the problems of the lack of multi-round optimization, feedback guidance, and template flexibility in the prior art. Through an intelligent and automated optimization process, the system can provide high-quality natural language generation results according to user needs, thereby greatly improving the user experience and meeting the complex optimization requirements in different scenarios.

Claims

1. A prompt optimization method, characterized in that: Includes the following modules: The initial prompt input module is used to receive the initial prompt input by the user; The multi-round optimization module is used to perform multiple rounds of optimization on the input prompt according to the preset optimization template and optimization model, and dynamically adjust the optimization strategy according to user feedback; Feedback guidance module, used to analyze and collect user feedback information and adjust optimization strategies based on the feedback content; The expected output guidance module is used to guide the optimization process according to the expected output requirements provided by the user to ensure that the generated content meets the user's needs; Custom template and multiple optimization template support modules are used to support users to create custom optimization templates and provide multiple preset optimization templates for users to choose from; The optimization model selection and adjustment module supports users to choose from a variety of optimization models, and also supports automatic adjustment of optimization modules according to task requirements.

2. The method according to claim 1, characterized in that The multi-round optimization module analyzes user feedback through the feedback guidance module, and adjusts the content of each round of optimization according to the user feedback until the final content that meets the user's needs is generated.

3. The method according to claim 1, characterized in that The feedback guidance module comprises: Feedback collection: Collect feedback from users after each round of optimization; Feedback analysis: The system uses natural language processing technology to analyze user feedback content and identify key information; Feedback guidance: Based on the key information obtained from feedback analysis, the optimization strategy is intelligently adjusted to make each round of generated content closer to user expectations.

4. The method according to claim 1, characterized in that: The expected output guidance module guides the optimization strategy according to the expected output requirements input by the user; the expected output requirements include but are not limited to the length, tone, style, grammatical structure, use of specific keywords, etc. of the generated text.

5. The method according to claim 1, characterized in that: The custom templates and various optimized template support modules include: Custom templates: Users create and use custom optimization templates, defining the structure, requirements, and optimization focus of the templates; Preset optimization templates: The module provides a variety of preset optimization templates for users to choose from; Template selection and switching: Users can switch between different optimization templates at any time during multiple rounds of optimization and adjust the optimization focus according to actual needs.

6. The method according to claim 1, characterized in that The optimization model selection and adjustment module automatically selects a suitable optimization model according to the specific requirements of the task.

7. A prompt optimization system for implementing the method according to any one of claims 1 to 6, characterized in that: include: Front-end system: provides an interactive interface for users, allowing them to input the initial prompt, expected output requirements, user feedback information, allowing them to select optimization templates and optimization models, and providing users with optimization results, etc. Backend system: responsible for handling the optimization process, calling optimization models, optimization templates, and applying optimization strategies; Optimization model: The backend system integrates multiple optimization models and supports multiple optimization strategies.

8. The system according to claim 7, characterized in that Also includes: The system adopts streaming response technology to achieve real-time optimization feedback and generation.

9. A computer device embodiment, comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

11. A computer program product, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.