Prompt word optimization method and device, readable storage medium and program product

By acquiring user characteristics and business types, and optimizing the prompt word framework and guidance information, the problems of insufficient flexibility and poor adaptability of prompt words in existing technologies are solved, generating highly adapted personalized prompt words and improving the professionalism and controllability of prompt words.

CN121809491APending Publication Date: 2026-04-07CHINA UNIONPAY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-06
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing prompt word optimization solutions lack flexibility, professionalism, and adaptability to application scenarios, resulting in generated prompt words that do not match user needs.

Method used

By acquiring user characteristics and business types, determining task and business types, replacing keywords using a pre-set keyword database, extracting keywords through grammatical analysis and attention weighting, and generating a highly adapted prompt word framework and guidance information to form personalized prompt words.

Benefits of technology

It improves the flexibility and professionalism of prompt word optimization, making the generated prompt words highly adaptable to specific application scenarios, and has controllability and engineering adjustability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121809491A_ABST
    Figure CN121809491A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a cue word optimization method and device, a readable storage medium and a program product. The method comprises the steps of obtaining a first prompt word input by a user and user characteristics; determining a task type and a service type based on the first prompt word and the user characteristics; executing the following processing on the first cue word: determining a cue word framework based on the task type; determining guidance information based on the user characteristics and the service type; performing content optimization processing on the first prompt word based on the user characteristics and the service type to obtain prompt information after optimization processing; the cue word framework is used for indicating the structure and the display style of the cue word; the guiding information is used for guiding model output; and generating a second cue word according to the cue word frame, the guide information and the cue information which are obtained through processing. The effect of improving the controllability of the cue word and the adaptability of the cue word to the user and the business scene can be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a prompt word optimization method, device, readable storage medium, and program product. Background Technology

[0002] In the development of artificial intelligence systems, prompts play a crucial role. Prompts guide the model to understand user intent, control output content and format, improve the accuracy of responses, and stimulate specific model capabilities. Therefore, high-quality prompts enable the model to improve the efficiency and effectiveness of user-model interaction. This is especially true in highly specialized fields where high-quality prompts are essential for achieving optimal model output.

[0003] Typically, suggestion words are obtained by optimizing user input. One related technology uses a general template or rule to optimize user input suggestion words, but this approach lacks flexibility and is difficult to adapt to complex scenarios.

[0004] Another related technology uses models to generate or rewrite prompts based on user input. However, because it relies on the model's language capabilities to optimize user input and generate prompts, it is inherently uncontrollable. Furthermore, it cannot be optimized for specific scenarios, resulting in prompts that are not professional in nature or well-suited to the application context.

[0005] In summary, the solutions for optimizing user input prompts in related technologies suffer from insufficient flexibility, poor controllability, lack of professionalism, and poor adaptability to application scenarios. Summary of the Invention

[0006] This application provides a prompt word optimization method, device, readable storage medium, and program product to improve the flexibility of the prompt word optimization process, enhance the professionalism of the optimized prompt words and their adaptability to business scenarios, and improve the controllability of the optimized prompt words.

[0007] In a first aspect, embodiments of this application provide a method for optimizing prompt words, including:

[0008] Obtain the first prompt word entered by the user and user characteristics;

[0009] The task type and service type are determined based on the first prompt word and the user characteristics;

[0010] The first prompt word is processed as follows: a prompt word framework is determined based on the task type; guidance information is determined based on the user characteristics and the business type; the first prompt word is optimized based on the user characteristics and the business type to obtain optimized prompt information; the prompt word framework is used to indicate the structure and display style of the prompt word; the guidance information is used to guide the model output.

[0011] A second prompt word is generated based on the prompt word framework, the guidance information, and the prompt information obtained from the processing.

[0012] In one possible implementation, optimizing the first prompt word based on the user characteristics and the service type to obtain optimized prompt information includes:

[0013] Extract the first keyword from the first prompt;

[0014] Based on the user characteristics and business type, a second keyword is obtained from a preset keyword database to replace the first keyword;

[0015] Replace the first keyword with the second keyword to obtain alternative input information;

[0016] The prompt information is determined based on the alternative input information and the reference input information database.

[0017] In one possible implementation, obtaining the prompt information based on the alternative input information and reference input information database includes:

[0018] The alternative input information is matched with the reference input information database to obtain multiple candidate reference input information;

[0019] The similarity between multiple candidate reference input information and the first prompt word is determined, and the main prompt information and extended prompt information are determined from the multiple candidate reference input information based on the similarity interval.

[0020] In one possible implementation, extracting the first keyword from the first prompt word includes:

[0021] Based on syntactic analysis and attention weight calculation, at least one primary keyword is extracted from the first prompt word.

[0022] In one possible implementation, obtaining a second keyword from a preset keyword database to replace the first keyword based on the user characteristics and business type includes:

[0023] Based on the user characteristics and the business type, at least one second keyword is retrieved from the preset keyword database to replace the first keyword;

[0024] And by replacing the first keyword with the second keyword to obtain alternative input information, including:

[0025] Construct a second keyword matrix based on at least one second keyword corresponding to each of the at least one first keyword;

[0026] The second keyword matrix is ​​used to replace the first keyword in the first prompt, resulting in multiple replacement input messages.

[0027] In one possible implementation, determining the similarity between multiple candidate reference input information and the first prompt word, and determining the main prompt information and extended prompt information from the multiple candidate reference input information based on the similarity interval, includes:

[0028] The similarity between the multiple candidate reference input information and the first prompt word is divided into multiple intervals, and each interval corresponds to at least one candidate reference input information.

[0029] Based on the rules for determining the main prompt information, the main prompt information is determined from the candidate reference input information corresponding to the multiple intervals;

[0030] Based on the rules for determining extended prompt information, extended prompt information is determined from the candidate reference input information corresponding to the multiple intervals.

[0031] In one possible implementation, determining the main prompt information from the candidate reference input information corresponding to the plurality of intervals according to the main prompt information determination rule includes:

[0032] From the candidate reference input information corresponding to the interval with the highest similarity, the candidate reference input information with the highest similarity to the first prompt word is determined as the main prompt information.

[0033] In one possible implementation, determining the extended prompt information from the candidate reference input information corresponding to the plurality of intervals according to the extended prompt information determination rule includes:

[0034] Among multiple intervals with non-highest similarity, at least one first interval is determined, and the candidate reference input information corresponding to the first interval is clustered to obtain multiple first clustering results. Each first clustering result includes at least one candidate reference input information.

[0035] At least one second clustering result is selected from multiple first clustering results based on the degree of aggregation, and the second clustering result includes at least one first candidate reference input information;

[0036] Based on the similarity with the first prompt word, determine the second candidate reference input information from at least one first candidate reference input information corresponding to the second clustering result;

[0037] Based on the second candidate reference input information corresponding to the at least one second clustering result, the extended prompt information is determined.

[0038] In one possible implementation, determining the task type and service type based on the first prompt word and the user characteristics includes:

[0039] The user features and the first prompt word are input into a pre-trained multi-task classification model, which then outputs the task type and the business type based on the user features and the first prompt word.

[0040] In one possible implementation, determining the cue word framework based on the task type includes:

[0041] The task type is matched with the framework database, and the prompt word framework is determined based on the matching result; wherein, the framework database stores multiple task types and their corresponding prompt word frameworks.

[0042] In one possible implementation, determining the guidance information based on the user characteristics and the service type includes:

[0043] The user characteristics and the business type are matched with the guidance information database, and the guidance information is determined based on the matching results. The guidance information database stores guidance information corresponding to different combinations of user characteristics and business types.

[0044] Secondly, embodiments of this application provide a prompt word optimization device, comprising:

[0045] The acquisition module is used to acquire user characteristics and the first prompt word entered by the user;

[0046] The determination module is used to determine the task type and business type based on the first prompt word and the user characteristics;

[0047] The processing module is configured to perform the following processing on the first prompt word: determine a prompt word framework based on the task type; determine guidance information based on the user characteristics and the business type; and perform content optimization processing on the first prompt word based on the user characteristics and the business type to obtain optimized prompt information; wherein, the prompt word framework is used to indicate the structure and display style of the prompt word, and the guidance information is used to guide the model output;

[0048] The generation module is used to generate a second prompt word based on the prompt word framework, the guidance information, and the prompt information obtained from the processing.

[0049] In one possible implementation, the processing module is specifically used for:

[0050] Extract the first keyword from the first prompt;

[0051] Based on the user characteristics and business type, a second keyword is obtained from a preset keyword database to replace the first keyword;

[0052] Replace the first keyword with the second keyword to obtain alternative input information;

[0053] The prompt information is determined based on the alternative input information and the reference input information database.

[0054] In one possible implementation, the processing module is specifically used to: match the alternative input information with a reference input information database to obtain multiple candidate reference input information;

[0055] The similarity between multiple candidate reference input information and the first prompt word is determined, and the main prompt information and extended prompt information are determined from the multiple candidate reference input information based on the similarity interval.

[0056] In one possible implementation, the processing module is specifically used to: extract at least one first keyword from the first prompt word based on syntactic analysis and attention weight calculation.

[0057] In one possible implementation, the processing module is specifically used for:

[0058] Based on the user characteristics and the business type, at least one second keyword is retrieved from the preset keyword database to replace the first keyword;

[0059] And by replacing the first keyword with the second keyword to obtain alternative input information, including:

[0060] Construct a second keyword matrix based on at least one second keyword corresponding to each of the at least one first keyword;

[0061] The second keyword matrix is ​​used to replace the first keyword in the first prompt, resulting in multiple replacement input messages.

[0062] In one possible implementation, the processing module is specifically used for:

[0063] The similarity between the multiple candidate reference input information and the first prompt word is divided into multiple intervals, and each interval corresponds to at least one candidate reference input information.

[0064] Based on the rules for determining the main prompt information, the main prompt information is determined from the candidate reference input information corresponding to the multiple intervals;

[0065] Based on the rules for determining extended prompt information, extended prompt information is determined from the candidate reference input information corresponding to the multiple intervals.

[0066] In one possible implementation, the processing module is specifically used for:

[0067] From the candidate reference input information corresponding to the interval with the highest similarity, the candidate reference input information with the highest similarity to the first prompt word is determined as the main prompt information.

[0068] In one possible implementation, the processing module is specifically used for:

[0069] Among multiple intervals with non-highest similarity, at least one first interval is determined, and the candidate reference input information corresponding to the first interval is clustered to obtain multiple first clustering results. Each first clustering result includes at least one candidate reference input information.

[0070] At least one second clustering result is selected from multiple first clustering results based on the degree of aggregation, and the second clustering result includes at least one first candidate reference input information;

[0071] Based on the similarity with the first prompt word, determine the second candidate reference input information from at least one first candidate reference input information corresponding to the second clustering result;

[0072] Based on the second candidate reference input information corresponding to the at least one second clustering result, the extended prompt information is determined.

[0073] In one possible implementation, the determining unit is specifically used to: input the user features and the first prompt word into a pre-trained multi-task classification model, and have the multi-task classification model output the task type and the business type based on the user features and the first prompt word.

[0074] In one possible implementation, the determining unit is specifically used for:

[0075] The task type is matched with the framework database, and the prompt word framework is determined based on the matching result; wherein, the framework database stores multiple task types and their corresponding prompt word frameworks.

[0076] In one possible implementation, the processing module is specifically used for:

[0077] The user characteristics and the business type are matched with the guidance information database, and the guidance information is determined based on the matching results. The guidance information database stores guidance information corresponding to different combinations of user characteristics and business types.

[0078] Thirdly, embodiments of this application provide a prompt word optimization device, including: a memory and a processor;

[0079] The memory stores computer-executed instructions;

[0080] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.

[0081] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.

[0082] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.

[0083] The prompt word optimization method, device, readable storage medium, and program product provided in this application introduce user characteristics as input parameters and combine them with the first prompt word for analysis. This results in the generated second prompt word no longer being a general, static template output, but rather a personalized prompt word highly adapted to specific user needs, improving the flexibility of prompt word optimization. Furthermore, by matching the prompt word framework to task type and matching guidance information with user characteristics and business type, the generated prompt words are highly adapted to specific application scenarios in terms of framework and guidance information. In addition, the prompt word optimization process is optimized to form a configurable, traceable, and optimizable prompt word generation process, possessing strong engineering controllability and debugging convenience. This solution solves the problems of insufficient flexibility, poor scenario adaptability, and uncontrollable output existing prompt word optimization solutions. Attached Figure Description

[0084] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0085] Figure 1 A schematic diagram illustrating the user-model interaction scenario provided in this application;

[0086] Figure 2 A flowchart illustrating the prompt word optimization method provided in this application;

[0087] Figure 3 A flowchart illustrating the process of optimizing the first prompt word to obtain prompt information, as provided in this application;

[0088] Figure 4A A diagram illustrating a cue word framework;

[0089] Figure 4B This is a diagram illustrating a second cue word;

[0090] Figure 5 A schematic diagram of the prompt word optimization device provided in this application;

[0091] Figure 6 A schematic diagram of the device for optimizing prompt words provided in this application.

[0092] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0093] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application.

[0094] Figure 1 This application provides a schematic diagram of the user-model interaction scenario, such as... Figure 1 As shown, user 101 can send commands to the electronic device 102 (e.g., as shown in the image). Figure 1 The computer inputs a first prompt word. Electronic device 102 can optimize the first prompt word using various optimization methods to generate a second prompt word, and then send the prompt word to model 103, which has natural language processing capabilities. Model 103 can perform relevant tasks based on the prompt word and feed the task execution results back to the computer for display.

[0095] Currently, one related technology for optimizing user input employs a static optimization method. This method primarily rewrites user input using pre-set templates or rules, such as matching general templates based on task type or enhancing specialization through keyword replacement. This approach relies on human experience or general rules, lacking flexibility and making it difficult to adapt to complex scenarios.

[0096] Another related technology employs a dynamic optimization method, utilizing models to generate or rewrite user input. For example, it extracts key elements from user input and generates candidate prompts, or combines similarity analysis to filter and optimize results. This technology, however, relies on the model's language capabilities to optimize user input and generate prompts, making it uncontrollable. Furthermore, this approach uses a general method, failing to achieve targeted optimization for specific scenarios, resulting in poor adaptability of the generated prompts to the application context.

[0097] Based on the above scenarios, it can be seen that existing technologies have technical problems such as the generation of prompts based on user input being out of touch with user needs and having poor professionalism and adaptability to business scenarios.

[0098] The prompt word optimization method provided in this application decomposes prompt word optimization into three layers: framework layer, guidance layer, and content layer, based on optimization strategies at the user information, business intent, and task intent layers. By using the technical means of collaboratively optimizing user input at these three layers, it solves to some extent the technical problems of mismatch between generated prompt words and user needs, poor controllability and flexibility, and poor professionalism and business scenario adaptability.

[0099] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0100] Figure 2 A flowchart illustrating the prompt word optimization method provided in this application is shown below. Figure 2 As shown, the method includes:

[0101] S201. Obtain user characteristics and the first prompt word entered by the user.

[0102] In this embodiment, the entity executing the prompt word optimization method can be an application client running on a terminal device, or an application server providing services to the application client.

[0103] The applications mentioned here can be, for example, various applications running on terminal devices that can invoke models to complete specified tasks. The models mentioned here can be various models with natural language processing capabilities, and are an important component of artificial intelligence systems.

[0104] Users can express their needs and intentions to the AI ​​system by inputting prompts. These prompts can then trigger the AI ​​system to perform functions and operations that match the user's needs and intentions. The functions and operations required by the AI ​​system vary across different scenarios. To ensure that the generated prompts match user needs and improve their professionalism and adaptability to business scenarios, it is necessary to accurately determine the user's needs.

[0105] Users can input initial prompts in the application client. These prompts can include natural language text such as phrases, sentences, or paragraphs, or data such as code and images. While user-inputted prompts typically reflect the user's most basic needs, they may be incomplete or unclear. Processing the prompts directly with the model may result in a mismatch between the input and the user's needs, exhibiting poor professionalism and adaptability to the business scenario. To ensure that the model's processing results match user needs and are highly adaptable to the business scenario, the initial prompts can be optimized.

[0106] User characteristics can be determined based on the acquired user information. In one example, user information can be encoded to obtain user characteristics.

[0107] The user information here includes, but is not limited to, user identifiers, user roles, and knowledge background. User identifiers and user roles can be obtained with the user's consent, and the user's knowledge background can be obtained with the user's consent or determined from the first prompt entered by the user.

[0108] User identifiers may include one or more of numbers, letters, and symbols to distinguish different users. Users here may include natural persons or computer systems.

[0109] User roles can be business roles, including but not limited to: ordinary users, internal organizational users, users within a specific industry, and users of product providers.

[0110] Knowledge background includes, for example, having a professional background in business related to the user's first suggestion word, or not having a professional background.

[0111] S202. Determine the task type and business type based on the first prompt word and user characteristics.

[0112] In one example, the language type used in the first prompt word can be detected. Then, feature information is extracted from the first prompt word according to the feature extraction rules corresponding to the language type. The feature information can include keywords, sentiment words, and syntactic structures, etc. The feature information can be matched using a preset task type rule base and business type rule base to obtain task type matching results and business type matching results.

[0113] The task type matching results can include the confidence level of the first prompt word belonging to each task type. The business type matching results can include the confidence level of the first prompt word belonging to each business type. Finally, the task type matching results and business type matching results are corrected based on user characteristics, for example, by adjusting the aforementioned confidence levels. The final task type is determined based on the confidence-adjusted task type matching results, and the final business type is determined based on the confidence-adjusted business type matching results.

[0114] The above task types include, but are not limited to, one of the following: summarizing, analyzing, and conversing. The above business types include, but are not limited to, one of the following first business types: consultation, complaints, assistance, and casual conversation. They may also include second business types based on product segmentation within the industry.

[0115] To illustrate, the task type rule base includes keywords such as "summary," "summarize," and "list key points" corresponding to the "summary" type. If the first prompt word consistently contains keywords such as "summary," "summarize," and "list key points," or if the input is a long text that requires extraction, then the task type of the first prompt word can be determined as "summary."

[0116] In some implementations, step S202 above includes the following steps:

[0117] User features and the first prompt word are input into a pre-trained multi-task classification model, which then outputs the task type and business type corresponding to the first prompt word.

[0118] The output of the above multi-task classification model can include language type, multiple task types, multiple secondary business types, and multiple secondary business types.

[0119] The model structure of the aforementioned multi-task classification model can include embedding layers, convolutional layers, pooling layers, and fully connected layers. The embedding layer encodes user features and the first prompt word, resulting in a vector containing both user features and the first prompt word. Convolutional layers can extract features using convolutional kernels of different sizes. Pooling layers perform max pooling on the features output by multiple convolutional kernels. Fully connected layers concatenate the pooled features and then connect them to the corresponding fully connected layers for each task, with one fully connected layer corresponding to one task.

[0120] Understandably, a multi-task classification model can be trained using training samples labeled with user features, language type, task type, first business type, and second business type to obtain the trained multi-task classification model.

[0121] In these implementations, determining the task type and business type of the first prompt word through a multi-task classification model can improve the efficiency of determining the task type and business type of the first prompt word.

[0122] S203: Perform the following processing on the first prompt word: determine the prompt word framework based on the task type; determine the guidance information based on user characteristics and business type; optimize the content of the first prompt word based on user characteristics and business type to obtain the optimized prompt information; wherein, the prompt word framework is used to indicate the structure and display style of the prompt word, and the guidance information is used to guide the model output.

[0123] The aforementioned execution entity can determine the prompt word frame that matches the task type from multiple candidate prompt word frames.

[0124] In some implementations, the aforementioned execution entity can match task types with a framework database and determine prompt word frames based on the matching results; wherein, the framework database stores multiple task types and their corresponding prompt word frames.

[0125] Based on the historical first prompt words input by multiple users, the historical second prompt words converted from these historical prompt words and inputted into the model, and the positive and negative feedback from users' historical responses to the model, a better prompt word framework for generating the second prompt words can be determined for different task types. The information of each task type and its corresponding better prompt word framework is then associated and stored in a framework database. It is understood that the historical first prompt words input by multiple users can include prompt words corresponding to different task types, and can also include historical first prompt words input by different users, such as ordinary users and expert users.

[0126] The prompt framework includes, but is not limited to, one or more of the following: prompt structure template, template variables, prompt rendering format description, and model configuration information.

[0127] The prompt structure template includes, but is not limited to, one or more of the following: chapter title, basic preset text, and content to be added. The content to be added (variable slot) can be represented by template variables. The chapter title, basic preset text, and content to be added in the prompt structure template can constitute the prompt structure. The prompt structure template may also include the prompt display style (also known as presentation style). The prompt display style uses visual elements to organize and present the content of the prompt, making its structure clear and highlighting key points.

[0128] The template variables include the filling specifications for multiple variable slots in the prompt word structure template. It defines the filling parameters (what to fill in each variable slot), the value mapping relationship (where the content comes from, for example, the model role comes from the guidance information, and the core content comes from the prompt information generated by the first prompt word), and the conversion method (how to process the content written into the slot).

[0129] Conversion methods can include functions that process the mapped values ​​before they are populated into the template. Conversion methods can include string manipulation, data type conversion, and format conversion. For example, if the date format obtained from the data source is "YYYY-MM-DD", but the template requires "MM / DD / YYYY", a date format conversion method can be used to perform the format conversion.

[0130] Different prompt word frames can be defined for multiple task types (such as summarizing, analyzing, and dialogue). Each prompt word frame template can have its own input parameters, mapping relationships, and conversion methods. In this way, when the task type of the user's first prompt word is recognized, the prompt word frame corresponding to that task type can be selected from multiple predefined prompt word templates.

[0131] The rendering information in the prompt word framework includes the rendering format, which may include, for example, a lightweight markup language format or a JSON format.

[0132] The prompt word framework can include preferred model configuration information (such as model version). That is, a more preferred model can be specified as the final invocation target based on the prompt word framework.

[0133] Please refer to Figure 4A , Figure 4A This is a diagram illustrating a cue word framework. For example... Figure 4A As shown, the chapter titles “Background Context|context”, “Role Positioning|Role”, and “Input Information|Input”, as well as the specific fields “Project Background” and “User Scenario” within the chapter title “Background Context|context”, and the variable slots corresponding to these two specific fields, along with the filling specifications for the variable slots: “Describe the overall background and importance of the project or task” and “Explain the specific usage scenario, user identity, and core pain points”. The specific field within the chapter title “Role Positioning|Role” is “You are a [ ], possessing the following professional profile, “Professional Field”, “Core Skills”, and “Code of Conduct”. The specific field “Main Input” within the chapter title “Input Information|Input” constitutes the structure of the prompt words. The titles and levels, emphasis and highlighting, lists and bullet points, special symbols and separators, and placeholders in the prompt word framework constitute the display style. For example Figure 4AUse "#" and "##" to create a hierarchy of prompts, distinguishing between chapters and fields within chapters. Use "** **" and bolding to emphasize key fields such as "Project Background," "User Scenarios," and "Professional Field" to make these key fields more prominent.

[0134] Lists and bullet points "-". Parallel points are presented in list format for improved readability. Each line in the list begins with the aforementioned "-". Special symbols "「" and "」" are used to enclose role definitions, serving as a visual focus. "|" is used to separate Chinese titles and English translations, such as "Background Context | Context". "、" is used to separate parallel items, such as "[Domain 1]、[Domain 2]". Placeholders "[ ]" are used to visually indicate "Users need to fill in specific content here".

[0135] In these implementations, different task types correspond to different prompt word frames, and the overall structure and presentation of the prompt words are adjusted according to different task types to obtain more accurate output results.

[0136] Guiding information may include, but is not limited to, descriptions of the model's role positioning, and format, style, and professional limitations of the output information. It may also include the way prompts (including main and extended prompts) are referenced. It is understood that the above guiding information can also be used as variables to populate the prompt template. The role positioning description, output information format, style, and professional limitations within the guiding information can be entered as independent parameters into the corresponding positions within the prompt framework.

[0137] In some implementations, user characteristics and service types are matched with a guidance information database, and guidance information is determined based on the matching results. The guidance information database stores guidance information corresponding to different combinations of user characteristics and service types.

[0138] In these implementations, optimal guidance information corresponding to different combinations of user characteristics and business types can be determined in advance based on guidance information from multiple historical second prompt words corresponding to different combinations of user characteristics and business types input into the model, as well as positive and negative feedback from users to the model responses corresponding to the multiple historical second prompt words. Different combinations of user characteristics and business types, along with their corresponding optimal guidance information, are stored in a guidance information database. Furthermore, the optimal guidance information for each combination can also be designed by a pre-defined user.

[0139] In these implementations, by matching guidance information from the guidance information database that matches user characteristics and business types, the output guidance of prompts is optimized according to user characteristics and business intent, and the control information output meets the user's business needs and user requirements.

[0140] The above optimization of the first prompt word based on user characteristics and business type yields the optimized prompt information, including:

[0141] Specifically, the first prompt can be optimized by using a language model to call a knowledge base related to the business type to supplement the context, replacing keywords in the first prompt with professional terms, and changing the expression style of the first prompt based on user characteristics.

[0142] S204: Generate a second prompt word based on the processed prompt word framework, guidance information, and prompt information.

[0143] Guidance and prompt information can be populated into the corresponding variable slots of the prompt word framework. Specifically, the model role positioning description, output information format, style, and professional limitations from the guidance information can be populated into their respective variable slots. The prompt information is then populated into its corresponding variable slot. This results in a prompt word framework, guidance information, and core content all optimized. Optionally, the second prompt word may include model configuration information from the prompt word framework, used to invoke the target model corresponding to the model configuration information.

[0144] In this embodiment, by introducing user characteristics as input parameters and combining them with the first prompt word for analysis, the generated second prompt word is no longer a general, static template output, but a personalized prompt word highly adapted to specific user needs, improving the flexibility of prompt word optimization. Furthermore, through a dual determination mechanism of task type and business type, it is ensured that the generated prompt words are highly adapted to specific application scenarios in terms of structure and guidance information. In addition, the prompt word optimization process is optimized to form a configurable, traceable, and optimizable prompt word generation process, possessing strong engineering controllability and debugging convenience. This solution solves the problems of insufficient flexibility, poor scenario adaptability, and uncontrollable output existing prompt word optimization solutions.

[0145] Please refer to Figure 3 , Figure 3 This is a flowchart illustrating the process of optimizing the first prompt word to obtain the prompt information, as provided in this application. Figure 3 As shown, it includes the following steps.

[0146] S301: Extract the first keyword from the first prompt word.

[0147] The aforementioned executing entity can extract the first keyword from the first prompt word according to the text content processing method. It is understood that the number of first keywords extracted from the first prompt word can be more than one.

[0148] In some embodiments, step S301 includes:

[0149] Based on syntactic analysis and attention weight calculation, at least one primary keyword is extracted from the primary prompt word.

[0150] Specifically, the first step is to perform syntactic analysis on the user input. Syntactic analysis can include part-of-speech tagging and syntactic analysis. Part-of-speech tagging can label the parts of speech of multiple words (such as nouns, verbs, adjectives, etc.), while syntactic analysis can reveal the dependency relationships between words. For example, dependency parsing can identify subjects, objects, and modifiers. The results of syntactic analysis help identify core noun phrases in the sentence, which can serve as primary keywords.

[0151] Next, attention weights are calculated. Attention weights represent the degree to which a word contributes to the overall semantics of the sentence. Specifically, attention scores for each word are obtained by calculating self-attention or contextual attention. Attention scores reflect the importance of a word in its context. Higher attention scores generally indicate that the word is more crucial.

[0152] First keywords can be extracted by combining syntactic analysis and attention weighting. For example, syntactic analysis can be used to identify candidate keywords, such as nouns and noun phrases, from the first prompt words. Then, attention weighting can be used to rank these candidate keywords, and at least one first keyword can be selected from the ranking results.

[0153] In one example, at least a few primary keywords can be organized into a keyword sequence (W1, W2, ..., Wn) in a preset order, where W1, W2, ..., Wn are the primary keywords, and n is an integer greater than or equal to 3. In another example, the preset order can be the order of the corresponding attention scores from largest to smallest.

[0154] In these implementations, at least one primary keyword is extracted from the first prompt word through syntactic analysis and attention weight calculation, ensuring that the extracted primary keyword sequence is both grammatically correct and semantically prominent. This helps improve the accuracy of subsequent secondary keyword search and replacement, thereby avoiding multiple interactions with the model based on the same requirement and improving the efficiency of model interaction.

[0155] S302: Based on user characteristics and business type, retrieve the second keyword from the preset keyword database to replace the first keyword.

[0156] The preset keyword library here can be a pre-created knowledge base. In one example, the knowledge base mentioned above could be a professional knowledge base that matches the business type. This knowledge base can store information on multiple professional keywords. The information for each professional keyword can include, but is not limited to: a complete professional description, multilingual comparisons, and abbreviations.

[0157] To illustrate, the first keyword, user characteristics, business type and the first keyword can be used as query conditions to query from a preset key database, thereby obtaining at least one second keyword that matches the user characteristics, business type and the first keyword.

[0158] Understandably, when there are multiple primary keywords, the corresponding secondary keywords can be determined one by one from the preset keyword database.

[0159] By retrieving a second keyword from a pre-defined keyword database to replace the first keyword, the meaning of the second keyword will be clearly defined and professionally explained according to the actual application scenario, avoiding ambiguity and vagueness. This helps improve the professionalism and rigor of the generated second suggestion words, meeting the business requirements of specific scenarios.

[0160] S303: Replace the first keyword with the second keyword to obtain alternative input information.

[0161] In some embodiments, step S302 includes:

[0162] Based on user characteristics and business type, at least one second keyword is retrieved from a preset keyword database to replace the first keyword; and step S303 above includes the following sub-steps:

[0163] First, construct a second keyword matrix based on at least one second keyword corresponding to each of the at least one first keyword.

[0164] Secondly, the first keyword in the first prompt is replaced with the second keyword in the second keyword matrix to obtain multiple replacement input information.

[0165] In these implementations, at least one first keyword can be arranged in a preset order to obtain a first keyword sequence.

[0166] For each first keyword, user characteristics, business type, and the first keyword can be used to query from a preset keyword database to obtain at least one second keyword to replace the first keyword.

[0167] For each first keyword, at least one second keyword corresponding to that first keyword can be arranged in a preset order to obtain a vector of second keywords corresponding to that first keyword. Each element in the vector of second keywords can be a second keyword.

[0168] It is understandable that, in order to generate a second keyword matrix by aligning the second keyword vectors of multiple first keywords, one or more second keyword vectors corresponding to the first keywords may include padding elements. For example, a padding element could be "0".

[0169] Each second keyword in the second keyword matrix can be used to replace at least one first keyword in the first prompt word to obtain the alternative input information matrix.

[0170] Schematic, the first keyword sequence can be an n-dimensional vector (W1, W2, ..., Wn); the second keyword matrix can be an m×n dimensional matrix [(W11, W12, ..., W1m), ...,(Wn1, Wn2, ..., Wnm)]. Here, n is an integer greater than or equal to 3, and m is an integer greater than or equal to 1. The substitution input information matrix can be a k×j dimensional matrix [(I11, I12, ...,I1j), ..., (Ik1, Ik2, ..., Ikj)]. K can be an integer greater than 2; j can be an integer greater than or equal to 1.

[0171] In one example, each element in the alternative input information matrix can be an alternative input. Therefore, the alternative input information matrix contains multiple alternative inputs.

[0172] S304: Based on the alternative input information and reference input information database, a prompt message is obtained.

[0173] The alternative input information obtained in step S303 can be input into the reference input information database, at least one candidate reference input information can be obtained from the candidate reference input information database, and at least one candidate reference input information can be used as prompt information.

[0174] In some embodiments, step S304 above includes the following steps:

[0175] First, the alternative input information is matched with the reference input information database to obtain multiple candidate reference input information.

[0176] Secondly, the similarity between multiple candidate reference input information and the first prompt word is determined, and the main prompt information and extended prompt information are determined from multiple candidate reference input information based on the similarity interval.

[0177] The reference input database can include multiple verified, complete, and semantically clear candidate reference inputs. These candidate reference inputs can be designed by developers or entered by relevant technical personnel.

[0178] It can calculate the similarity between the alternative input information and multiple candidate reference input information in the reference input information database, and obtain multiple candidate reference input information from the reference input information database according to a preset similarity threshold. For example, multiple candidate reference input information with a similarity greater than the preset similarity threshold are used as candidate reference input information here.

[0179] It is understandable that when there are multiple alternative input information, each alternative input information can be matched with the reference input information database to obtain multiple candidate reference input information corresponding to each alternative input information.

[0180] After obtaining multiple candidate reference input information, the similarity between each candidate reference input information and the first prompt word can be calculated.

[0181] The similarity between multiple candidate reference information and the first prompt word can be divided into intervals, and the main prompt information and extended prompt information can be determined from multiple candidate reference input information based on the similarity interval division results.

[0182] In some implementations, determining the similarity between multiple candidate reference input information and the first prompt word, and determining the main prompt information and extended prompt information from the multiple candidate reference input information based on the similarity interval, includes the following sub-steps:

[0183] First, the similarity between multiple candidate reference input information and the first prompt word is divided into multiple intervals, with each interval corresponding to at least one candidate reference input information.

[0184] In one example, multiple similarity thresholds can be pre-set for dividing similarity into intervals. These thresholds may include, for example, a first similarity threshold, a second similarity threshold, and a third similarity threshold. The first similarity threshold is greater than the second similarity threshold, and the second similarity threshold is greater than the third similarity threshold. Multiple candidate reference inputs can be divided into three intervals based on their similarity to the first prompt word, according to [first similarity threshold, 1], [second similarity threshold, first similarity threshold], and [third similarity threshold, second similarity threshold]. It is understood that methods for dividing the similarity between multiple candidate reference inputs and the first prompt word into multiple intervals based on other interval division methods are also within the scope of this application.

[0185] Each interval can correspond to at least one candidate reference input information.

[0186] Second, based on the rules for determining the main prompt information, the main prompt information is determined from the candidate reference input information corresponding to multiple intervals.

[0187] In one example, the candidate reference input information with the highest similarity to the first prompt word can be selected from the candidate reference input information corresponding to the interval with the highest similarity to determine the main prompt information.

[0188] For example, among the three intervals mentioned above, the interval [first similarity threshold, 1] is the interval with the highest similarity. From one or more candidate reference inputs corresponding to this interval, the candidate reference input with the highest similarity to the first prompt word can be used as the main prompt.

[0189] If there is no candidate reference input information in the interval with the highest similarity, the main prompt information can be generated by rewriting the prompt information based on the first prompt word and the second prompt word with the highest similarity.

[0190] Third, based on the rules for determining extended prompt information, extended prompt information is determined from the candidate reference input information corresponding to multiple intervals.

[0191] In one example, the extended hint information can be determined based on the following steps:

[0192] First, at least one first interval is determined among multiple intervals with non-highest similarity. The candidate reference input information corresponding to the first interval is clustered to obtain multiple first clustering results. Each first clustering result includes at least one candidate reference input information.

[0193] In one example, the similarity of each interval can be ranked from highest to lowest to determine whether it includes candidate reference input information. The first interval containing candidate reference input information is designated as the first interval. Multiple candidate reference input information in the first interval are then clustered according to business intent to obtain multiple first clustering results.

[0194] In one example, H intervals containing corresponding candidate reference input information can be selected from multiple intervals with non-highest similarity, arranged in descending order of similarity. These intervals can be used as the first interval. H can be an integer such as 2 or 3. The multiple candidate reference input information corresponding to these H intervals can be clustered according to business intent to obtain multiple first clustering results.

[0195] Secondly, at least one second clustering result is selected from multiple first clustering results based on the degree of aggregation. The second clustering result includes at least one first candidate reference input information.

[0196] Clustering degree characterizes the similarity among multiple candidate reference inputs included in a clustering result. The greater the similarity among multiple candidate reference inputs in a clustering result, the higher the clustering degree.

[0197] In one example, at least one second clustering result can be selected from multiple first clustering results based on a preset aggregation degree threshold. For example, the first clustering result with an aggregation degree greater than the preset aggregation degree threshold can be used as the second clustering result.

[0198] Then, based on the similarity with the first prompt word, the second candidate reference input information is determined from at least one first candidate reference input information corresponding to the second clustering result.

[0199] For each second clustering result, the candidate reference input information corresponding to that second clustering result is used as the first candidate reference input information. Alternatively, the first candidate reference input information with the highest similarity to the first prompt word in the second clustering result can be selected as the second candidate reference input information.

[0200] Finally, based on the second candidate reference input information corresponding to at least one second clustering result, the extended prompt information is determined.

[0201] The second candidate reference input information corresponding to each second clustering result can be used as extended prompt information.

[0202] In these implementations, the user's original prompts can be optimized into more effective main prompts and additional extended prompts for the model to process.

[0203] The prompt information determination process provided in this application embodiment, through this solution, obtains second keywords from a preset database based on user characteristics and business type, transforming vague and colloquial user intent into precise and standardized professional queries, which helps improve the quality of prompt words. Obtaining replacement words based on user characteristics and business type can generate dynamic and personalized alternative input information, improving the high relevance of the generated second prompt words to the user and business scenario. By extracting keywords from the user-input first prompt word and combining them with user characteristics and business type, matching suitable replacement words from a preset keyword database generates semantically equivalent but more suitable alternative input information that meets user needs and business type. Based on this alternative information and a reference input information database, a structurally complete and context-rich prompt word is constructed, enhancing the personalized expression and professional adaptability of the prompt words, which helps improve the model's accuracy in understanding user intent, while ensuring the comprehensibility of the output content.

[0204] The following example illustrates this application scenario. In this scenario, user A inputs the first prompt, "How do I open a merchant account?". Based on the prompt optimization method described in this application, user A's user characteristics can be obtained first, for example, by obtaining user A's user characteristics based on user A's authorization. These user characteristics include hierarchical coding: C1 (User Location): Natural Person; C2 (Business Role): Industry User; C3 (Knowledge Background): Possessing a professional background.

[0205] User intent analysis: The first prompt word is input into a multi-task classification model, which outputs the task type and business type. The feature codes for the task type corresponding to the first prompt word are: T1: Chinese; T2: Summary. The feature codes for the business type corresponding to the first prompt word are: B1: Inquiry; B2: Merchant onboarding.

[0206] Based on the task type (T1: Chinese; T2: Summary), the following prompt word framework was determined from multiple prompt word frameworks:

[0207]

[0208] Based on User A's user characteristics (C1 (User Location): Natural Person; C2 (Business Role): Industry User; C3 (Knowledge Background): With Professional Background) and business type (corresponding feature codes B1 (First Business Type): Consultation; B2 (Second Business Type): Merchant Onboarding), the guidance information corresponding to the user characteristics and business type determined from the guidance information database is as follows:

[0209] {

[0210] Role: "A senior and authoritative XX business and technology expert"

[0211] "Ability": "Not only possessing a thorough understanding of all relevant provisions, but also being able to quickly, accurately, and comprehensively retrieve and apply those provisions, providing detailed, clear, and easy-to-understand professional answers."

[0212] "Skill":[

[0213] {

[0214] "Skills" category: "Question and Answer Retrieval:"

[0215] },

[0216] {

[0217] "Skills": "XXXXX:"

[0218] }

[0219] ],

[0220] Output: [

[0221] {

[0222] "Role": "The user is a collaborator of XX, and the response should maintain a professional style."

[0223] },

[0224] {

[0225] "Role":"..."

[0226] },

[0227] ],

[0228] }

[0229] The first keywords extracted during the content optimization process of the first prompt word include: "merchant", "activate", and "how".

[0230] Based on user characteristics, business type, and primary keyword, multiple secondary keywords are determined from the keyword database to replace "merchant". Multiple secondary keywords are also determined to replace "activate". Multiple secondary keywords are further determined to replace "how". Secondary keywords include complete professional descriptions, multilingual comparisons, abbreviations, etc. Illustratively, one secondary keyword W11 for replacing "merchant": Industry-specific Merchant, is shown below:

[0231] {

[0232] Keywords: "Industry Merchants"

[0233] "Professional Description": "Industry merchants refer to business entities engaged in specific industry operations, including both offline physical stores and online service platforms."

[0234] "Standard terminology": "Industry-specific Merchant"

[0235] Abbreviation: "ind_mchnt"

[0236] }

[0237] Construct a second keyword matrix based on the multiple second keywords corresponding to the three primary keywords "merchant," "activate," and "how." Assuming the primary keyword with the most secondary keywords corresponds to four secondary keywords, a 3×4 second keyword matrix can be constructed. Each row corresponds to four secondary keywords for a primary keyword. It's understandable that for primary keywords with fewer than four secondary keywords, "0" can be used to pad them to four.

[0238] Each valid second keyword in the aforementioned 3×4 dimensional second keyword matrix can be used to replace the corresponding first keyword, resulting in a replacement input information. This leads to the replacement input information matrix.

[0239] An example of a substitute input information matrix is ​​shown below: [(I11, I12, ..., I1m),...,(I31, I32, ...,I3m)]. m is an integer greater than or equal to 2.

[0240] For illustration, the alternative input information I11 is: How do I register an Industry-specific Merchant?

[0241] Multiple candidate reference inputs can be retrieved from the reference input information database for each alternative input, forming a set of candidate reference inputs. Illustratively, the set of candidate reference inputs is shown below:

[0242] {

[0243] "Candidate Reference Input Information 1": "How to register an Industry-Specific Merchant in XX?"

[0244] "Candidate Reference Input Information 2": "How do I register a Channel Merchant in XX?"

[0245]

[0246] }

[0247] Calculate the similarity between each candidate reference input and the first prompt word. Then, based on a first preset similarity threshold (e.g., 0.9), a second similarity threshold (e.g., 0.4), and a third similarity threshold (e.g., 0), determine three similarity intervals. Determine at least one candidate reference input corresponding to each similarity interval. For example, the similarity intervals and their corresponding candidate reference inputs are as follows:

[0248] {

[0249] Interval 1: {

[0250] "Candidate Reference Input Information 1": 0.903,

[0251] "Candidate Reference Input Information 2432": 0.703,

[0252]

[0253] },

[0254] Interval 2: {

[0255] "Candidate Reference Input Information 252": 0.413,

[0256]

[0257] },

[0258] Interval 3: {

[0259] "Candidate Reference Input Information 422": 0.021,

[0260]

[0261] }

[0262] }

[0263] The candidate reference input information 1 in interval 1, "How to register an industry-specific merchant in XX?", can be used as the main prompt information.

[0264] Clustering is performed on multiple candidate reference input information in intervals 2 and 3 to obtain multiple first clustering results. At least one second clustering result is determined from these first clustering results based on the degree of aggregation. Each second clustering result includes at least one first candidate reference input information. Second candidate reference input information is determined from the at least one first candidate reference input information corresponding to the second clustering result based on the similarity to the first prompt word. Extended prompt information is determined based on the second candidate reference input information corresponding to each of the at least one second clustering result. The final determined extended prompt information is as follows: "How can I quickly complete the online registration of an Industry-specific Merchant on the XX Merchant Onboarding Platform?" "What is the difference between an Industry-specific Merchant and a Channel Merchant?" "What are the rights and obligations of an Industry-specific Merchant in XX?"

[0265] Figure 4B This is a diagram illustrating a second suggestion word. This suggestion word is the second suggestion word corresponding to the first suggestion word entered by user A. For example... Figure 4B As shown. Figure 4B The sections "Role," "Skills," "Answer Method," and "User Question," along with their corresponding variable slots, constitute the prompt word framework for this task. The role information generated during the above process is filled into the variable slot corresponding to "Role" in the prompt word framework. Skill information from the guidance information is filled into the variable slot corresponding to "Skills" in the prompt word framework; answer method information is filled into the variable slot corresponding to "Answer Method." The main prompt and extended prompt information from the prompt information are filled into the main information input variable slot and extended information input variable slot in the "User Question" section, respectively.

[0266] Figure 5 A schematic diagram of the prompt word optimization device provided in this application is shown below. Figure 5As shown, the prompt word optimization device 50 provided in this embodiment includes:

[0267] The acquisition module 501 is used to acquire user characteristics and the first prompt word input by the user;

[0268] The determination module 502 is used to determine the task type and business type based on the first prompt word and user characteristics;

[0269] The processing module 503 is used to perform the following processing on the first prompt word: determine the prompt word framework based on the task type; determine the guidance information based on user characteristics and business type; and perform content optimization processing on the first prompt word based on user characteristics and business type to obtain the optimized prompt information; wherein, the prompt word framework is used to indicate the structure and display style of the prompt word, and the guidance information is used to guide the model output;

[0270] The generation module 503 is used to generate a second prompt word based on the processed prompt word framework, guidance information, and prompt information.

[0271] In one possible implementation, the processing module 503 is specifically used for:

[0272] Extract the first keyword from the first prompt words;

[0273] Based on user characteristics and business type, retrieve a second keyword from a preset keyword database to replace the first keyword;

[0274] Replace the first keyword with the second keyword to obtain alternative input information;

[0275] The prompt message is determined based on alternative input information and a reference input information database.

[0276] In one possible implementation, the processing module 503 is specifically used to: match the alternative input information with the reference input information database to obtain multiple candidate reference input information;

[0277] Determine the similarity between multiple candidate reference input information and the first prompt word, and determine the main prompt information and extended prompt information from multiple candidate reference input information based on the similarity interval.

[0278] In one possible implementation, the processing module 503 is specifically used to: extract at least one first keyword from the first prompt word based on syntactic analysis and attention weight calculation.

[0279] In one possible implementation, the processing module 503 is specifically used for:

[0280] Based on user characteristics and business type, at least one second keyword is retrieved from the preset keyword database to replace the first keyword;

[0281] And by replacing the first keyword with the second keyword, alternative input information is obtained, including:

[0282] Construct a second keyword matrix based on at least one second keyword corresponding to each of the at least one first keyword;

[0283] The first keyword in the first prompt is replaced using the second keyword matrix, resulting in multiple replacement input messages.

[0284] In one possible implementation, the processing module 503 is specifically used for:

[0285] The similarity between multiple candidate reference input information and the first prompt word is divided into multiple intervals, and each interval corresponds to at least one candidate reference input information.

[0286] Based on the rules for determining the main prompt information, the main prompt information is determined from the candidate reference input information corresponding to multiple intervals;

[0287] Based on the rules for determining extended hints, extended hints are determined from candidate reference input information corresponding to multiple intervals.

[0288] In one possible implementation, the processing module 503 is specifically used for:

[0289] From the candidate reference input information corresponding to the interval with the highest similarity, the candidate reference input information with the highest similarity to the first prompt word is determined as the main prompt information.

[0290] In one possible implementation, the processing module 503 is specifically used for:

[0291] Among multiple intervals with non-highest similarity, at least one first interval is determined. The candidate reference input information corresponding to the first interval is clustered to obtain multiple first clustering results. Each first clustering result includes at least one candidate reference input information.

[0292] At least one second clustering result is selected from multiple first clustering results based on the degree of aggregation. The second clustering result includes at least one first candidate reference input information.

[0293] Based on the similarity with the first prompt word, the second candidate reference input information is determined from at least one first candidate reference input information corresponding to the second clustering result;

[0294] Based on the second candidate reference input information corresponding to at least one second clustering result, the extended prompt information is determined.

[0295] In one possible implementation, the determining unit 502 is specifically used to: input user features and the first prompt word into a pre-trained multi-task classification model, and have the multi-task classification model output the task type and business type based on the user features and the first prompt word.

[0296] In one possible implementation, the determining unit 502 is specifically used for:

[0297] The task type is matched with the framework database, and the prompt word framework is determined based on the matching results; the framework database stores multiple task types and their corresponding prompt word frameworks.

[0298] In one possible implementation, the processing module 503 is specifically used for:

[0299] User characteristics and business types are matched with the guidance information database. Guidance information is determined based on the matching results. The guidance information database stores guidance information corresponding to different combinations of user characteristics and business types.

[0300] The prompt word optimization device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.

[0301] Figure 6 A schematic diagram of the prompt word optimization device provided in this application. (For example...) Figure 6 As shown, the prompt word device 60 provided in this embodiment includes at least one processor 601 and a memory 602. Optionally, the device 60 further includes a communication component 603. The processor 601, memory 602, and communication component 603 are connected via a bus 604.

[0302] In a specific implementation, at least one processor 601 executes computer execution instructions stored in memory 602, causing at least one processor 601 to perform the above-described method.

[0303] The specific implementation process of processor 601 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.

[0304] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.

[0305] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.

[0306] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0307] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0308] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.

[0309] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.

[0310] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.

[0311] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0312] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0313] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0314] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0315] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0316] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

Claims

1. A method for optimizing prompt words, characterized in that, include: Obtain user characteristics and the first prompt word entered by the user; The task type and service type are determined based on the first prompt word and the user characteristics; The first prompt word is processed as follows: a prompt word framework is determined based on the task type; guidance information is determined based on the user characteristics and the business type; the first prompt word is optimized based on the user characteristics and the business type to obtain optimized prompt information; wherein, the prompt word framework is used to indicate the structure and display style of the prompt word, and the guidance information is used to guide the model output; A second prompt word is generated based on the prompt word framework, the guidance information, and the prompt information obtained from the processing.

2. The method according to claim 1, characterized in that, The step of optimizing the first prompt word based on the user characteristics and the service type to obtain optimized prompt information includes: Extract the first keyword from the first prompt; Based on the user characteristics and business type, a second keyword is obtained from a preset keyword database to replace the first keyword; Replace the first keyword with the second keyword to obtain alternative input information; The prompt information is determined based on the alternative input information and the reference input information database.

3. The method according to claim 2, characterized in that, The prompt information obtained based on the alternative input information and reference input information database includes: The alternative input information is matched with the reference input information database to obtain multiple candidate reference input information; The similarity between multiple candidate reference input information and the first prompt word is determined, and the main prompt information and extended prompt information are determined from the multiple candidate reference input information based on the similarity interval.

4. The method according to claim 2, characterized in that, Extract the first keyword from the first prompt, including: Based on syntactic analysis and attention weight calculation, at least one primary keyword is extracted from the first prompt word.

5. The method according to claim 4, characterized in that, The step of obtaining a second keyword from a preset keyword database to replace the first keyword based on the user characteristics and business type includes: Based on the user characteristics and the business type, at least one second keyword is retrieved from the preset keyword database to replace the first keyword; And by replacing the first keyword with the second keyword to obtain alternative input information, including: Construct a second keyword matrix based on at least one second keyword corresponding to each of the at least one first keyword; The second keyword matrix is ​​used to replace the first keyword in the first prompt, resulting in multiple replacement input messages.

6. The method according to claim 3, characterized in that, The step of determining the similarity between multiple candidate reference input information and the first prompt word, and determining the main prompt information and extended prompt information from the multiple candidate reference input information based on the similarity interval, includes: The similarity between the multiple candidate reference input information and the first prompt word is divided into multiple intervals, and each interval corresponds to at least one candidate reference input information. Based on the rules for determining the main prompt information, the main prompt information is determined from the candidate reference input information corresponding to the multiple intervals; Based on the rules for determining extended prompt information, extended prompt information is determined from the candidate reference input information corresponding to the multiple intervals.

7. The method according to claim 6, characterized in that, The step of determining the main prompt information from the candidate reference input information corresponding to the multiple intervals according to the main prompt information determination rule includes: From the candidate reference input information corresponding to the interval with the highest similarity, the candidate reference input information with the highest similarity to the first prompt word is determined as the main prompt information.

8. The method according to claim 6, characterized in that, The step of determining extended prompt information from the candidate reference input information corresponding to the multiple intervals based on the extended prompt information determination rule includes: Among multiple intervals with non-highest similarity, at least one first interval is determined, and the candidate reference input information corresponding to the first interval is clustered to obtain multiple first clustering results. Each first clustering result includes at least one candidate reference input information. At least one second clustering result is selected from multiple first clustering results based on the degree of aggregation, and the second clustering result includes at least one first candidate reference input information; Based on the similarity with the first prompt word, determine the second candidate reference input information from at least one first candidate reference input information corresponding to the second clustering result; Based on the second candidate reference input information corresponding to the at least one second clustering result, the extended prompt information is determined.

9. The method according to any one of claims 1-8, characterized in that, The step of determining the task type and service type based on the first prompt word and the user characteristics includes: The user features and the first prompt word are input into a pre-trained multi-task classification model, which then outputs the task type and the business type based on the user features and the first prompt word.

10. The method according to any one of claims 1-8, characterized in that, The process of determining the prompt word framework based on the task type includes: The task type is matched with the framework database, and the prompt word framework is determined based on the matching result; wherein, the framework database stores multiple task types and their corresponding prompt word frameworks.

11. The method according to any one of claims 1-8, characterized in that, The process of determining guidance information based on the user characteristics and the service type includes: The user characteristics and the business type are matched with the guidance information database, and the guidance information is determined based on the matching results. The guidance information database stores guidance information corresponding to different combinations of user characteristics and business types.

12. A prompt word optimization device, characterized in that, include: The acquisition module is used to acquire user characteristics and the first prompt word entered by the user; The determination module is used to determine the task type and business type based on the first prompt word and the user characteristics; The processing module is configured to perform the following processing on the first prompt word: determine a prompt word framework based on the task type; determine guidance information based on the user characteristics and the business type; and perform content optimization processing on the first prompt word based on the user characteristics and the business type to obtain optimized prompt information; wherein, the prompt word framework is used to indicate the structure and display style of the prompt word, and the guidance information is used to guide the model output; The generation module is used to generate a second prompt word based on the prompt word framework, the guidance information, and the prompt information obtained from the processing.

13. A prompt word optimization device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-11.

14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-11.

15. A computer program product comprising a computer program that, when executed by a processor, implements the method of any one of claims 1-11.