Input prompt optimization method, system and equipment based on large model and medium

Through the input prompt optimization method based on the large model, the original input prompt set is processed using the pre-trained model, which solves the problem of optimization in the prior art that it consumes time and effort and is difficult to accurately reflect user intentions, and achieves a more efficient and accurate input prompt optimization effect.

CN119762874APending Publication Date: 2025-04-04DIGITAL HEALTH CHINA TECHNOLOGIES CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411923656.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

When optimizing the input prompt (prompt), the prior art consumes time and effort and is difficult to ensure that the optimized prompt can accurately reflect user intentions. Especially in the development of large language models (LLMs), the accuracy and diversity of the prompt are increasingly demanding.

Method used

The input prompt optimization method based on the big model is adopted. By obtaining the original input prompt set of training preset large models and processing it based on the pretrained model, the optimized input prompt set is obtained. The pre-trained model includes recurrent neural networks and long and short memory neural network computing modules. These modules optimize input prompts to improve the accuracy and processing efficiency of model training.

Benefits of technology

By optimizing the original input prompt set, the accuracy and processing efficiency of subsequent large-model training are improved, so that the optimized prompts can more accurately reflect user intentions and have higher flexibility and adaptability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119762874A_ABST
    Figure CN119762874A_ABST
Patent Text Reader

Abstract

The invention discloses an input prompt optimization method, system, equipment and medium based on a large model, and relates to the technical field of large model optimization training, the method comprises the following steps: obtaining an original input prompt set for training a preset large model, and processing the original input prompt set based on a pre-training model to obtain an optimized original input prompt set; the preset large model is used for processing a to-be-recognized mechanical picture to obtain a mechanical type and identification information corresponding to the to-be-recognized mechanical picture. According to the method, the training accuracy of any subsequent large model can be improved by optimizing the original input prompt set, and in addition, the processing efficiency can also be improved by uniformly processing the original input prompt set through the pre-training model. Besides, the pre-training model can be targeted to optimize an output result meeting subsequent requirements, and the training mode or precision of the pre-training model can be flexibly adjusted based on the output result, so that the scheme is more flexible.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] In recent years, large language models (LLMs) have demonstrated powerful capabilities in the field of natural language processing. However, the performance of LLMs is highly sensitive to the input prompt, and even small changes can lead to significant output differences. Therefore, how to effectively optimize the prompt has become a key issue.

[0003] Currently, most of the existing prompt optimization methods rely on manual adjustments or rule-based optimization strategies. These methods are not only time-consuming and labor-intensive, but also difficult to ensure that the optimized prompt can accurately reflect the user's intention. In addition, with the continuous development of LLMs, the accuracy and diversity of prompts are increasingly required, and traditional optimization methods can no longer meet current needs. Summary of the invention

[0004] The technical problem to be solved by the present invention is to address the deficiencies of the prior art and specifically provide an input prompt optimization method, system, device and medium based on a large model, as follows:

[0005] 1) In the first aspect, the present invention provides an input prompt optimization method based on a large model, and the specific technical solution is as follows:

[0006] Acquire an original input prompt set for training a preset large model, and process the original input prompt set based on the pre-trained model to obtain an optimized original input prompt set;

[0007] The preset large model is used to process the machine picture to be identified to obtain the machine type and identification information corresponding to the machine picture to be identified.

[0008] The beneficial effects of the input prompt optimization method based on a large model provided by the present invention are as follows:

[0009] By optimizing the original input prompt set, the accuracy of subsequent training of any large model can be improved. In addition, this solution can also improve processing efficiency by uniformly processing the original input prompt set through a pre-trained model. In addition, the pre-trained model can be targeted to optimize the output results that meet subsequent needs. Based on this, the training method or accuracy of the pre-trained model can be flexibly adjusted, making this solution more flexible.

[0010] Based on the above solution, the present invention can also be improved as follows.

[0011] Furthermore, the pre-training model includes: a recurrent neural network computing module and a long short-term memory neural network computing module.

[0012] Furthermore, the specific calculation process of the recurrent neural network calculation module is:

[0013] x_t=f(W_h*h_t+W_x*x_(t-1)+b);

[0014] Among them, W_h is the weight matrix from hidden state to hidden state, W_x is the weight matrix from input to hidden state, b is the bias term, h_t represents the tth element of the input sequence, x_t is the hidden state at the current time, and x_(t-1) is the hidden state at the previous moment.

[0015] Furthermore, it also includes:

[0016] An opinion application for the optimized original input prompt set is received, and the optimized original input prompt set is re-optimized according to the opinion application.

[0017] 2) In the second aspect, the present invention also provides an input prompt optimization system based on a large model, and the specific technical solution is as follows:

[0018] The optimization module is used to: obtain an original input prompt set for training a preset large model, and process the original input prompt set based on the pre-trained model to obtain an optimized original input prompt set;

[0019] The preset large model is used to process the machine picture to be identified to obtain the machine type and identification information corresponding to the machine picture to be identified.

[0020] Based on the above solution, the present invention can also be improved as follows.

[0021] Furthermore, the pre-training model includes: a recurrent neural network computing module and a long short-term memory neural network computing module.

[0022] Furthermore, the specific calculation process of the recurrent neural network calculation module is:

[0023] x_t=f(W_h*h_t+W_x*x_(t-1)+b);

[0024] Among them, W_h is the weight matrix from hidden state to hidden state, W_x is the weight matrix from input to hidden state, b is the bias term, h_t represents the tth element of the input sequence, x_t is the hidden state at the current time, and x_(t-1) is the hidden state at the previous moment.

[0025] Furthermore, it also includes:

[0026] The optimization module is used to: receive an opinion application for the optimized original input prompt set, and re-optimize the optimized original input prompt set according to the opinion application.

[0027] 3) In a third aspect, the present invention further provides an electronic device, comprising a processor, wherein the processor is coupled to a memory, wherein at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor so that the electronic device implements any of the above methods.

[0028] 4) In a fourth aspect, the present invention further provides a computer-readable storage medium, wherein at least one computer program is stored in the computer-readable storage medium, and the at least one computer program is loaded and executed by a processor so that a computer implements any of the above methods.

[0029] It should be noted that the beneficial effects achieved by the technical solutions of the second to fourth aspects of the present invention and the corresponding possible implementation methods can be found in the above-mentioned technical effects of the first aspect and its corresponding possible implementation methods, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0031] Figure 1 A schematic diagram of a flow chart of an input prompt optimization method based on a large model according to an embodiment of the present invention;

[0032] Figure 2 The present invention is a structural framework diagram of an electronic device. DETAILED DESCRIPTION

[0033] To make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

[0034] like Figure 1 As shown, an input prompt optimization method based on a large model according to an embodiment of the present invention comprises the following steps:

[0035] S1, obtaining an original input prompt set for training a preset large model, and processing the original input prompt set based on the pre-trained model to obtain an optimized original input prompt set;

[0036] The preset large model is used to process the machine picture to be identified to obtain the machine type and identification information corresponding to the machine picture to be identified.

[0037] The beneficial effects of the input prompt optimization method based on a large model provided by the present invention are as follows:

[0038] By optimizing the original input prompt set, the accuracy of subsequent training of any large model can be improved. In addition, this solution can also improve processing efficiency by uniformly processing the original input prompt set through a pre-trained model. In addition, the pre-trained model can be targeted to optimize the output results that meet subsequent needs. Based on this, the training method or accuracy of the pre-trained model can be flexibly adjusted, making this solution more flexible.

[0039] The input prompt of a large model refers to the initial text input provided to the model to guide the model to generate a specific output. Prompts usually consist of instructions and input data. The instructions specify the task, and the input data provides the specific requirements for completing the task. Instructions should be clear and unambiguous, and provide detailed context, so that the model generation effect is better.

[0040] Components of a prompt:

[0041] Instructions: Specify the specific requirements of the task, use clear and detailed wording, and avoid ambiguity.

[0042] Input data: Provides specific information needed to complete the task, which can be the background of the event, examples, etc.

[0043] Prompt's function:

[0044] Prompt enhances the performance of the model by inputting specific instructions or questions into the model without adjusting the model structure itself. This technology has become popular with the development of large language models and has spawned an emerging field - prompt engineering.

[0045] The original input prompt set is at least two input prompts collected for the machine picture to be identified.

[0046] The mechanical image to be identified refers to an image taken by a collection device of any mechanical device or mechanical equipment.

[0047] The process of obtaining the training set of the pre-trained model is:

[0048] Determine whether each group of input prompts in the training set contains a separator, where the separator is an identifier for distinguishing the instruction part and the input data part, mark the input prompts containing the separator as the first group, and mark the input prompts not containing the separator as the second group. If the second group is an empty set, randomly select 30% of the first input prompts from the first group, remove the separators in the first input prompts, change the identifier to the second group, and randomly select 35% of the second input prompts from the first group again, replace the instruction part in the second input prompt, that is, extract keywords from the instruction part, and determine new complete instructions corresponding to the extracted keywords based on the extracted keywords in combination with a semantic analysis model, determine the similarity between the new complete instructions and the instruction part in the second input prompt, and when the similarity meets a preset condition, replace the instruction part in the second input prompt with the new complete instruction to generate a new second input prompt, and change the identifier of the new second input prompt to the second group. 35% of the third input prompts are randomly selected from the first group again, and the input data part in the third input prompt is divided into sentences, that is, the input data part includes the context data, so in the process of sentence division, paragraph division is given priority. If it only includes one paragraph, the sentence is further divided according to the period or semicolon, and the correlation between any two sentences is determined. At the same time, the correlation is sorted in order, and the two adjacent sentences whose correlation is lower than the preset correlation are pre-processed. The pre-processing process includes direct deletion, semantic replacement, etc. The correlation is made higher than the preset correlation through pre-processing, and the pre-processed input data is used as new input data to replace the input data in the third input prompt, a new third input prompt is generated, and the identifier of the new third input prompt is changed to the second group.

[0049] The first group and the second group obtained after the above processing are used as training sets for training the pre-training model.

[0050] The above processing can greatly improve the adaptability of the pre-trained model, that is, when any group of input prompts in the original input prompt set does not contain separators, or the semantic expression is not accurate, the pre-trained model can perform recognition processing.

[0051] It should be further explained that the optimization processing of input prompts by the pre-trained model includes the following aspects:

[0052] 1. Optimize keyword selection

[0053] When optimizing prompts, you first need to select keywords. According to the type of questions and scenarios that need to be answered, select keywords that can accurately reach user needs. This can improve the accuracy of answers and enhance user satisfaction.

[0054] 2. Grasp the number of keywords

[0055] Reasonable control of the number of keywords is also one of the key steps in prompt optimization. Too many keywords will lead to lengthy answers, which will make it difficult for users to quickly obtain information; while too few keywords may lead to thin answers that cannot fully respond to user needs. Therefore, it is necessary to determine the optimal range of keyword quantity through reasonable data analysis and market research.

[0056] 3. Answer questions in a variety of ways

[0057] When optimizing prompts, you can not only use text as the answer form, but also combine pictures, tables, lists, etc. to present the answer content. This can make the answer more vivid and easy for users to understand.

[0058] 4. Explore a wide range of knowledge points

[0059] For each question, you need to think and answer from as many angles as possible. By exploring a wide range of knowledge points, you can meet the needs of different users and improve the comprehensiveness and diversity of your answers.

[0060] 5. Structured answer content

[0061] When optimizing prompts, you need to ensure that the structure of the answer content is clear and the logic is rigorous. You can use methods such as itemized listing, step-by-step introduction, and case analysis to enable users to quickly capture the information they need.

[0062] The optimization results obtained through the pre-training model are used to train the preset large model, so that the preset large model can accurately give the type of mechanical equipment in the mechanical picture and the corresponding popular science information about the type of mechanical equipment according to the questions raised by the user about the input mechanical picture to be identified.

[0063] Furthermore, the pre-training model includes: a recurrent neural network computing module and a long short-term memory neural network computing module.

[0064] Furthermore, the specific calculation process of the recurrent neural network calculation module is:

[0065] x_t=f(W_h*h_t+W_x*x_(t-1)+b);

[0066] Among them, W_h is the weight matrix from hidden state to hidden state, W_x is the weight matrix from input to hidden state, b is the bias term, h_t represents the tth element of the input sequence, x_t is the hidden state at the current time, and x_(t-1) is the hidden state at the previous moment.

[0067] Furthermore, it also includes:

[0068] An opinion application for the optimized original input prompt set is received, and the optimized original input prompt set is re-optimized according to the opinion application.

[0069] Embodiment 1, data collection and processing module: This module is responsible for collecting the original prompt (input prompt) input by the user and related context information, and performing preprocessing to generate training samples for training and optimizing the model.

[0070] The preprocessing includes removing continuous spaces, emoticons and other special characters.

[0071] Model training and optimization module: This module uses the Transformer network architecture and the collected training samples to train the initial model to form a prompt generation model for specific user needs and task scenarios. The model can automatically generate an optimized prompt based on the input original prompt and context information.

[0072] The model structure of the model training and optimization module is:

[0073] 1) First calculate through the recurrent neural network:

[0074] The calculation formula is:

[0075] x_t=f(W_h*h_t-1+W_x*x_t+b)

[0076] Where: x_t is the hidden state of the current time step. W_h is the weight matrix from hidden state to hidden state. W_x is the weight matrix from input to hidden state. b is the bias term. f is the activation function tanh.

[0077] 2) Next, the long short-term memory neural network is used for calculation, and the calculation formula is:

[0078] i_t=σ(W_ii*x_t+W_hi*h_(t-1)+b_i)

[0079] f_t=σ(W_ff*x_t+W_hf*h_(t-1)+b_f)

[0080] o_t=σ(W_oo*x_t+W_ho*h_(t-1)+b_o)

[0081] g_t=tanh(W_gg*x_t+W_hg*h_(t-1)+b_g)

[0082] c_t=f_t*c_(t-1)+i_t*g_t

[0083] h_t=o_t*tanh(c_t)

[0084] Among them, σ represents the Sigmoid function, tanh represents the hyperbolic tangent function, W and b represent the weight and bias terms respectively, x_t represents the input at the current moment, h_(t-1) represents the hidden state at the previous moment, c_t and c_(t-1) represent the memory units at the current moment and the previous moment respectively.

[0085] Instant optimization and feedback module: This module uses the trained prompt generation model to instantly optimize the original prompt input by the user to improve the accuracy of the system and user satisfaction.

[0086] User interaction interface: This interface provides a friendly user interaction experience, allowing users to enter the original prompt, view the optimized prompt, and provide feedback. In addition, the interface also supports multiple languages ​​and multi-task scenarios to meet the needs of different users.

[0087] In the above embodiments, although the steps are numbered S1, S2, etc., these are only specific embodiments given by the present invention. Those skilled in the art may adjust the execution order of S1, S2, etc. according to actual conditions, which is also within the protection scope of the present invention. It can be understood that in some embodiments, some or all of the above embodiments may be included.

[0088] The present invention also provides an input prompt optimization system based on a large model, and the specific technical solution is as follows:

[0089] The optimization module is used to: obtain an original input prompt set for training a preset large model, and process the original input prompt set based on the pre-trained model to obtain an optimized original input prompt set;

[0090] The preset large model is used to process the machine picture to be identified to obtain the machine type and identification information corresponding to the machine picture to be identified.

[0091] Based on the above solution, the present invention can also be improved as follows.

[0092] Furthermore, the pre-training model includes: a recurrent neural network computing module and a long short-term memory neural network computing module.

[0093] Furthermore, the specific calculation process of the recurrent neural network calculation module is:

[0094] x_t=f(W_h*h_t+W_x*x_(t-1)+b);

[0095] Among them, W_h is the weight matrix from hidden state to hidden state, W_x is the weight matrix from input to hidden state, b is the bias term, h_t represents the tth element of the input sequence, x_t is the hidden state at the current time, and x_(t-1) is the hidden state at the previous moment.

[0096] Furthermore, it also includes:

[0097] The optimization module is used to: receive an opinion application for the optimized original input prompt set, and re-optimize the optimized original input prompt set according to the opinion application.

[0098] It should be noted that the beneficial effects of the input prompt optimization system based on a large model provided in the above embodiment are the same as the beneficial effects of the input prompt optimization method based on a large model, which will not be repeated here. In addition, when the system provided in the above embodiment realizes its functions, it only uses the division of the above functional modules as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the system is divided into different functional modules according to actual conditions to complete all or part of the functions described above. In addition, the system and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0099] like Figure 2 As shown, an electronic device 300 according to an embodiment of the present invention includes a processor 320, the processor 320 is coupled to a memory 310, and the memory 310 stores at least one computer program 330, and the at least one computer program 330 is loaded and executed by the processor 320, so that the electronic device 300 implements any of the above methods, specifically:

[0100] The electronic device 300 may have relatively large differences due to different configurations or performances, and may include one or more processors 320 (Central Processing Units, CPU) and one or more memories 310, wherein the one or more memories 310 store at least one computer program 330, and the at least one computer program 330 is loaded and executed by the one or more processors 320, so that the electronic device 300 implements a large model-based input prompt optimization method provided in the above embodiment. Of course, the electronic device 300 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output, and the electronic device 300 may also include other components for implementing device functions, which will not be described in detail here.

[0101] A computer-readable storage medium according to an embodiment of the present invention stores at least one computer program, and the at least one computer program is loaded and executed by a processor so that a computer implements any one of the above methods.

[0102] Optionally, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.

[0103] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device performs any of the above methods.

[0104] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects and represent the definition of a specific order or sequence. The order of use of similar objects can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than the order shown or described.

[0105] Those skilled in the art know that the present invention can be implemented as a system, method or computer program product. Therefore, the present disclosure can be specifically implemented in the following forms, namely: it can be complete hardware, it can be complete software (including firmware, resident software, microcode, etc.), or it can be a combination of hardware and software, which is generally referred to as "circuit", "module" or "system" herein. In addition, in some embodiments, the present invention can also be implemented in the form of a computer program product in one or more computer-readable media, and the computer-readable medium contains computer-readable program code.

[0106] Any combination of one or more computer-readable media may be used. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, device, or device.

[0107] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.

Claims

1. A large model-based input prompt optimization method, characterized in that: include: Acquire an original input prompt set for training a preset large model, and process the original input prompt set based on the pre-trained model to obtain an optimized original input prompt set; The preset large model is used to process the machine picture to be identified to obtain the machine type and identification information corresponding to the machine picture to be identified.

2. The input prompt optimization method based on a large model according to claim 1, characterized in that: The pre-training model includes: a recurrent neural network computing module and a long short-term memory neural network computing module.

3. The input prompt optimization method based on a large model according to claim 2, characterized in that: The specific calculation process of the recurrent neural network calculation module is: x_t=f(W_h*h_t+W_x*x_(t-1)+b); Among them, W_h is the weight matrix from hidden state to hidden state, W_x is the weight matrix from input to hidden state, b is the bias term, h_t represents the tth element of the input sequence, x_t is the hidden state at the current time, and x_(t-1) is the hidden state at the previous moment.

4. The input prompt optimization method based on a large model according to claim 1, characterized in that: Also includes: An opinion application for the optimized original input prompt set is received, and the optimized original input prompt set is re-optimized according to the opinion application.

5. An input prompt optimization system based on a large model, characterized in that: include: The optimization module is used to: obtain an original input prompt set for training a preset large model, and process the original input prompt set based on the pre-trained model to obtain an optimized original input prompt set; The preset large model is used to process the machine picture to be identified to obtain the machine type and identification information corresponding to the machine picture to be identified.

6. The input prompt optimization system based on a large model according to claim 5, characterized in that: The pre-training model includes: a recurrent neural network computing module and a long short-term memory neural network computing module.

7. The input prompt optimization system based on a large model according to claim 6, characterized in that: The specific calculation process of the recurrent neural network calculation module is: x_t=f(W_h*h_t+W_x*x_(t-1)+b); Among them, W_h is the weight matrix from hidden state to hidden state, W_x is the weight matrix from input to hidden state, b is the bias term, h_t represents the tth element of the input sequence, x_t is the hidden state at the current time, and x_(t-1) is the hidden state at the previous moment.

8. The input prompt optimization system based on a large model according to claim 5, characterized in that: Also includes: The optimization module is used to: receive an opinion application for the optimized original input prompt set, and re-optimize the optimized original input prompt set according to the opinion application.

9. An electronic device, characterized in that: The electronic device comprises a processor, the processor is coupled to a memory, at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor so that the electronic device implements the method according to any one of claims 1 to 4.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by a processor so that a computer implements the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Recognition method of preset category image and related device

    CN117194629A

  • Information prompt model processing method and device and electronic equipment

    CN117453334A

  • Image-text recognition large model training method and device, equipment and storage medium

    CN117593608A

  • Identification method and device and related equipment

    CN117994554A

  • Image classification model optimization method and device, electronic equipment and storage medium

    CN118397328A