Large model prompt word construction method and device, equipment, medium and program product

By extracting business scenario and intent category identifiers from user requests, and dynamically matching and constructing large model prompt words, the problem of insufficient flexibility and multi-business processing capabilities in existing technologies is solved, and efficient and flexible prompt word generation and response are achieved.

CN121809442BActive Publication Date: 2026-07-10CHINA MOBILEHANGZHOUINFORMATION TECH CO LTD +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA MOBILEHANGZHOUINFORMATION TECH CO LTD
Filing Date
2026-03-09
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

Existing technologies rely on static template libraries, resulting in low flexibility and a lack of unified processing capabilities for multiple business needs, leading to low resource utilization and high system complexity.

Method used

By extracting business scenario identifiers and intent category identifiers from user requests, dynamically matching target prompt word templates, and constructing large model prompt words in combination with query content, semantic feature extraction and intent recognition are performed using query vector databases and instance databases, and response result verification and optimization are carried out using a dual intent entity converter model and intelligent agent mechanism.

Benefits of technology

It enables the dynamic construction of large-scale prompt words adapted to real-time user intent and business scenarios, improving the system's flexibility and scalability, reducing system complexity, and improving resource utilization and response quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121809442B_ABST
    Figure CN121809442B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of artificial intelligence, and provides a large model prompt word construction method, device, equipment, medium and program product, the method comprises the following steps: extracting query content and a business scene identifier from a user request; based on the business scene identifier, a target prompt word template is matched from a prompt word template database; and based on an intention category identifier associated with the query content and the target prompt word template, a large model prompt word is constructed. The large model prompt word construction method provided by the application can match a target prompt word template from a prompt word template database based on a business scene identifier, and can construct a large model prompt word in combination with an intention category identifier associated with query content, can dynamically construct a large model prompt word that is adapted according to real-time user intention and a business scene, has high flexibility, and can realize unified dynamic construction of prompt words for multiple businesses through scene-based adaptation and accurate intention guidance, thereby improving the expansibility and adaptability of business processing.
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 method, apparatus, device, medium, and program product for constructing large model prompt words. Background Technology

[0002] Currently, large models are widely used in various tasks such as natural language processing, text content generation, question answering, and translation. To enable large models to generate output that meets user needs, users typically guide the model to generate the desired content by designing prompts.

[0003] In existing technologies, a prompt word template library containing multiple task types is constructed, with each template designed for a specific task. These templates are typically written by experts based on task requirements and cover a variety of common scenarios.

[0004] However, existing technologies rely on predefined template libraries to generate prompts. These templates are designed for specific tasks and are suitable for single or limited task scenarios. When faced with complex or dynamically changing task requirements, static templates are difficult to adapt flexibly, potentially leading to generated prompts that do not match the actual needs. Existing solutions typically design prompts for single tasks or single business scenarios, lacking the ability to uniformly handle multiple business requirements. In multi-business scenarios, the system needs to generate a separate prompt for each business, resulting in low resource utilization, high system complexity, and increased difficulty in integrating multiple businesses. Summary of the Invention

[0005] This application provides a method, apparatus, device, medium, and program product for constructing large model prompt words, in order to solve the problems of low flexibility caused by relying on static template libraries in the prior art, and limited task scalability caused by the lack of unified processing capability for multiple business needs.

[0006] Firstly, this application provides a method for constructing large model prompt words, including:

[0007] Extract query content and business scenario identifiers from user requests;

[0008] Based on the business scenario identifier, the target prompt word template is matched from the prompt word template database;

[0009] Based on the intent category identifier associated with the query content and the target prompt word template, a large model prompt word is constructed.

[0010] In one embodiment, after retrieving the query content but before matching the target suggestion term template, the method further includes:

[0011] Semantic features are extracted from the query content to obtain a query vector;

[0012] Alternatively, the query content can be broken down into multiple sub-tasks; semantic features can be extracted from each sub-task to obtain multiple query vectors.

[0013] In one embodiment, the intent category identifier associated with the query content is determined in the following way:

[0014] The similarity between the query vector and the preset query vector in the query vector database is calculated to obtain at least one target query vector that is most similar.

[0015] At least one of the intent category identifiers corresponding to the target query vector is determined as the intent category identifier associated with the query content.

[0016] In one embodiment, constructing a large model of prompts based on the intent category identifier associated with the query content and the target prompt word template includes:

[0017] Based on the intent category identifier associated with the query vector, target instance data is matched from the instance database;

[0018] Based on the target instance data, the parameters to be filled in the target prompt word template are filled in to construct a large model prompt word.

[0019] In one embodiment, the large model prompt word construction method further includes:

[0020] Semantic features are extracted from the query content to obtain a query vector;

[0021] The query vector is input into the dual intent entity converter model to obtain the intent recognition result and entity recognition result output by the dual intent entity converter model;

[0022] If the confidence level of the intent recognition result is greater than or equal to the preset confidence level, then the pre-trained model is invoked to generate the first response result of the user request based on the intent recognition result and the entity recognition result;

[0023] If the confidence level of the intent recognition result is less than the preset confidence level, then a large model prompt word is constructed through the first agent; the large model is invoked, and a second response result for the user request is generated based on the large model prompt word.

[0024] In one embodiment, after generating the second response result of the user request, the process includes:

[0025] The second response result is verified by a second intelligent agent;

[0026] If the verification result does not meet the expected effect, the second agent will feed the verification result back to the first agent, and the step of constructing a large model prompt word through the first agent will be executed iteratively until the verification result of the second response result meets the expected effect.

[0027] Secondly, this application also provides a large model prompt word construction device, including:

[0028] The extraction module is used to extract query content and business scenario identifiers from user requests;

[0029] The prompt word template matching module is used to match the target prompt word template from the prompt word template database based on the business scenario identifier;

[0030] A prompt word module is used to construct large model prompt words based on the intent category identifier associated with the query content and the target prompt word template.

[0031] Thirdly, this application provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps of any of the above-described large model prompt word construction methods.

[0032] Fourthly, this application also provides a non-transitory computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of any of the above-described large model prompt word construction methods.

[0033] Fifthly, this application also provides a computer program product, the computer program product comprising a computer program that can be stored on a non-transitory computer-readable storage medium, and the computer program, when executed by the processor, implements the steps of any of the above-described large model prompt word construction methods.

[0034] The large model prompt word construction method, device, equipment, medium, and program products provided in this application, based on business scenario identifiers, match target prompt word templates from a prompt word template database, and construct large model prompt words by combining intent category identifiers associated with query content. This allows for the dynamic construction of adapted large model prompt words based on real-time user intent and business scenarios, exhibiting high flexibility. Furthermore, through scenario-based adaptation and precise intent guidance, it enables unified and dynamic construction of prompt words across multiple services, improving the scalability and adaptability of business processing, reducing system complexity, and increasing resource utilization. Attached Figure Description

[0035] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0036] Figure 1 This is one of the flowcharts illustrating the large model prompt word construction method provided in this application.

[0037] Figure 2 This is the second flowchart illustrating the method for constructing large model prompt words provided in this application.

[0038] Figure 3 This is a schematic diagram of the structure of the query vector database provided in this application.

[0039] Figure 4 This is a schematic diagram of the structure of the instance database provided in this application.

[0040] Figure 5 This is a schematic diagram of the structure of the prompt word template database provided in this application.

[0041] Figure 6 This is a schematic diagram of the structure of the APPID and IntentID mapping database provided in this application.

[0042] Figure 7 This is a schematic diagram of the structure of the large model prompt word construction device provided in this application.

[0043] Figure 8 This is a schematic diagram of the structure of the electronic device provided in this application. Detailed Implementation

[0044] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0045] The terms "first," "second," etc., used in this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein.

[0046] The following is combined Figures 1-8This application describes the method, apparatus, device, medium, and program product for constructing large model prompt words.

[0047] The large model prompt word construction method provided in this application embodiment can be implemented based on a large model prompt word construction device. Therefore, this application embodiment uses a large model prompt word construction device as the execution subject to describe the large model prompt word construction method.

[0048] Combination Figure 1 and Figure 2 , Figure 1 This is one of the flowcharts illustrating the large model prompt word construction method provided in this application. Figure 2 This is the second flowchart illustrating the method for constructing large model prompt words provided in this application.

[0049] like Figure 1 As shown, the large model prompt word construction method includes the following steps:

[0050] Step 101: Extract the query content and business scenario identifier from the user request.

[0051] Specifically, users send query requests through the system's interactive interface or Application Programming Interface (API). These requests include a business scenario identifier (denoted as APPID in this application) and a specific natural language request. Upon receiving the user request, the system parses it, accurately extracting the query content and APPID. The query content reflects the information the user wants to obtain or the problem they want to solve, while the APPID defines the user's specific business environment, enabling more precise matching of processing logic and resources for subsequent queries. The system can quickly identify the user's application scenario based on the APPID, such as home robots, security, or customer service, and adjust subsequent processing paths accordingly. Communication can be conducted using an API gateway or message queue, and the business logic corresponding to the APPID can be quickly determined through a business rule engine.

[0052] Step 102: Based on the business scenario identifier, match the target prompt word template from the prompt word template database;

[0053] Step 103: Construct large model prompts based on the intent category identifier associated with the query content and the target prompt word template.

[0054] Specifically, the system has a pre-built prompt word template database, which stores prompt word templates categorized by different APPIDs. The prompt word templates are pre-designed according to the characteristics and requirements of the corresponding business scenarios, and can accurately guide the large model to generate response content that meets the user's expectations.

[0055] After extracting the APPID from the user request, the APPID is used as an index value for a quick search in the prompt word template database. Since the database is stored according to APPID categories, the system can quickly locate the category area that matches the current request APPID, and then search and match the most suitable target prompt word template within that area, realizing automatic prompt word template matching based on business scenario identifiers.

[0056] Similarly, the system has a pre-built query vector database, which stores preset query vectors according to different intent category identifiers (marked as IntentID in this application). The preset query vectors are generated in advance based on the characteristics and semantic information of the corresponding intent category, and can accurately express the user's query intent direction.

[0057] After extracting the query content from the user's request, the query content is converted into a high-dimensional semantic vector representation, resulting in a query vector. Based on the query vector, a preset query vector that is semantically closest to the query vector is matched in the query vector database. The intent category identifier corresponding to this query vector in the query vector database is the intent category of the current user's request.

[0058] Furthermore, based on the intent category identifier matched by the query vector and the target prompt word template matched by the APPID, a large-scale model prompt word is dynamically constructed. This large-scale model prompt word includes prompt word template information closely related to the business scenario, as well as incorporating the user's true query intent, thereby guiding the large-scale model to generate more accurate responses that meet user needs. In practical applications, this method of dynamically constructing large-scale model prompt words can significantly improve the quality and efficiency of large-scale model responses.

[0059] For example, in an intelligent customer service scenario, when a user asks a question about product usage, the system can quickly match product-related prompt word templates based on the APPID (such as the identifier of a customer service APP) in the user's request. At the same time, it can further adjust and optimize the prompt words based on the intent category of the user's query (such as problem consultation, troubleshooting, etc.), ultimately guiding the big model to give an accurate and useful response.

[0060] Furthermore, this construction method offers excellent scalability and flexibility. As business scenarios evolve and user needs become increasingly diverse, the system can easily update and expand the prompt word template database and query vector database to adapt to new business scenarios and user requirements. Simultaneously, since the prompt word templates and query vector databases are pre-designed, no complex calculations or processing are required in practical applications, thus ensuring the system's real-time performance and stability.

[0061] The large model prompt word construction method provided in this application, based on business scenario identifiers, matches target prompt word templates from a prompt word template database and constructs large model prompt words by combining intent category identifiers associated with query content. It can dynamically construct adapted large model prompt words according to real-time user intent and business scenario, which has high flexibility. At the same time, through scenario-based adaptation and precise intent guidance, it can realize unified dynamic construction of prompt words for multiple businesses, improve the scalability and adaptability of business processing, reduce system complexity, and improve resource utilization.

[0062] Regarding the above-mentioned method for constructing large model prompt words, this application proposes the following embodiments to describe the specific implementation of the method for constructing large model prompt words.

[0063] Before executing the large model prompt word construction process, it is necessary to pre-build the prompt word template database and query vector database mentioned above. Based on this, instance data can also be pre-built to store the instantiation processing flow for different business scenarios. Combined with... Figures 3-5 , Figure 3 This is a schematic diagram of the structure of the query vector database provided in this application. Figure 4 This is a schematic diagram of the structure of the example database provided in this application. Figure 5 This is a schematic diagram of the structure of the prompt word template database provided in this application.

[0064] like Figure 3 As shown, the query vector database is used to store vectorized representations of user-input queries. It converts diverse natural language queries from different business scenarios into vector form for subsequent matching and retrieval operations.

[0065] like Figure 4 As shown, the instance database stores the instantiation processing flow for different business scenarios and shares the same data retrieval key, such as IntentID, with the query vector database. Its purpose is to find the scenario question-answering instance that is closest in semantics to the user's current query, providing a reference for the large model to understand user intent.

[0066] The instance database is built by collecting and organizing a large number of real-world business cases, and then classifying and labeling these cases. The instance database needs to be associated with the query vector database, for example, by establishing a relationship through IntentID, to ensure that instances can efficiently match the user's input query content.

[0067] like Figure 5As shown, the prompt word template database uses a series of general prompt word templates designed manually or predefined by experts, and is categorized and stored according to different business (APPID) requirements and scenarios. The prompt word template database needs to be continuously expanded and updated to cover more business scenarios and requirements. In addition, prompt word templates customized for different business scenarios can be further expanded into a universal template system with universal applicability.

[0068] During the preparation phase, the three types of databases mentioned above were constructed to support the unified and dynamic creation of prompt words across multiple services. Based on actual business scenario data, a query vector database, an instance database, and a prompt word template database corresponding to different types of business applications were built. These databases support visual interface display and flexible self-configuration, allowing operations and maintenance personnel to update them in real time to address failed use cases or new requirements in business scenarios.

[0069] In addition, a database mapping APPID to IntentID can be built. Figure 6 This is a schematic diagram of the structure of the APPID and IntentID mapping database provided in this application. For example... Figure 6 As shown, this mapping database describes the mapping logic between APPID and IntentID. Based on this, the index of the prompt word template database can also use IntentID, allowing for the construction of corresponding prompt word templates for each intent category, thus enabling more granular design of prompt words for large models. Utilizing the mapping logic between APPID and IntentID, relationships between user queries and prompt word templates, scenario application instance data, etc., can be quickly established.

[0070] Based on the database built in the above preparation stage, and according to the user's current query input, a large model of prompt words with appropriate thresholds is quickly constructed to stimulate the service capabilities of the large model in different business scenarios. The specific content is as follows.

[0071] In one embodiment, after the query content is extracted but before the target suggestion word template is matched, the method further includes:

[0072] Semantic features are extracted from the query content to obtain a query vector;

[0073] Alternatively, the query content can be broken down into multiple sub-tasks; semantic features can be extracted from each sub-task to obtain multiple query vectors.

[0074] Specifically, the query content undergoes text preprocessing, such as word segmentation and stop word filtering. Then, semantic features are extracted from the preprocessed query content, converting it into an embedding vector representation, typically in a high-dimensional space. Optionally, pre-trained models such as RoBERTa or GPT are used to generate the semantic representation, resulting in the query vector.

[0075] If the current query task requires more complex processing, such as if the user request contains complex intents or multiple intents, requiring multi-step reasoning or complex text generation, then the query content is analyzed, and then the task is broken down and parsed into actionable sub-tasks, forming a series of sub-tasks or intents that are then redefined and reorganized in terms of language description.

[0076] For example, if a user enters: "Please generate a financial report for my company for year xxxx and perform a risk analysis," the system uses natural language understanding technology to extract two key sub-tasks: "generate a financial report" and "perform a risk analysis."

[0077] Semantic features are extracted for each subtask and converted into embedding vector representations to obtain the query vector for each subtask. Optionally, pre-trained models such as RoBERTa or GPT are used to generate semantic representations to obtain the query vectors.

[0078] This application embodiment obtains query vectors by directly extracting semantic features from the query content, or by first decomposing complex queries into multiple sub-tasks and then extracting semantic features from each sub-task to obtain multiple query vectors. This enables in-depth analysis and accurate representation of user intent, and optimizes the efficiency and adaptability of prompt word template matching.

[0079] As seen in the above embodiments, the query content is converted into an embedding vector representation, which may be the query vector for a single task or query vectors corresponding to multiple tasks. The subsequent database retrieval based on the query vector, followed by the dynamic generation of large model prompts, is a process executed separately for each task, with corresponding feedback results output for each task. Therefore, the following embodiments describe the large model prompt construction process for a single task as an example.

[0080] In one embodiment, the intent category identifier associated with the query content is determined in the following way:

[0081] The similarity between the query vector and the preset query vector in the query vector database is calculated to obtain at least one target query vector that is most similar.

[0082] At least one of the intent category identifiers corresponding to the target query vector is determined as the intent category identifier associated with the query content.

[0083] Specifically, the similarity between the query vector and all preset query vectors under each IntentID index in the query vector database is calculated to obtain the similarity value between the query vector and each preset query vector. This allows you to find the top K standard questions that are most similar to the user's request, where K is a positive integer greater than or equal to 1.

[0084] For each IntentID, the preset query vector with the highest similarity value is selected as the candidate query vector. Based on the similarity value, the top K target query vectors are determined from the candidate query vectors. Then, the IntentID corresponding to each target query vector is used as the intent category identifier associated with the query content.

[0085] Alternatively, for each IntentID, select the one with the highest similarity value as the score for that IntentID, and based on the similarity value, extract the top K IntentIDs as intent category identifiers associated with the query content.

[0086] When performing similarity calculations, it is important to use appropriate similarity measurement algorithms, such as cosine similarity for semantic matching, for vectors. and The cosine similarity formula is:

[0087]

[0088] in, Represents the dimension of vector A or vector B; The cosine value of the angle between vectors A and B is represented by ; similarity represents the cosine similarity.

[0089] This application embodiment calculates the similarity between the query vector and the vectors in the preset query vector database and matches the most similar target query vector to determine the intent category identifier associated with the query content. The matching mechanism based on vector similarity has strong generalization ability and can handle query content with similar semantics but different expressions, reducing misjudgment of intent caused by differences in expression methods. It provides a reliable intent classification basis for subsequent accurate invocation of corresponding business logic, thereby optimizing the overall interaction efficiency and user experience.

[0090] In one embodiment, constructing a large model of prompts based on the intent category identifier associated with the query content and the target prompt word template includes:

[0091] Based on the intent category identifier associated with the query vector, target instance data is matched from the instance database;

[0092] Based on the target instance data, the parameters to be filled in the target prompt word template are filled in to construct a large model prompt word.

[0093] Specifically, based on the top K IntentIDs matched by the query vector database, the instance database is indexed. Since the query vector database and the instance database establish an index relationship through a unified IntentID, the top K scenario application instance data that are closest to the user's current query are obtained, such as question-and-answer instances, reference documents, conditional descriptions, etc. These matched target instance data can provide a reference for the semantic understanding and generation of large models.

[0094] Furthermore, the retrieved target instance data is fused with the preset target prompt word template, and the fusion method can be to use structured parameters to fill in the data in real time.

[0095] When pre-building the prompt word template, specific user parameters can be reserved in the template based on placeholders or variables. These parameters are then used to populate the prompt words in real time during generation. During the population process, the semantic consistency and fluency of the prompt words also need to be considered. This requires appropriate processing and transformation of the target instance data to ensure its semantic alignment with the target prompt word template.

[0096] Alternatively, a Neuro-Linguistic Programming (NLP) template filling technique can be employed, such as a regular expression-based text template generator, or the Jinja2 template engine in Python for assembling dynamic prompt words.

[0097] By adopting a strategy of "prompt word template structure + scenario instance", information such as question and answer data, document data, and restrictive description data that are suitable for various business scenarios and the user's current query are populated in real time according to the format and structure set by the target prompt word template. This dynamically assembles large model prompt words that are suitable for the current user query, thereby stimulating the business scenario adaptability of the large model.

[0098] Furthermore, after dynamically assembling the prompts, their readability and naturalness can be further improved by adjusting the way they are expressed and their order, thereby optimizing the large model's understanding and response to the query content.

[0099] In one example, for a Q&A application for home appliance instruction manuals, a pre-defined prompt template structure is as follows:

[0100] "You are a home appliance user assistant. Please provide concise and easy-to-understand answers to users' questions. You can refer to the Q&A examples: {examples}, or you can refer to the instruction manual: {manual}."

[0101] Based on the user's query "How to schedule a hot bowl of porridge for 8 AM tomorrow", relevant question-and-answer examples were matched: "Q: How do I schedule porridge on a rice cooker? A: 1. Prepare ingredients... 2. Select the timer menu... 3. Set the timer... 4. Start the timer...", along with relevant equipment manuals. These question examples and manuals are automatically populated into the "examples" and "manual" parameters of the prompt template structure, thus automatically constructing a prompt tailored to the current user's query.

[0102] In another example, for the home robot business, a pre-defined prompt template structure (JSON format) is as follows:

[0103] {"request": 'Please determine the user's next intention based on the conversation, {",".join(intent_prompts)}. If the user's next conversation does not show the above intention or is just chatting, you should output {{"intent":"chat"}}',

[0104] "restriction": 'The answer must be in the specified format, conforming to JSON format. You must refer to the user's dialogue with the assistant in "examples" to answer. If the user's dialogue does not continue with the above intention or is just chatting, you need to output {"intent":"chat"}'.

[0105] "format": {"intent": "intent tag"},

[0106] "examples": slot_examples}

[0107] Here, "intent_prompts" represents the explanation of the robot's intent, such as "robotFollow": "Let you follow the user's intent", "iotControl": "Use IoT home intent", etc. "slot_examples" represents input and output examples. Assuming the user's current query is "It's too hot, please turn on the air conditioner," the following multi-turn dialogue example is matched from the instance database: [{"role":"user","content":"It's so hot today"},{"role":"assistant","content":'Do you need me to turn on the air conditioner for you?'},{"role":"user","content":'Okay'},{"role":"assistant","content":'{"robot_intent": "IoT","slots": {"object": "Air conditioner","event": "Turn on"}}'}]. The above "intent_prompts" and the matched "slot_examples" are filled into the above prompt template structure, and the final prompt is automatically assembled.

[0108] This application embodiment uses intent category identifiers to selectively filter suitable instance data, which can transform abstract intents into reference examples in specific business scenarios. It injects contextual information that conforms to domain characteristics into prompt words, and further relies on the structured framework of the target prompt word template. Through the precise filling of target instance data, the abstract template parameters are transformed into actual content that fits the needs of specific scenarios. This makes the prompt words have clear instruction boundaries and incorporate real business context information, realizing the unified and dynamic construction of prompt words for multiple businesses. This stimulates the business scenario adaptability of the large model and generates higher quality response results that are more in line with actual application needs.

[0109] Based on the above embodiments, this application constructs a unified and dynamic large model prompt word construction method applicable to a wide range of business applications in home scenarios. Its features include: adopting an adaptive configurable design approach to achieve scalable configuration of user query sources, question-and-answer instances, and prompt word templates, exhibiting high flexibility and wide applicability; automatically and dynamically constructing large model prompt words adapted to business scenarios and user queries based on business type, diverse and ambiguous user questions, stimulating the large model's question-and-answer capabilities, and improving user experience; and quickly and accurately fixing bad cases (referring to specific cases that do not meet expected goals, have defects, or problems) that occur in actual operation or testing scenarios, improving operational efficiency.

[0110] In one embodiment, the large model prompt word construction method further includes:

[0111] Semantic features are extracted from the query content to obtain a query vector;

[0112] The query vector is input into the dual intent entity converter model to obtain the intent recognition result and entity recognition result output by the dual intent entity converter model;

[0113] If the confidence level of the intent recognition result is greater than or equal to the preset confidence level, then the pre-trained model is invoked to generate the first response result of the user request based on the intent recognition result and the entity recognition result;

[0114] If the confidence level of the intent recognition result is less than the preset confidence level, then a large model prompt word is constructed through the first agent; the large model is invoked, and a second response result for the user request is generated based on the large model prompt word.

[0115] Specifically, after receiving a user request, the system parses the request and accurately extracts the query content and APPID. Further, it performs text preprocessing on the query content, then extracts semantic features from the preprocessed query content, converting it into an embedding vector representation as the query vector. A special _CLS_ vector is used to represent the entire sentence for intent classification, while representations of other tokens are used for entity recognition.

[0116] We introduce the Bidirectional Encoder Representations from Transformers (BERT) method to create the Dual Intent and Entity Transformer (DIET) model. The DIET model is a lightweight language understanding model for dialogue systems, primarily used to simultaneously perform intent classification and entity recognition tasks. Its core advantage lies in achieving efficient training and performance optimization without requiring large-scale pre-training.

[0117] The DIET model is used to classify the user's query vector and identify entities, thus obtaining the intent recognition result and entity recognition result of the current user's request.

[0118] First, the confidence level of the intent recognition result is compared with the preset confidence level, which is set according to the actual situation.

[0119] If the confidence level of the intent recognition result is greater than or equal to the preset confidence level, the intent recognition result is considered to have been hit. A traditional pre-trained model, such as BERT or other deep learning models, is then invoked. These pre-trained models are mature models trained on large-scale data for specific tasks and possess powerful language understanding and feature extraction capabilities. The invoked pre-trained model is then applied to the current user request, analyzing and processing the intent recognition and entity recognition results to generate an accurate first response result that matches the user request. This first response result is then fed back to the user through an interactive interface or API.

[0120] If the confidence level of the intent recognition result is less than the preset confidence level, it indicates that the reliability of the current intent recognition result is insufficient. This may be because the DIET model's prediction result is not accurate enough, or the user request requires more complex processing and the DIET model cannot directly provide an accurate prediction result. In this case, the system will hand over the current query task to the subsequent large model for processing, and at the same time start the first intelligent agent.

[0121] For queries with complex intents or multiple intents, the DIET model may not be able to parse them correctly. It is necessary to perform task analysis and decomposition to form a series of sub-tasks or intents and then re-determine and reorganize the language description.

[0122] The first intelligent agent, acting as the task executor, aims to break down the user's complex request into multiple executable sub-tasks. First, it understands the user's natural language request and, considering the task's complexity, parses it into several actionable sub-tasks.

[0123] Optionally, a combination of techniques can be used to achieve different levels of task decomposition: 1) Rule-based task decomposition techniques: If a user request matches certain predefined rule templates, these rules can be directly applied to decompose the task. For example, the task of generating a report can be broken down into three steps: "data collection," "data analysis," and "report generation." 2) Deep learning-based task decomposition techniques: Sequence-to-Sequence models (such as T5 or Transformer models) can be used to generate multi-step tasks. The model can predict the steps of a series of sub-tasks.

[0124] Then, after task decomposition, the first agent executes the process of constructing large model prompts for each subtask. The process of constructing large model prompts has already been described in detail above and will not be repeated here. The first agent generates corresponding large model prompts based on the specific requirements and context information of each subtask, and then inputs them into the large model. The large model performs inference and calculation based on the input prompts, generates a second response result corresponding to the subtask, and feeds back the second response result to the user through an interactive interface or API.

[0125] This application's embodiments utilize the DIET model to extract semantic features from the query content and simultaneously output intent recognition and entity recognition results. When the confidence level of the intent recognition result meets the standard, a pre-trained model is directly invoked to generate the first response result, leveraging the lightweight advantage of the DIET model to achieve a rapid response. If the confidence level is insufficient, a suitable large-model prompt word is constructed through a first intelligent agent, and the large model is invoked to generate the second response result, utilizing the powerful contextual understanding and reasoning capabilities of the large model to handle complex or fuzzy queries. The introduction of a joint mechanism between the DIET model and the large model satisfies the system's need for rapid response to simple and clear intents through the DIET model, while the deep processing of the large model ensures the accuracy and reliability of the output in complex intent scenarios, effectively optimizing the overall efficiency and quality of the interaction. Furthermore, this combination of small and large models optimizes resource allocation, reduces unnecessary resource waste, and ensures the generation of high-quality prompt words even in complex business scenarios.

[0126] In one embodiment, after generating the second response result of the user request, the process includes:

[0127] The second response result is verified by a second intelligent agent;

[0128] If the verification result does not meet the expected effect, the second agent will feed the verification result back to the first agent, and the step of constructing a large model prompt word through the first agent will be executed iteratively until the verification result of the second response result meets the expected effect.

[0129] Specifically, after generating the second response result of the user request, the second intelligent agent is started to verify the second response result obtained from the execution of each subtask, ensuring that the output result of each subtask meets expectations.

[0130] First, based on each task type, the second agent pre-defines verification rules to determine the correctness of task execution, employing a hybrid technique of rule-based verification and model-based verification. 1) Rule-based verification: Simple verification based on predefined rules, such as checking whether the generated report contains key data fields and whether the analysis results are within a reasonable range. 2) Model-based verification: Using machine learning models to perform more advanced verification of the logic and accuracy of the results.

[0131] The second agent receives the intermediate results executed by the first agent in real time and performs step-by-step verification based on the verification rules. For each subtask output executed at each step, real-time verification is performed progressively.

[0132] If the verification result does not meet expectations, the second agent feeds the result back to the first agent. The first agent can then adjust the task execution method or re-execute specific steps based on the feedback, reconstruct the large model prompt words, and then infer the second response result through the large model. Verification is achieved through a feedback loop, making the execution and verification of subtasks a closed-loop process.

[0133] In this embodiment, the second agent verifies the second response result and feeds back to the first agent when the result does not meet expectations. This drives the dynamic iterative optimization of the prompt words, gradually corrects the inference error of the large model, and forms an automatic optimization closed-loop mechanism of "generation-verification-optimization". Especially when dealing with complex tasks or fuzzy instructions, this mechanism can continuously approach the expected effect, improve the quality and usability of the generated prompt words, and finally output a high-quality response result that matches the user's true intention. At the same time, it enhances the robustness and self-optimization capability of the system.

[0134] As can be understood from the two embodiments above, this application designs two types of intelligent agents: a task executor intelligent agent (first intelligent agent) and a task verifier intelligent agent (second intelligent agent). The two work collaboratively to decompose, execute, and verify user queries, ensuring the efficiency and accuracy of task completion. Through the interaction and optimization of the two intelligent agents, the system's intelligence level and ability to handle complex tasks are improved, ensuring the efficiency and accuracy of task execution.

[0135] By accumulating experience through multiple task executions, both the first and second agents can continuously optimize their task decomposition, execution, and verification capabilities using methods such as reinforcement learning. Reinforcement learning algorithms (such as A3C and DQN) can be used to optimize task decomposition strategies. The first agent can try different strategies during task decomposition, continuously improving its efficiency. The second agent, on the other hand, can continuously optimize its verification rules and feedback strategies by analyzing historical execution results.

[0136] in accordance with Figure 2 The entire process relies on intent entity recognition, matching of user-input query vectors, matching of instance data, matching of prompt word templates, and dynamic assembly technology to ultimately generate response results adapted to different business scenarios. By combining large industry models and traditional pre-trained models (such as deep learning models like BERT), the system can intelligently and efficiently process user requests and output intelligent results that meet business expectations based on the needs and data characteristics of different industries.

[0137] Furthermore, by introducing a BERT-based DIET model and combining it with a multi-turn dialogue intent recognition strategy, intent classification is used as a pre-process for the dynamic concatenation of prompt words in a large model. This solves the technical problems existing in current technologies, such as static template dependence, limited task scalability, lack of dynamic assembly mechanisms, and a single feedback mechanism. This method improves the system's flexibility and adaptability, supports unified processing of multiple business requirements, enhances resource utilization and generation accuracy, and establishes an effective automatic optimization mechanism, thus possessing significant practical application value.

[0138] Figure 7 This is a schematic diagram of the structure of the large model prompt word construction device provided in this application.

[0139] like Figure 7 As shown, the large model prompt word construction device includes:

[0140] Extraction module 710 is used to extract query content and business scenario identifiers from user requests;

[0141] The prompt word template matching module 720 is used to match the target prompt word template from the prompt word template database based on the business scenario identifier;

[0142] The prompt word module 730 is used to construct large model prompt words based on the intent category identifier associated with the query content and the target prompt word template.

[0143] The large model prompt word construction device provided in this application matches the target prompt word template from the prompt word template database based on the business scenario identifier, and constructs the large model prompt word by combining the intent category identifier associated with the query content. It can dynamically construct and adapt the large model prompt word according to the real-time user intent and business scenario, which has high flexibility. At the same time, through scenario-based adaptation and precise intent guidance, it can realize the unified dynamic construction of prompt words for multiple businesses, improve the scalability and adaptability of business processing, reduce system complexity, and improve resource utilization.

[0144] In one embodiment, the large model cue word construction device is further used for:

[0145] Semantic features are extracted from the query content to obtain a query vector;

[0146] Alternatively, the query content can be broken down into multiple sub-tasks; semantic features can be extracted from each sub-task to obtain multiple query vectors.

[0147] In one embodiment, the large model cue word construction device is further used for:

[0148] The similarity between the query vector and the preset query vector in the query vector database is calculated to obtain at least one target query vector that is most similar.

[0149] At least one of the intent category identifiers corresponding to the target query vector is determined as the intent category identifier associated with the query content.

[0150] In one embodiment, the prompt word construction module 730 is further configured to:

[0151] Based on the intent category identifier associated with the query vector, target instance data is matched from the instance database;

[0152] Based on the target instance data, the parameters to be filled in the target prompt word template are filled in to construct a large model prompt word.

[0153] In one embodiment, the large model cue word construction device is further used for:

[0154] Semantic features are extracted from the query content to obtain a query vector;

[0155] The query vector is input into the dual intent entity converter model to obtain the intent recognition result and entity recognition result output by the dual intent entity converter model;

[0156] If the confidence level of the intent recognition result is greater than or equal to the preset confidence level, then the pre-trained model is invoked to generate the first response result of the user request based on the intent recognition result and the entity recognition result;

[0157] If the confidence level of the intent recognition result is less than the preset confidence level, then a large model prompt word is constructed through the first agent; the large model is invoked, and a second response result for the user request is generated based on the large model prompt word.

[0158] In one embodiment, the large model cue word construction device is further used for:

[0159] The second response result is verified by a second intelligent agent;

[0160] If the verification result does not meet the expected effect, the second agent will feed the verification result back to the first agent, and the step of constructing a large model prompt word through the first agent will be executed iteratively until the verification result of the second response result meets the expected effect.

[0161] It should be noted that the large model prompt word construction device provided in this application can execute the large model prompt word construction method described in any of the above embodiments during actual operation, which will not be elaborated in this embodiment.

[0162] Figure 8 This is a schematic diagram of the structure of the electronic device provided in this application, such as... Figure 8 As shown, the electronic device may include a processor 810, a communications interface 820, a memory 830, and a communication bus 840, wherein the processor 810, communications interface 820, and memory 830 communicate with each other via the communication bus 840. The processor 810 can invoke logical instructions in the memory 830 to execute a large-model prompt word construction method. This method includes: extracting query content and a business scenario identifier from a user request; matching a target prompt word template from a prompt word template database based on the business scenario identifier; and constructing a large-model prompt word based on an intent category identifier associated with the query content and the target prompt word template.

[0163] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, 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 described in the various embodiments of this application. 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.

[0164] On the other hand, this application also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions, and when the program instructions are executed by a computer, the computer can execute the large model prompt word construction method provided in the above embodiments. The method includes: extracting query content and business scenario identifier from a user request; matching a target prompt word template from a prompt word template database based on the business scenario identifier; and constructing a large model prompt word based on the intent category identifier associated with the query content and the target prompt word template.

[0165] In another aspect, this application also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the large model prompt word construction method provided in the above embodiments. The method includes: extracting query content and business scenario identifier from a user request; matching a target prompt word template from a prompt word template database based on the business scenario identifier; and constructing a large model prompt word based on an intent category identifier associated with the query content and the target prompt word template.

[0166] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0167] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0168] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for constructing prompt words for a large model, characterized in that, The method for constructing large model prompt words includes: Extract query content and business scenario identifiers from user requests; Based on the business scenario identifier, the target prompt word template is matched from the prompt word template database; Based on the intent category identifier associated with the query content and the target prompt word template, a large model prompt word is constructed; After the query content is extracted, but before the target suggestion term template is matched, it also includes: Semantic features are extracted from the query content to obtain a query vector; The intent category identifier associated with the query content is determined in the following way: The similarity between the query vector and the preset query vector in the query vector database is calculated to obtain at least one target query vector that is most similar. At least one of the intent category identifiers corresponding to the target query vector is determined as the intent category identifier associated with the query content; The construction of large model prompt words based on the intent category identifier associated with the query content and the target prompt word template includes: Based on the intent category identifier associated with the query vector, target instance data is matched from the instance database; Based on the target instance data, the parameters to be filled in the target prompt word template are filled in to construct a large model prompt word.

2. The method for constructing large model prompt words according to claim 1, characterized in that, After the query content is extracted, but before the target suggestion term template is matched, it also includes: The query content is decomposed into multiple sub-tasks; semantic features are extracted from each sub-task to obtain multiple query vectors.

3. The method for constructing large model prompt words according to any one of claims 1 to 2, characterized in that, The large model prompt word construction method also includes: Semantic features are extracted from the query content to obtain a query vector; The query vector is input into the dual intent entity converter model to obtain the intent recognition result and entity recognition result output by the dual intent entity converter model; If the confidence level of the intent recognition result is greater than or equal to the preset confidence level, then the pre-trained model is invoked to generate the first response result of the user request based on the intent recognition result and the entity recognition result; If the confidence level of the intent recognition result is less than the preset confidence level, then a large model prompt word is constructed through the first intelligent agent; the large model is invoked, and a second response result of the user request is generated based on the large model prompt word.

4. The method for constructing large model prompt words according to claim 3, characterized in that, After generating the second response result of the user request, the following is included: The second response result is verified by a second intelligent agent; If the verification result does not meet the expected effect, the second agent will feed the verification result back to the first agent, and the step of constructing a large model prompt word through the first agent will be executed iteratively until the verification result of the second response result meets the expected effect.

5. A large model prompt word construction device, characterized in that, The large model prompt word construction device includes: The extraction module is used to extract query content and business scenario identifiers from user requests; The prompt word template matching module is used to match the target prompt word template from the prompt word template database based on the business scenario identifier; A prompt word construction module is used to construct large model prompt words based on the intent category identifier associated with the query content and the target prompt word template; After the query content is extracted, but before the target suggestion term template is matched, it also includes: Semantic features are extracted from the query content to obtain a query vector; The intent category identifier associated with the query content is determined in the following way: The similarity between the query vector and the preset query vector in the query vector database is calculated to obtain at least one target query vector that is most similar. At least one of the intent category identifiers corresponding to the target query vector is determined as the intent category identifier associated with the query content; The construction of large model prompt words based on the intent category identifier associated with the query content and the target prompt word template includes: Based on the intent category identifier associated with the query vector, target instance data is matched from the instance database; Based on the target instance data, the parameters to be filled in the target prompt word template are filled in to construct a large model prompt word.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the large model cue word construction method as described in any one of claims 1 to 4.

7. A non-transitory computer-readable storage medium, wherein a computer program is stored on the non-transitory computer-readable storage medium, characterized in that, When the computer program is executed by a processor, it implements the steps of the large model cue word construction method as described in any one of claims 1 to 4.

8. A computer program product, the computer program product comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the large model cue word construction method as described in any one of claims 1 to 4.