Prompt word optimization method, device, storage medium and program product integrated in question and answer process
By introducing AI models into the intelligent question-answering system and utilizing routing and reflection intelligent modules to collaboratively optimize prompt words, the problem of low efficiency in manual design is solved, and automated, rapid prompt word optimization and diversified demand response are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG UNIV
- Filing Date
- 2026-05-08
- Publication Date
- 2026-06-05
Smart Images

Figure CN122153018A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of prompt word optimization technology, and in particular to a prompt word optimization method, device, storage medium and program product integrated into a question-and-answer process. Background Technology
[0002] LLM (Large Language Model) has been widely applied in various fields such as intelligent customer service, medical consultation, and online Q&A due to its powerful natural language understanding and generation capabilities. In intelligent customer service scenarios, LLM can replace or assist human agents, achieving 24 / 7 response, high-concurrency processing, and standardized services.
[0003] While large language models have shown great potential in scenarios such as intelligent customer service, the ability of these models to output high-quality results relies heavily on high-quality prompts. As applications continue to evolve, prompts need to be dynamically adjusted based on application requirements, user behavior, and environmental changes to maintain the quality of the model's output.
[0004] Currently, the design and optimization of prompts mainly rely on manual processes. This includes manually writing prompts, testing and optimizing them, and iterating on them repeatedly as the application develops. This method is highly dependent on human intervention, resulting in high labor costs, long cycles, low efficiency, and difficulty in responding promptly to new scenarios or unexpected needs. Summary of the Invention
[0005] This application provides a method, device, storage medium, and program product for optimizing prompt words integrated into a question-and-answer process, which can realize automatic optimization of prompt words, improve the efficiency of prompt word optimization, and reduce labor costs.
[0006] This application provides a prompt word optimization method integrated into a question-answering process, applied to an intelligent question-answering system. The system includes: a routing intelligence module, a reflection intelligence module, and a baseline model deployed in a production environment. The method includes: The system receives question information; utilizes the routing intelligence module to perform semantic understanding-based scene recognition on the question information, and matches it against a prompt word library based on the identified target application scenario. The prompt word library includes multiple scenario-based prompt words and their corresponding application scenarios. If no target scenario-based prompt word is matched with the target application scenario, the question information is directly input into the baseline model, and question-and-answer processing without scenario-based prompt words is performed on the question information to obtain first answer information. The system uses the reflection intelligence module to perform multi-dimensional quality evaluation on the first answer information. If the first answer information passes the multi-dimensional quality evaluation, the system instructs the baseline model to perform structured reflection on the question-and-answer process without scenario-based prompt words, and generates the target scenario-based prompt word based on the structured reflection result. The system updates the target scenario-based prompt word and the target application scenario to the prompt word library, and outputs the first answer information.
[0007] This application also provides an intelligent question-answering system, including: a human-computer interaction module, a routing intelligence module, a reflection intelligence module, and a baseline model deployed in a production environment; The human-computer interaction module is used to receive question information and provide it to the routing intelligence module. The routing intelligence module is used to perform scene recognition based on semantic understanding on the question information, and match it in the prompt word library based on the identified target application scenario. The prompt word library includes multiple scenario-based prompt words and their corresponding application scenarios. If no target scenario-based prompt word corresponding to the target application scenario is matched, the question information is directly input into the baseline model, and question-and-answer processing without scenario-based prompt word guidance is performed on the question information to obtain the first answer information. The reflection intelligence module is used to perform multi-dimensional quality evaluation on the first answer information. If the first answer information passes the multi-dimensional quality evaluation, the baseline model is instructed to perform structured reflection on the question-and-answer process without scenario-based prompt word guidance, and generate the target scenario-based prompt word based on the structured reflection result. The target scenario-based prompt word and the target application scenario are updated to the prompt word library. The human-computer interaction module is also used to output the first answer information.
[0008] This application also provides an electronic device, including: a memory and a processor; the memory is used to store a computer program; the processor is coupled to the memory and is used to execute the computer program to implement the steps in the method provided in this application.
[0009] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to implement the steps in the method provided in this application.
[0010] This application also provides a computer program product, including: a computer program / instructions, which, when executed by a processor, enable the processor to implement the steps in the method provided in this application.
[0011] In this embodiment, prompt word optimization is deeply integrated into the question-and-answer process. Without relying on external models, it can leverage the collaboration between multiple intelligent modules to directly execute question-and-answer processing without contextual prompt words when the prompt word library does not contain contextual prompt words corresponding to the application scenario of the question information. Furthermore, by utilizing the reflective capabilities of the baseline model, it can perform structured reflection on the question-and-answer process without contextual prompt words, generating new contextual prompt words and achieving automatic prompt word optimization. This optimization process requires no manual intervention, which helps improve the efficiency of prompt word optimization and reduce labor costs. Attached Figure Description
[0012] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 A schematic diagram of the structure of a prompt word optimization framework based on an external reflection injection mechanism provided in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of an intelligent question-answering system provided in an embodiment of this application; Figure 3 This is a schematic diagram of the internal structure of the baseline model provided in the embodiments of this application; Figure 4 This is a schematic diagram of the internal structure of another baseline model provided in an embodiment of this application; Figure 5 This is a schematic diagram of the internal structure of another baseline model provided in an embodiment of this application; Figure 6 A flowchart illustrating a prompt word optimization method integrated into a question-and-answer process, provided as an embodiment of this application; Figure 7 This is a schematic diagram of the structure of a prompt word optimization device provided in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0013] 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 in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0014] It should be noted that, in the cases involving user information in the embodiments of this application, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use, and processing of related data must comply with relevant laws, regulations, and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse. In addition, the various models involved in this application (including but not limited to language models or large models) comply with relevant laws and standards.
[0015] Currently, the design and optimization of prompts primarily rely on manual processes. Taking intelligent customer service as an example, prompts need to be manually designed for AI (Artificial Intelligence) models (such as LLMs) that act as customer service representatives. Specifically, operations personnel develop an initial version of the prompts, which is then tested by business personnel. Based on the test feedback, the prompts are continuously adjusted and optimized through iterative iterations until the desired effect is achieved.
[0016] However, with the increasing diversification and complexity of user needs, this method of designing and optimizing prompts entirely by hand has gradually revealed significant shortcomings. On the one hand, manual iteration cycles are long and slow, making it difficult to keep up with rapidly changing application scenarios; on the other hand, repeated testing and modifications consume a large amount of manpower, resulting in high operating costs. Therefore, there is an urgent need to explore automated prompt optimization methods to improve efficiency, reduce costs, and better meet diverse and personalized user needs.
[0017] To address the problems of long cycles, low efficiency, and high costs associated with manual prompt optimization, this application proposes an automated prompt optimization scheme based on an AI model. This scheme applies AI models to prompt optimization scenarios, replacing traditional manual operations and automating the entire process of prompt design, testing, and optimization. By introducing AI models, operations personnel can be freed from tedious prompt iteration work. Compared to manual methods, the automated prompt optimization scheme using AI models significantly reduces manpower and time investment, greatly shortens the prompt optimization cycle, and improves the customer service system's responsiveness and intelligence level to diverse user needs, thereby enhancing the overall intelligence and operational efficiency of the customer service system.
[0018] In this embodiment, an AI model is applied to the prompt word optimization process to achieve automatic optimization of prompt words. Different specific methods of using AI models for automatic prompt word optimization will produce different technical effects. Several specific implementation schemes for automatic prompt word optimization based on AI models are provided below.
[0019] In one implementation scheme A1, a prompt word optimization framework based on an external reflection injection mechanism is provided, such as... Figure 1 As shown, the prompt word optimization framework includes a baseline model and an external model. The baseline model is the main model responsible for the actual question-and-answer task. In the context of intelligent customer service, it can be understood as the AI model that directly provides question-and-answer services to users. This AI model can be a large model, such as a large language model or a multimodal model, depending on the application requirements; there are no specific limitations. The external model is an auxiliary model specifically designed for prompt word optimization, aiming to provide prompt word optimization services to the baseline model. In terms of capability positioning, the baseline model has advantages in domain-specific expertise, accurately understanding and responding to user questions in specific application scenarios; while the external model performs better in general reasoning and thinking capabilities, possessing greater universality and the ability to reflect on and analyze problems in different domains.
[0020] Specifically, the customer service system can receive user-inputted questions through human-computer interaction interfaces (such as Q&A pages, customer service conversation interfaces, etc.), and provide the question information and the currently used prompt words to the baseline model. Guided by the current prompt words, the baseline model performs question-and-answer processing on the question information and generates the corresponding answer information, which is then fed back to the user through the customer service system. During this process, if the baseline model fails to successfully generate the correct answer matching the question information under the guidance of the current prompt words, it may indicate that the quality of the current prompt words is insufficient and fails to effectively stimulate the knowledge representation ability of the baseline model. To address this, an external model needs to be introduced to reflect on the failure process of the baseline model and optimize the current prompt words based on the reflection results.
[0021] Specifically, the question information, the incorrect answers generated by the baseline model, and the current prompt word can be provided to the external model. Based on the above input information, the external model analyzes and reflects on the process of the baseline model generating answers under the guidance of the current prompt word, identifies potential reasons for execution failure, and adjusts and optimizes the current prompt word accordingly. This process can be iterative; that is, after each optimization, the optimized prompt word and question information are re-inputted into the baseline model for verification until the baseline model can generate correct answer information under the guidance of the optimized prompt word. At this point, the finally optimized prompt word is fed back to the baseline model for subsequent question-answering tasks, thereby achieving automated optimization of the prompt word.
[0022] In Solution A1, an external model is introduced to provide prompt word optimization services to the baseline model, enabling the design and iteration of prompt words without manual intervention. Compared to traditional manual optimization methods, this solution has a significant advantage in efficiency, reducing labor costs and shortening the prompt word optimization cycle. However, the introduction of an external model expands the overall framework from a single-model architecture to a dual-model architecture, increasing the complexity of system design and implementation, requiring the handling of interaction logic and data flow between the two models. Secondly, passing question information, incorrect answers, and other data to the external model for processing may pose risks to data security and privacy protection, especially in customer service scenarios involving sensitive information. Furthermore, external models are typically models with large parameter scales and strong inference capabilities, resulting in relatively high call costs and long inference latency. Coupled with the multiple calls required for iterative optimization, this leads to a significant increase in overall cost and response time. Therefore, while achieving automated optimization, Solution A1 still faces challenges in terms of architectural complexity, data security, cost, and latency, requiring further optimization and improvement.
[0023] Therefore, based on the aforementioned solution A1, this application proposes another implementation solution A2. In solution A2, a prompt word optimization framework combining multi-intelligent module collaboration and a reflective mechanism is constructed. In this framework, prompt word optimization is deeply integrated into the question-and-answer process, and with the cooperation of multiple intelligent modules, it can achieve automated prompt word optimization without relying on external models, but directly by leveraging the baseline model and its reflective capabilities within the question-and-answer process. The core innovation of this framework lies in constructing a collaborative mechanism between multiple intelligent modules and integrating this collaborative mechanism with the reflective capabilities of the baseline model.
[0024] Specifically, the routing intelligence module is responsible for matching scenario-specific prompts in the prompt word library for the question information. If no matching scenario-specific prompt is found in the prompt word library, the baseline model can be directly invoked to perform question-and-answer processing without scenario-specific prompts. In this process, the baseline model not only undertakes the regular question-and-answer task but is also endowed with reflective capabilities. It can cooperate with the reflection intelligence module to conduct multi-dimensional quality assessment of the answer information. When the answer information passes the multi-dimensional quality assessment, the module performs structured reflection on the question-and-answer process without scenario-specific prompts and generates new scenario-specific prompts accordingly. The newly generated scenario-specific prompts can be stored in the prompt word library for use in subsequent question-and-answer tasks in similar scenarios, thus forming a closed-loop optimization mechanism of "question-answer-reflection-generation-retention".
[0025] Therefore, it is evident that Solution A2 automates the prompt optimization process. When the prompt library lacks contextual prompts matching the current question scenario, the framework automatically triggers the baseline model's reflection mechanism. Building upon the completed question-and-answer task, it automatically performs structured reflection on the question-and-answer process without contextual prompts and generates new contextual prompts. This entire process requires no manual intervention, freeing operations personnel from tedious prompt design and iteration, thus saving labor costs. Furthermore, in Solution A2, the baseline model completes the entire "question-answer-reflection-generation" closed loop in a single question-and-answer process. Newly generated contextual prompts are immediately added to the prompt library. This integrated prompt optimization mechanism into the question-and-answer process significantly shortens the prompt design-to-application cycle, improving prompt optimization efficiency.
[0026] Furthermore, compared with the above-mentioned solution A1, solution A2 also has the following technical improvements: At the architecture level, solution A2 embeds the prompt word optimization function into the baseline model itself, simplifying the overall framework from a dual-model architecture to a single-model architecture. This reduces the difficulty of system design and implementation, reduces the coupling between modules, and improves the maintainability of the system.
[0027] In terms of data security, Solution A2 completely eliminates the reliance on external models. There is no need to transmit question and answer information to external models. All data processing is completed internally, which solves the data security problem to a certain extent and better meets the security and compliance requirements of scenarios with high privacy requirements.
[0028] In terms of cost, Solution A2 leverages the reflective capabilities of the baseline model itself, eliminating the need to call external models. This saves on the cost of calling external models and avoids the latency overhead caused by external inference, achieving a dual optimization of cost and efficiency.
[0029] At the system evolution level, Solution A2 automatically stores newly generated contextualized prompts into a prompt word library, which is continuously enriched as the question-and-answer task progresses. In subsequent tasks, the baseline model can select appropriate contextualized prompts based on the application scenario, forming a self-reinforcing closed-loop mechanism that enables the system to continuously evolve in actual operation.
[0030] In summary, Solution A2 demonstrates significant technical advantages in terms of simplified architecture, data security, cost control, and system evolution, while achieving automated optimization of prompt words.
[0031] The following describes in detail, with reference to the accompanying drawings, the scheme A2 for automated optimization of prompt words provided in the embodiments of this application.
[0032] Figure 2 This is a schematic diagram of the structure of an intelligent question-answering system provided in an embodiment of this application. Figure 2 As shown, the intelligent question-answering system 200 includes: a human-computer interaction module 201, a routing intelligence module 202, a reflection intelligence module 203, and a baseline model 204 deployed in the production environment.
[0033] In this embodiment, the baseline model 204 and the human-computer interaction module 201 cooperate to provide intelligent question-and-answer services to users. In providing the question-and-answer service, the baseline model 204 relies on contextualized prompts to generate high-quality answers. In addition to undertaking basic question-and-answer tasks, the baseline model 204 is also endowed with reflective capabilities and automatic prompt optimization capabilities, enabling it to dynamically optimize the contextualized prompts required for the question-and-answer service, thereby continuously improving its performance in subsequent question-and-answer tasks and better meeting diverse user needs.
[0034] In this embodiment, the implementation of the baseline model 204 is not limited; it can be any AI model capable of providing intelligent question-answering services and possessing reflective capabilities. The baseline model 204 in this embodiment can be a deep learning model with a relatively large number of model parameters. This embodiment does not limit the number of model parameters supported by the deep learning model used, aiming to meet actual needs. The baseline model 204 involved in this embodiment can, for example, be an AI-based LM (Language Model) or MM (Multimodal Model), or various large models such as large language models; there is no limitation in this regard.
[0035] The aforementioned production environment refers to a runtime environment where the baseline model has been integrated into a real intelligent question-answering system, directly providing services to real users, rather than a test environment or offline environment used for development, testing, or experimentation. In the production environment, the baseline model directly handles high-concurrency user inquiries from real-world application scenarios. Its input data consists of real user question information, not simulated data, and the output directly impacts user experience and service efficiency. For example, in an intelligent customer service system, the production environment could be a robot that directly answers buyer inquiries, an online system in the medical consultation field that provides advice to patients, or a service interface in various online question-answering platforms that handles real-time user inquiries. Running the baseline model in this production environment allows it to capture new scenarios not covered by existing prompts in real time, thereby using real interaction data to trigger subsequent reflection and prompt generation processes, achieving dynamic optimization and iteration of prompts.
[0036] In this embodiment, to assist the baseline model 204 in achieving automated optimization of prompt words, two intelligent modules are added to the intelligent question-answering system 200: a routing intelligent module 202 and a reflection intelligent module 203. These two intelligent modules can be implemented as agents dependent on the baseline model 204, i.e., functional components driven by specific prompts or instructions, using the baseline model 204 as a capability foundation; however, the implementation is not limited to this form. With the collaborative cooperation of the routing intelligent module 202 and the reflection intelligent module 203, the intelligent question-answering system 200 constructs a prompt word optimization framework that combines multi-intelligent module collaboration with a reflection mechanism. In this framework, prompt word optimization is deeply integrated into the question-answering process, and with the cooperation of multiple intelligent modules (i.e., the routing intelligent module 202 and the reflection intelligent module 203), automated prompt word optimization can be achieved directly by leveraging the baseline model and its reflection capabilities within the question-answering process, without relying on external models. The core innovation of this framework lies in constructing a collaborative mechanism between multiple intelligent modules and integrating this collaborative mechanism with the reflection capabilities of the baseline model.
[0037] Specifically, the human-computer interaction module 201 serves as the interface between the intelligent question-answering system 200 and the user, and is used to receive the user's question information. The implementation of the human-computer interaction module 201 is flexible and can be tailored to specific application scenarios and deployment methods; no limitations are imposed on its implementation. An example is provided below: In some implementations, the human-computer interaction module 201 can be represented as a user-facing graphical interface, such as an intelligent customer service dialogue window, a floating window for online consultation on a webpage, a customer service chat page within a mobile application, or a question-and-answer interaction panel on a self-service terminal. Users can submit problem information through the above interface in various ways, including but not limited to: typing problem information in text form in the input box, submitting problem information via voice input (requiring a voice recognition component to identify problem information from voice information), selecting from a preset list of frequently asked questions, and uploading files or images containing problem information (requiring subsequent recognition and extraction of problem information using a multimodal recognition model).
[0038] In other implementations, the human-computer interaction module 201 may also take the form of a non-graphical interaction, such as an API interface for third-party systems to call in order to submit problem information; or it may take the form of an intelligent robot in an instant messaging tool, where users submit problem information by sending messages to the intelligent robot, and the human-computer interaction module 201 sends and receives messages by connecting to the backend interface of the instant messaging tool.
[0039] Regardless of the implementation, the core function of the human-computer interaction module 201 remains consistent: as the entry module of the intelligent question-answering system 200, it is responsible for receiving user question information and, when necessary, providing the user with system-generated answer information in a user-understandable manner (such as text replies, graphic cards, voice broadcasts, etc.), thus completing the closed loop of question-answering interaction. That is, the human-computer interaction module 201 is also used to: output the first answer information after the first answer information has passed multi-dimensional quality evaluation. See the following description for details on the first answer information.
[0040] In this embodiment, after receiving the problem information, the human-computer interaction module 201 does not directly provide the problem information to the baseline model 204, but instead provides the problem information to the routing intelligence module 202. The routing intelligence module 202 is used to perform scene recognition based on semantic understanding on the problem information, that is, to identify the application scene to which the problem information belongs. For ease of distinction and description, the application scene to which the problem information belongs is referred to as the target application scene.
[0041] Furthermore, in this embodiment, a prompt word library is pre-maintained. This library includes multiple scenario-based prompt words and their corresponding application scenarios, used to provide prompt words (i.e., guidance instructions) for various application scenarios to the baseline model 204 in the intelligent question-answering system 200. Since these prompt words are divided by application scenarios, they are called scenario-based prompt words. The prompt word library can be implemented in the form of a database, configuration file, or vector storage. This embodiment supports management operations such as adding, deleting, modifying, and querying scenario-based prompt words in the prompt word library. In this embodiment, an application scenario refers to a specific question category or application field, used to identify the applicable scope of the scenario-based prompt words. The granularity of the application scenario can be coarse or fine. For example, it can be a coarse-grained application scenario such as "pre-sales consultation," "account security," or "logistics inquiry," or a fine-grained application scenario such as "order inquiry," "password reset," or "complaint handling." Contextualized prompts are dedicated prompt templates designed for specific application areas or question types. Contextualized prompts fully consider the knowledge requirements, expression methods, and response standards in specific application scenarios, and can more accurately guide the baseline model 204 to generate answer information that meets the expectations of the application scenario.
[0042] Based on the above, the routing intelligence module 202 can perform matching in the prompt word library based on the identified target application scenario. If no target contextual prompt word corresponding to the target application scenario is matched in the prompt word library, the question information is directly input into the baseline model 204, which performs question-and-answer processing without contextual prompt words to obtain the first answer information. In this process, the baseline model 204 is called by the routing intelligence module 202 and undertakes the question-and-answer task without contextual prompt words. For ease of description and distinction, the contextual prompt word corresponding to the target application scenario is referred to as the target contextual prompt word.
[0043] In this embodiment, after the baseline model 204 outputs the first answer information, it does not directly feed the first answer information back to the user through the human-computer interaction module 201. Instead, it provides the first answer information to the reflection intelligence module 203. The reflection intelligence module 203 is used to perform multi-dimensional quality evaluation on the first answer information. If the first answer information passes the multi-dimensional quality evaluation, it outputs the first answer information through the human-computer interaction module 201. On the other hand, it instructs the baseline model 204 to perform structured reflection on the question-and-answer process without contextualized prompts, and generates target contextualized prompts based on the structured reflection results. It also updates the target contextualized prompts and target application scenarios to the prompt word library, thereby achieving automated optimization of contextualized prompts. In this process, the baseline model 204 is invoked by the reflection intelligence module 203 and leverages its reflection and prompt word optimization capabilities, that is, it performs structured reflection on the question-and-answer process without contextualized prompts and generates new contextualized prompts based on the reflection results.
[0044] Therefore, in the above process, with the cooperation of the routing intelligence module 202, if no contextualized prompt word matching the application scenario of the question information is found in the prompt word library, the baseline model 204 can be directly invoked to perform question-and-answer processing without contextualized prompt words. In this process, the baseline model not only undertakes the regular question-and-answer task but is also endowed with reflective capabilities. It further cooperates with the reflection intelligence module 203 to conduct multi-dimensional quality assessment of the answer information. If the answer information passes the multi-dimensional quality assessment, it performs structured reflection on the question-and-answer process without contextualized prompt words and generates new contextualized prompt words accordingly. These newly generated contextualized prompt words can be stored in the prompt word library for use in subsequent question-and-answer tasks in similar scenarios, thus forming a closed-loop optimization mechanism of "question-answer-reflection-generation-accumulation". It should be noted that the prompt word optimization here mainly refers to the optimization process of generating contextualized prompt words for application scenarios. Other technical effects of this application embodiment can be found in the descriptions of the foregoing embodiments and will not be repeated here.
[0045] In this embodiment, the implementation method of the routing intelligence module performing scene recognition based on semantic understanding of the problem information and matching it in the prompt word library based on the recognized target application scene is not limited. Examples are given below: In one optional embodiment, after receiving the problem information, the routing intelligence module can use a domain-adaptive semantic encoder to encode the problem information into a problem semantic vector; calculate the semantic similarity between the problem semantic vector and the scenario prototype vector of the existing application scenario in the prompt word library; and determine the target application scenario from the existing application scenarios in the prompt word library based on the semantic similarity.
[0046] In this embodiment, a domain-adaptive semantic encoder is used to encode the question information into a question semantic vector. By aligning the data distributions of different domains, a domain-invariant semantic feature representation is learned, which can improve the model's generalization ability and robustness in the target domain. Here, the target domain refers to the domain to which the target application scenario belongs.
[0047] In this embodiment, the implementation of the domain-adaptive semantic encoder is not limited. Optionally, one implementation structure of the domain-adaptive semantic encoder includes: an input embedding layer, a feature extraction layer, a domain-adaptive alignment module, and a semantic output layer connected in sequence. Specifically, question information from the target domain can be input into the embedding layer, which is responsible for mapping the question information from the source domain and the target domain to initial feature vectors respectively; wherein, the source domain refers to the domain to which the sample data used in training the domain-adaptive semantic encoder belongs, and these domains already have a large amount of labeled data or rich knowledge. The feature extraction layer is responsible for performing deep feature extraction on the initial feature vector to obtain high-dimensional semantic features. The domain-adaptive alignment module is connected to the feature extraction layer and the semantic output layer respectively, and is used to minimize the distribution difference between the source domain and the target domain in the high-dimensional semantic feature space through a preset distribution difference measurement criterion, and learn a domain-invariant feature representation; the semantic output layer is used to generate a unified question semantic vector based on the domain-invariant feature representation. Here, the distribution difference measurement criterion is a criterion required to measure the data difference between the source domain and the target domain. In one optional embodiment, the preset distribution difference metric can employ a distribution matching unit based on the maximum mean difference, using distance calculation in the regenerating kernel Hilbert space to measure the alignment of feature distributions between the source and target domains. In another optional embodiment, the preset distribution difference metric can also employ a domain discriminator unit based on adversarial training, using a gradient inversion layer or generative adversarial mechanism to allow the feature extractor and the domain discriminator to engage in a game until the extracted features can no longer accurately determine the domain source, thereby implicitly minimizing the distribution difference.
[0048] In this application embodiment, the implementation method of determining the target application scenario from existing application scenarios in the prompt word library based on the above-mentioned semantic similarity is not limited. In one optional embodiment, the application scenario corresponding to the scenario prototype vector with the highest semantic similarity can be used as the target application scenario. In another optional embodiment, candidate application scenarios can be determined from existing application scenarios in the prompt word library based on the above-mentioned semantic similarity; then, the target application scenario is determined based on the candidate application scenarios. The candidate application scenarios can be application scenarios corresponding to semantic similarity greater than a set similarity threshold, or application scenarios corresponding to the largest number of semantic similarities.
[0049] In determining the target application scenario based on candidate application scenarios, the target application scenario can be randomly selected from the candidate application scenarios. Alternatively, when determining the target application scenario based on candidate application scenarios, the matching confidence score between the question semantic vector and the candidate application scenario can be calculated based on the local density or prediction stability of the question semantic vector in the neighborhood of the candidate application scenario. If the matching confidence score is less than a preset confidence threshold, a new application scenario is generated based on the question semantic vector as the target application scenario, and there is no corresponding target scenario-based prompt word in the prompt word library. If the matching confidence score is greater than or equal to the preset confidence threshold, the candidate application scenario is used as the target application scenario, and the scenario-based prompt word in the prompt word library corresponding to the candidate application scenario is used as the target scenario-based prompt word. In this optional embodiment, by introducing local density and prediction stability as confidence metrics, it is possible to better perceive whether the question semantic vector is located in a sparse region of the candidate application scenario. If the question semantic vector falls in a sparse region (low local density) in the neighborhood of the candidate application scenario or has a large fluctuation in similarity to the corresponding scenario prototype vector (poor stability), the confidence is deemed insufficient, thus rejecting forced matching and avoiding the failure of subsequent matching contextual prompts due to misclassification. Furthermore, in this optional embodiment, introducing the matching confidence between the question semantic vector and the candidate application scenario can construct a dynamic scene adaptive closed loop, effectively solving the problems of forced classification and boundary solidification in traditional fixed scene classification when facing fuzzy inputs or unknown new scenarios.
[0050] Further optionally, in the above optional embodiments, one implementation method for using candidate application scenarios as target application scenarios includes: directly using candidate application scenarios as target application scenarios, which is simpler and more efficient. Alternatively, in the above optional embodiments, one implementation method for using candidate application scenarios as target application scenarios includes: calling the baseline model 204, and performing a binary classification judgment on whether the question information belongs to a candidate application scenario based on the question semantic vector and the scenario prototype vector of the candidate application scenario; if the binary classification result is yes, then the candidate application scenario is used as the target application scenario; if the binary classification result is no, then a new application scenario can be generated based on the question semantic vector as the target application scenario. Further judgment through binary classification can improve the accuracy of determining the target application scenario, which is beneficial to ensuring the accuracy of subsequent contextualized prompts.
[0051] In the above embodiments, if the matching confidence is less than a preset confidence threshold, or the binary classification result is "not belonging," a new application scenario can be generated as the target application scenario based on the question semantic vector. In this case, if there is no target contextualized prompt word corresponding to the target application scenario in the prompt word library, the routing intelligence module will proceed to the branch where no target contextualized prompt word corresponding to the target application scenario cannot be matched when matching the target application scenario in the prompt word library. This is referred to as branch 1. Figure 2 The solid line indicates the target application scenario. Conversely, if the matching confidence is greater than or equal to the preset confidence threshold, or if the binary classification result is "not belonging," then the candidate application scenario can be used as the target application scenario. In this case, if the prompt word library contains a target contextualized prompt word corresponding to the target application scenario, then when the routing intelligence module matches the prompt word library according to the target application scenario, it will proceed to the branch that matches the target contextualized prompt word corresponding to the target application scenario, referred to as branch 2, as shown below. Figure 2 The dashed line indicates the area shown.
[0052] The two branches will be introduced and explained separately below: Branch 1: This branch leads to a situation where no matching contextualized prompt words can be found for the target application scenario. In this case, the question information is directly input into the baseline model, and question-and-answer processing without contextualized prompt words is performed to obtain the first answer information.
[0053] In this application embodiment, the specific implementation of the baseline model for performing question-and-answer processing on question information without contextual prompts is not limited. Any model implementation principle that can perform question-and-answer processing on question information and obtain the first answer information without contextual prompts is applicable to this application embodiment.
[0054] Optionally, based on the above, an example of the internal implementation structure of the baseline model is given, and the functions it performs at different stages are explained in conjunction with the model structure.
[0055] like Figure 3 The diagram illustrates an example of the internal implementation structure of the baseline model in this embodiment. In this example, the baseline model includes a shared semantic encoding network, a scene attribution binary classification network, and an answer generation network. The shared semantic encoding network serves as the underlying feature extraction module, while the scene attribution binary classification network and the answer generation network serve as upper-level functional branches, respectively, used to complete scene attribution judgment and question-answer generation tasks without contextualized prompts.
[0056] In this embodiment, a shared semantic coding network is used to perform unified deep semantic modeling on the input semantic information. Specifically, when performing binary classification, the baseline model receives the question semantic vector and the scenario prototype vector of the candidate application scenario, and performs feature concatenation or difference construction on both to form a joint input vector. When performing a question-answering generation task, the baseline model directly receives the question information as input and encodes it to obtain a global semantic representation containing the question intent and contextual information. The shared semantic coding network can adopt a Transformer coding structure, a dual-tower coding structure (Siamese Network), or a multi-layer feedforward neural network structure; no limitation is made here, to achieve multi-layer nonlinear mapping of the input vector and extract high-dimensional joint semantic feature representations. Through the above design, the classification task and the generation task perform representation learning in the same semantic space, thereby ensuring semantic consistency between the two types of tasks.
[0057] In the binary classification process, the joint semantic features are input into the scene classification network. This scene classification network can include a feature interaction unit and a discriminant output unit. The feature interaction unit explicitly models the matching relationship between the question semantic vector and the scene prototype vector in the joint input vector, for example, by constructing matching features through vector concatenation, element-wise multiplication, and difference operations. The matching features are input into the discriminant output unit, which calculates the probability value of the matching features using a sigmoid or softmax function to determine whether the candidate application scene can be used as the target application scene. When the probability value is greater than a preset classification threshold, the binary classification result is determined to be "belongs," thus making the candidate application scene the target application scene; if the probability value is lower than the preset classification threshold, it is determined to be "does not belong," and the logic for generating a new application scene is triggered.
[0058] The specific form of the preset classification threshold is not limited. For example, the preset classification threshold can be set according to the actual scenario's need to balance classification accuracy and recall, such as setting it to 0.5 to follow the maximum probability principle, or setting it to a high confidence range between 0.7 and 0.9 to reduce the risk of false positives; it can also be a segmentation point determined by statistical analysis of historical validation data, or a differentiated threshold set for application scenarios of different importance. Through the scenario-attribution binary classification network, further refined discrimination can be performed on the basis of similarity screening, improving the accuracy of target application scenario determination.
[0059] When the routing process enters branch 1, where no contextualized prompt word corresponding to the target application scenario exists in the prompt word library, a global semantic representation containing the question intent and contextual information is input into the answer generation network of the baseline model. Question answering is then performed without contextualized prompt word guidance. The answer generation network can employ an autoregressive generation structure, such as the Transformer decoder structure, which progressively generates text—the first answer—based on a conditional probability model P(Answer | Question). During the generation process, at each time step, the answer generation network calculates the probability distribution of the next word based on the generated content and the global semantic representation, selecting the word with the highest probability or the word determined by a sampling strategy as the current output, until an end marker is generated, thus obtaining the complete first answer information.
[0060] In another optional embodiment, the answer generation network can also be combined with a retrieval enhancement module. That is, before generation, relevant knowledge fragments are retrieved from the internal knowledge base based on the semantic representation of the question. The retrieval results are then fused with the semantic representation of the question before decoding and generation to improve the factuality and completeness of the answer. Regardless of the generation structure used, as long as the answer is generated directly based on the semantic representation of the question itself without the introduction of contextualized prompt word templates, it falls under the question-answering processing without contextualized prompt word guidance described in the embodiments of this application.
[0061] In summary, in this embodiment, the baseline model achieves unified semantic modeling through a shared semantic encoding network, and is further divided into two functional networks: one is a scenario-attribution binary classification network, used to determine whether the question belongs to a candidate application scenario; the other is an answer generation network, used to directly generate the first answer information when no scenario-based prompt words are matched. This structure can support refined scenario judgment and ensure that basic question-and-answer results can still be output in unknown scenarios or with low confidence, thus providing a reliable input basis for the subsequent reflection intelligence module to perform multi-dimensional quality assessment and prompt word optimization. When the baseline model outputs the first answer information, the first answer information is input into the reflection intelligence module 203, which is responsible for performing multi-dimensional quality assessment of the first answer information to evaluate its quality. The multi-dimensional quality assessment of the first answer information includes performing at least two of the following assessment operations: Accuracy assessment: Based on a pre-defined domain factual knowledge base, assess the accuracy of the factual content in the first answer information; Completeness assessment: Based on the answer information dimensions required by the question information, a completeness assessment is performed on the information dimensions covered by the first answer information, wherein the answer information dimensions include key elements, necessary explanations, risk warnings and / or action suggestions; Logical evaluation: The logical consistency among the information statements included in the first answer information is evaluated to assess whether there are contradictions, circular arguments, or breaks in reasoning. Adaptability assessment: Based on at least one of the intent information, topic information, and expression style of the first answer information, the adaptability between the first answer information and the question information is assessed; Compliance assessment: Based on the compliance information, conduct a compliance and security assessment of the first answer information.
[0062] In this embodiment, the accuracy assessment refers to judging the authenticity and correctness of the objective factual content involved in the first answer information to determine whether the answer contains factual errors, data biases, or factual inaccuracies. A pre-defined domain factual knowledge base is a set of knowledge pre-built or accessed within a specific application domain, used to provide standard basis for fact verification. For example, in a medical consultation scenario, the pre-defined domain factual knowledge base may include clinical guidelines, drug instruction databases, disease diagnosis and treatment guidelines, etc.; in a financial customer service scenario, it may include regulatory documents, product terms and conditions, interest rate standards, or risk disclosure documents, etc. Factual content refers to the objectively verifiable declarative content in the first answer information, such as time, values, definitions, policy regulations, descriptions of causal relationships, or professional conclusions, etc. Accuracy assessment of the factual content in the first answer information can be performed by comparing the factual statements extracted from the answer with standard information in the pre-defined domain factual knowledge base to determine whether they are consistent, whether there is exaggeration, omission, or incorrect expression, thereby outputting an accuracy evaluation result. Through accuracy assessment, the risk of the baseline model generating illusions or erroneous knowledge output can be reduced.
[0063] In this embodiment, the completeness assessment refers to a systematic check of whether the first answer information covers the necessary content based on the dimensions of the answer information required by the question. The answer information dimensions refer to the structural elements that constitute a complete, high-quality answer, such as key elements, necessary explanations, risk warnings, and / or action suggestions. Key elements refer to basic information that directly addresses the core of the question; for example, when asking "how to apply for a credit card," key elements may include application conditions, required materials, and application procedures. Necessary explanations refer to the principle or background explanation of the key elements, such as explaining why a certain fee is incurred or the scope of application of a certain regulation. Risk warnings refer to potential risks or precautions related to the question, such as the potential risk of principal loss from investment products. Action suggestions refer to actionable suggestions based on the question context. During the completeness assessment process, the reflective intelligent module can identify the information dimensions already covered in the first answer information through a preset answer structure template or information extraction model, and compare them with the dimensions required by the question to determine whether there is missing or insufficient coverage of information, thereby improving the comprehensiveness of the answer.
[0064] In this embodiment, the logical evaluation refers to analyzing the consistency and coherence of the logical relationships between the statements within the first answer information. Logical consistency between the statements means that there are no conflicts or breaks in the causal relationships, temporal order, conditional assumptions, or reasoning chains between different statements in the first answer information. For example, during the evaluation process, a semantic logic graph or causal chain can be constructed to analyze whether the premises and conclusions between statements match. Contradiction refers to mutually contradictory or inconsistent statements in the first answer information, such as stating "the drug has no side effects" one moment and "the drug may cause serious adverse reactions" the next. Circular reasoning refers to repeatedly using an unproven conclusion as evidence to support itself, such as "the product is safe because it is a safe product." Reasoning breaks refer to the absence of necessary intermediate logical steps in the argumentation process, resulting in a lack of sufficient support for the conclusion. Through logical evaluation, problems of sloppy reasoning or chaotic structure can be identified, thereby ensuring the logical rigor of the answer.
[0065] In this embodiment, the suitability assessment refers to determining whether the first answer information closely adheres to the core intent and theme of the question information, and whether it deviates from the theme, answers irrelevantly, or includes irrelevant redundant content. This assessment can be obtained by evaluating the first question-and-answer information and the question information based on at least one of the intent information, subject information, and expression style of the first answer information. For example, when a user asks "How to change my password," if the first answer information elaborates extensively on account security theory but fails to provide specific modification steps, the suitability can be determined to be low. Optionally, the suitability assessment can use an intent recognition model and theme similarity calculation to quantitatively analyze the semantic consistency between the question information and the first answer information, ensuring that the answer accurately corresponds to the user's needs. The intent information of the first answer information refers to the core response purpose expressed by the first answer information, such as explanation, advice, risk warning, or problem-solving; the theme information refers to the main content scope or topic focus of the first answer information, such as medical issues, financial products, or operational procedures; and the expression style refers to the presentation of the first answer information in terms of tone, wording, and structure, such as whether it is professional and rigorous, colloquial, or concise and clear.
[0066] In this embodiment, the compliance information refers to a set of rules related to laws and regulations, industry norms, ethical standards, and platform security strategies, such as data privacy protection regulations, advertising compliance requirements, and risk disclosure norms in the medical or financial fields. The compliance and security assessment refers to reviewing whether the first answer information contains illegal or non-compliant content, leaks sensitive information, misleading statements, or potential security risks, based on the compliance information. For example, in a financial scenario, the first answer information must not promise "guaranteed principal and returns"; in a medical scenario, it must not provide unapproved prescription advice; and in a general scenario, it must not output illegal, violent, or content that infringes on the rights of others. Through compliance and security assessment, it can be ensured that the baseline model outputs answer information that complies with regulatory and platform governance requirements, thereby reducing legal and social risks.
[0067] In summary, multi-dimensional quality assessment can systematically review the first answer information through comprehensive analysis of multiple levels such as accuracy, completeness, logic, suitability, and compliance, providing a reliable basis for whether to trigger structured reflection and generate target scenario-based prompts.
[0068] In this embodiment, the method of defining the first answer information as passing a multi-dimensional quality assessment is not limited. For example, the first answer information can be determined to have passed a multi-dimensional quality assessment after passing the quality assessment on each dimension. Alternatively, the total number of dimensions in the multi-dimensional quality assessment and the number of sub-dimensions in which the first answer information passed the quality assessment can be counted. If the ratio of the sub-dimensions to the total number of dimensions is greater than a set ratio threshold, the first answer information is determined to have passed the multi-dimensional quality assessment. Alternatively, key dimensions can be defined among multiple dimensions, such as accuracy and logicality. If the dimensions in which the first answer information passes the quality assessment include key dimensions, then the first answer information is determined to have passed the multi-dimensional quality assessment.
[0069] When the first answer information passes a multi-dimensional quality assessment, the reflective intelligence module 203 can instruct the baseline model 204 to perform structured reflection on the question-and-answer process guided by no contextual prompts, and generate target contextual prompts based on the structured reflection results. In this embodiment, the implementation process of the reflective intelligence module 203 instructing the baseline model 204 to perform structured reflection on the question-and-answer process guided by no contextual prompts and generate the target contextual prompts based on the structured reflection results is not limited. An example is given below: In an optional embodiment, the reflection intelligence module 203 can obtain a prompt word structure template corresponding to the contextualized prompt word. The prompt word structure template includes multiple component element fields, which are used to define the component elements of the contextualized prompt word. Based on this, according to the component element fields in the prompt word structure template, the reflection object and reflection logic are determined. Based on the reflection object and reflection logic, reflection prompt words are generated. Based on the reflection prompt words, the baseline model is instructed to perform structured reflection on the question-and-answer process without contextualized prompt word guidance, and the target contextualized prompt word is generated based on the structured reflection result.
[0070] Depending on the different component fields included in the prompt word structure template, the implementation methods for determining the reflection object and reflection logic will also differ.
[0071] The "component element fields" refer to pre-set structured fields (also known as slots / parameters) in the prompt structure template corresponding to the contextualized prompts. These fields constrain and define the constituent elements and their organization within the contextualized prompts. Setting these component element fields allows contextualized prompts to be automatically generated, replaced, and maintained through field filling, avoiding the problems of unstable structure and difficulty in reusability caused by relying entirely on manual writing of prompt content. For example, the prompt structure template may include "scene description field," "example field," "process field," "constraint field," and "style field," with each field corresponding to a type of prompt information and specifying its output format and boundaries.
[0072] The components of the contextualized prompts refer to the set of key control information that needs to be injected to guide the baseline model to stably produce answers that meet application requirements in specific application scenarios. The reflection objects are the set of objects that need to be summarized and precipitated into reusable prompt asset during the structured reflection phase. Since this embodiment emphasizes summarizing the correct question-and-answer process that has passed quality assessment, this reflection is inductive reflection. The reflection objects are not errors or deficiencies, but rather successful generation paths and their reproducible structures. Optionally, the reflection objects may include: how scenario description information is formed in the target application scenario, how reusable positive sample examples are formed, and how a stable question-and-answer process (execution strategy) is abstracted. In other words, the reflection objects focus on how the correct answer is organized, what key elements it covers, and what steps and boundaries it follows, so as to precipitate the correct process into templated rules.
[0073] The inductive reflection logic refers to a set of rules and steps for replaying, abstracting, generalizing, and structuring the question-and-answer process guided by contextualized prompts on a baseline model under given constraints. This transforms the implicit generation experience of a correct question-and-answer session into reusable structured prompt elements. This inductive reflection logic is driven by the constituent fields of the prompt structure template: the inductive rules are formed around the fields included in the template. For example, when the template includes "scenario description field, example field, and process field," the inductive reflection logic may include: inferring the target application scenario based on the question information and extracting its boundaries and triggering features (corresponding to the scenario description); replaying the generation path from question to answer and abstracting the step sequence and conditional branches (corresponding to the question-and-answer process); and forming reusable example items based on the question and high-quality answers (corresponding to positive sample examples). Therefore, differences in template fields will lead to corresponding changes in the inductive dimension and output structure of the reflection logic, thereby achieving a consistent closed loop of "template—reflection—generation."
[0074] The reflection prompts are structured instruction texts generated by the reflection intelligence module based on the reflection object and the inductive reflection logic. They instruct the baseline model to switch from generating answers to summarizing generation patterns and output structured results according to specified fields. The reflection prompts can clearly define the scope of induction (reflection object), limit the induction path (reflection logic), and specify the output format (corresponding component fields), enabling the baseline model to output content that can be directly filled into the prompt structure template. For example, the reflection prompts can require the model to output: the name and description of the target application scenario, the step-by-step question-and-answer process in that scenario, and one or more example entries of "question—key points—standard response," presented in a field-based format for easy automatic parsing and storage.
[0075] After obtaining the structured reflection results, the target scenario-based prompts can be generated through field backfilling. This involves embedding the content corresponding to each component field from the structured reflection results into the corresponding fields of the prompt structure template, forming complete prompt instances. For example, the summarized scenario boundaries and triggering features are filled into the scenario description field; the summarized step sequences and branching rules are filled into the process field; and the summarized high-quality example items are filled into the example field. If the template also includes compliance / style fields, constraints such as not promising benefits, not outputting sensitive information, and using a professional and concise tone are further added. The target scenario-based prompts generated in this way can be directly invoked after similar problems enter the routing process to stably guide the model output.
[0076] In summary, by standardizing the structure of prompt words using field-based templates, prompt words can be automatically generated, reused, and maintained. Furthermore, by summarizing and reflecting on the correct process, the implicit patterns of a high-quality question-and-answer session are transformed into explicit, reusable prompt assets, reducing the cost of manual writing and iteration. At the same time, the template fields are extensible, allowing the system to adapt simply by updating the field content when new scenarios or rule changes are added, thereby improving the system's responsiveness to new scenarios and sudden demands.
[0077] In one optional embodiment, the multiple group-layer element fields include, but are not limited to: element fields for defining scenario description information, element fields for defining positive sample examples, and element fields for defining the question-and-answer process. Based on this, the implementation method for determining the reflection object and reflection logic according to the element fields in the prompt word structure template includes: taking the scenario description, the generation of positive sample examples, and the generation of the question-and-answer process as reflection objects based on the element fields; taking the target application scenario and the question information as reflection constraints; executing a question-and-answer process without scenario-based prompt words based on the baseline model; and constructing an execution process including scenario description, data acquisition, inference replay, data structuring, and example generation to obtain the reflection logic.
[0078] The component element fields in the prompt word structure template are used to define the core content modules that contextual prompt words should include in a structured manner, thereby enabling contextual prompt words to be uniformly generated, stored, and updated. These component element fields include, but are not limited to: component element fields for defining scenario description information, component element fields for defining positive sample examples, and component element fields for defining the question-and-answer process. Specifically, the component element fields for defining scenario description information are fields used to carry indexal information about the target application scenario, such as scenario name, triggering conditions / keywords, applicable scope, scenario boundaries, and output requirements, to serve as an index when searching for scenario patterns; the component element fields for defining positive sample examples are fields used to carry reusable, high-quality example entries, which may include historical questions, corresponding historical templates / key reasoning points, and the final high-quality answer, to provide correct examples to the model; and the component element fields for defining the question-and-answer process are fields used to carry the step-by-step execution strategy under this scenario, such as information collection steps, rule judgment steps, abnormal branch handling steps, and closing actions, to constrain the model to generate answers according to a predetermined process.
[0079] In this embodiment, the scenario description is a structured depiction of the target application scenario, serving to provide an indexable scenario profile for scenario recognition and prompt word retrieval. For example, in the "after-sales service - damaged refund" scenario, the scenario description may include trigger words (damaged, broken, refused after-sales service, signed for, etc.), applicable boundaries (signing time limit, proof requirements), and output requirements (the operation path and risk warnings must be provided). The generation of positive sample examples refers to extracting a set of reusable sample examples from successful question-and-answer instances that have passed quality assessment and writing them into the example field in a structured form; these sample examples are positive sample examples, meaning they represent the correct handling method in this scenario. This part can be dynamically updated, for example, replacing or supplementing examples when new high-quality positive samples appear; it can also select representative examples based on factors such as positive example quality score, scenario suitability, and the recent proportion of questions in this scenario. The question-and-answer process refers to the reproducible execution steps (also known as execution strategies) that the model should follow in the target application scenario. It is used to abstract a successful answer into a transferable process template, such as "empathy and reassurance first → collect order and evidence → judge rules and time limits → provide the after-sales path → if the merchant refuses, guide the platform to intervene → prompt to retain vouchers and summarize the next step".
[0080] Furthermore, based on the aforementioned component fields, the scene description, the generation of positive sample examples, and the generation of the question-and-answer process are taken as reflection objects. These three types of content correspond to the three key fields of the prompt word structure template, which can directly form a mapping relationship between fields, products, and generation rules. The reflection results can be directly filled into the corresponding component fields to generate usable target scenario-based prompt words. At the same time, the generation of scene description, positive sample examples, and question-and-answer process covers three dimensions: scene index (scene description), demonstration sample (positive example), and execution constraint (process), respectively, which can systematically improve the stable response capability to subsequent similar questions without modifying the baseline model parameters.
[0081] In this embodiment, using the target application scenario and the problem information as reflection constraints means that the abstraction and generalization of structured reflection must be bounded by the fact that the problem belongs to that scenario, avoiding rule drift or example mismatch caused by cross-scenario generalization. The target application scenario is used to limit the scenario boundaries of the reflection output (e.g., a process rule for a financial management scenario should not be generated in an after-sales scenario), and the problem information is used to limit the semantic focus and problem type of the reflection output (e.g., the processing flow for damaged goods refunds is different from that for delayed shipments). By introducing reflection constraints, the generated scenario descriptions can be more indexable, the generated question-and-answer processes can be more closely aligned with the actual processing paths of such problems, and the generated positive sample examples can be more representative and reusable, thereby improving the usability and consistency of the target scenario-based prompts.
[0082] Furthermore, based on the baseline model, a question-and-answer process without contextual prompts is executed, constructing an execution process that includes scenario description, data acquisition, reasoning replay, data structuring, and example generation to obtain reflective logic. The reflective intelligent module does not generate template content out of thin air, but rather forms a traceable and reproducible inductive link based on the successful question-and-answer process of the baseline model under contextual prompts, thereby obtaining executable reflective logic.
[0083] Data acquisition refers to acquiring process data generated by the baseline model during the uncontextualized question-and-answer process, such as structured log records (e.g., model call information, retrieval hit information, key intermediate variables, step markers, etc.) or explicit thought chains / reasoning traces (in implementations where recording is permitted). Reasoning replay refers to reproducing the sequence of steps and key decision points from question information to the generation of the first answer information based on the aforementioned process data, in order to identify why the answer was successful and what key information and judgments it depended on. Data structuring refers to abstracting the unstructured process information obtained from the replay into a structured representation, such as extracting a list of mandatory fields, step sequences, conditional branching rules, exception handling strategies, and output format requirements, making it reusable content for question-and-answer process fields. Example generation refers to forming positive sample example entries (e.g., "question, key reasoning points, standard answer" triples or plurals) based on question information and the first answer information, and combining these with human evaluation, external model evaluation, or large model self-evaluation to determine their quality and whether to include them in the positive sample example field for subsequent dynamic updates.
[0084] For example, in the "After-sales - Damaged Goods" scenario, the user's question is, "I just received the package and found the cup is broken. The seller says they're not responsible after I signed for it, what should I do?" After the baseline model outputs the first answer without contextualized prompts and passes the quality assessment, the reflective intelligent module uses the target application scenario and the question information as constraints to acquire data and perform reasoning replay. It identifies key nodes that a successful response depends on (such as evidence collection, timeliness judgment, after-sales entry path, and platform intervention branches), and structures it into a question-and-answer process (empathy → collecting order / receipt time / photos or unpacking evidence → initiating after-sales service → platform intervention if refused → retaining evidence and next step). Simultaneously, the question information and standardized response are solidified as positive sample examples, generating an indexable scenario description (trigger words, boundary rules, output requirements), which are ultimately filled into the three component fields to form target contextualized prompts for stable output of similar damaged goods after-sales issues.
[0085] Based on the above mechanism, the scenario description field, as index information, can improve the efficiency of scenario retrieval and matching, and reduce cross-scenario misanswers. Furthermore, the question-and-answer process field solidifies the implicit experience of successful question-and-answer sessions into reusable execution strategies, improving the consistency of answer structure, the completeness of steps, and executability. Simultaneously, the positive sample example field provides a few-sample demonstration for the baseline model and can be dynamically updated, allowing prompts to continuously evolve with scenario changes without frequent manual rewriting. This improves system maintenance efficiency and reduces the cost of manual prompt iteration. Based on the above, an implementation method that instructs the baseline model to perform structured reflection on the question-and-answer process without scenario-based prompts, and generates target scenario-based prompts based on the structured reflection results, includes: inputting the reflection prompts into the baseline model, and performing the following structured reflection operations on the reflection object according to the reflection logic: Based on the question information, infer the target application scenario to which it belongs, and generate the scenario description information corresponding to the target application scenario; Obtain the structured log records or explicit thought chains generated by the baseline model during the execution of question-and-answer sessions without contextual prompts; based on the structured log records or explicit thought chains, replay the question-and-answer process from question information to the generation of the first answer information, and abstract, generalize and structure the question-and-answer process to obtain the question-and-answer flow in the target application scenario; Based on the question information and the first answer information, generate positive sample examples for the target application scenario; The scenario description information, positive sample examples, and question-and-answer process corresponding to the target application scenario are embedded into the corresponding component fields of the prompt word structure template to obtain the target scenario-based prompt words.
[0086] like Figure 4 The diagram shown illustrates the internal structure of another baseline model provided in this embodiment. In this example, the baseline model includes: a scene inference network, a process replay network, a process abstraction and generalization network, a process structuring network, a positive sample generation network, and a template filling network. Upon receiving the reflection prompts, the baseline model no longer performs input embedding or shared semantic encoding on the input. Instead, it directly uses the upstream obtained problem semantic representation (e.g., problem semantic vector, context representation, or structured features output by preceding modules) and the structured log records / explicit thought chains generated at runtime to complete structured reflection and target scene-based prompt generation.
[0087] based on Figure 4The baseline model's internal structure, as shown, provides a specific implementation method for instructing the baseline model to perform structured reflection on a question-and-answer process guided by unguided contextual prompts based on reflection prompts, and generating target contextual prompts based on the structured reflection results. This includes: inputting reflection prompts into the baseline model; within the baseline model, performing the following structured reflection operations on the reflection object according to reflection logic: inputting question information into a scenario inference network; inferring the target application scenario based on the question information and generating scenario description information corresponding to that scenario; and inputting the acquired structured log records or explicit thought chains generated by the baseline model during the question-and-answer process guided by unguided contextual prompts into a process replay network. The process replays the question-and-answer process from the question information to the first answer information; the question-and-answer process is input into the process abstraction and generalization network for abstraction and generalization to obtain a reusable execution strategy skeleton; the execution strategy skeleton is input into the process structuring network to structure the abstracted and generalized execution strategy into a question-and-answer flow under the target application scenario according to a preset schema; the question information and the first answer information are input into the positive sample example generation network to generate positive sample examples under the target application scenario based on the question information and the first answer information; the scenario description information, positive sample examples, and question-and-answer flow are input into the template to fill the network, and the corresponding component element fields in the prompt word structure template are embedded respectively to output the target scenario-based prompt words.
[0088] The scenario inference network is the inference module in the baseline model used to generate scenario description information. Under reflective constraints (target application scenario and problem information), it merges problems into searchable and indexable scenario patterns and outputs scenario descriptions that can be used for routing and retrieval. Scenario description information may include scenario name, triggering intent / keywords, scope of application, boundary rules, and output requirements, which are used to index the search in the prompt thesaurus. For example, when the problem information is "What to do if the product is damaged and the merchant refuses after-sales service", the scenario inference network can output a scenario description of "after-sales service - damage / quality problem - return / refund dispute", and provide triggering words (damage, receipt, refusal of after-sales service) and rule boundaries (proof requirements, time limits, platform intervention path).
[0089] The process replay network is a process parsing module in the baseline model used for data acquisition and inference replay. Its input is structured log records or explicit thought chains, and its output is a replayable question-and-answer process. The structured log records can be automatically generated by the baseline model when there are no contextual prompts to guide the question-and-answer process, or recorded by the system. The log records may include: input question, retrieval / calling information (if any), intermediate decision points, draft generation, correction actions, and the final first answer information. After parsing the above records, the process replay network reconstructs the process from question information to the generation of the first answer information in chronological or causal order, enabling subsequent modules to locate key steps and key decision points, thus providing traceable evidence for abstraction, generalization, and structuring.
[0090] The process abstraction generalization network is used to abstract and generalize the replayed question-and-answer process. Abstraction refers to extracting common steps and key decision points from specific question-and-answer instances, removing information strongly related to individual cases; generalization transforms the abstracted steps and decision points into generalized execution strategies that can cover similar problems, making them reusable to other problems in the target application scenario. For example, in the "after-sales" scenario, the execution strategy skeleton of "empathic reassurance → information collection → rule judgment → providing operation path → abnormal branch → closing prompt" is abstracted from a specific response in a certain instance and generalized into a unified process framework applicable to similar problems such as returns, refunds, and exchanges. Through the process abstraction generalization network, the correct process can be summarized, which is a form of inductive reflection rather than reverse thinking about shortcomings.
[0091] The process structured network is used to structure the abstracted and generalized execution strategy to output the question-and-answer process in the target application scenario. Structured processing refers to expressing the process using predefined fields and hierarchical structures. For example, the question-and-answer process can be represented as a sequence of steps, key inputs for each step, key outputs, conditional branches, and exception handling rules, making the results machine-readable, template-backfillable, and usable for subsequent consistency constraints. For instance, the process structured network can output structures like: Step 1: Empathy and reassurance; Step 2: Collect order number / receipt time / photo evidence; Step 3: Determine if within the after-sales timeframe; Step 4: Guide the user to initiate after-sales service and upload evidence on the order page; Step 5: If the merchant refuses, request platform intervention; Step 6: Remind the user to retain evidence and summarize the next step. Through structured output, the question-and-answer process no longer relies on natural language descriptions, which are difficult to reuse, thus improving the maintainability and elaboration of prompt templates.
[0092] The positive sample generation network generates positive sample examples for the target application scenario based on the question information and the first answer information. These positive sample examples may include: historical questions, key reasoning points (or key decision-making criteria), and the final standard response (i.e., the first answer information or its standardized version). In an optional implementation, the positive sample generation network can also standardize the answers. For example, it can standardize terminology, paragraph structure, and complete necessary prompt fields to provide stable sample examples for subsequent prompt guidance. Further optionally, the inclusion of positive sample examples in the sample library can be determined by combining manual evaluation, external model evaluation, or large model self-evaluation; and can be dynamically updated based on the quality of positive examples, their adaptability to the scenario, and the recent scenario proportion, thereby continuously injecting the latest high-quality practices into the sample library and achieving self-iterative optimization of the prompt template dimension.
[0093] The template filling network is an assembly module in the baseline model used to generate target contextualized prompts. It maps and embeds the structured reflection results into the corresponding component fields of the prompt structure template. Specifically, it fills the scene description field with the scene description information output by the scene inference network; fills the question-and-answer process field with the question-and-answer process field with the question-and-answer process output by the process structuring network; and fills the positive sample field with the positive sample example field with the positive sample example generation network. This results in the final target contextualized prompt. Because this assembly process fills in the prompts field by field, it enables template assembly, rapid updates, and cross-scene reuse, avoiding the high cost and inconsistency issues caused by manually writing entire prompts repeatedly.
[0094] Based on the internal structure of the baseline model mentioned above, the consistency, completeness, and executability of responses to similar questions can be improved. By replaying and structuring structured logs / explicit thought chains, the prompt word generation process becomes traceable and maintainable, thereby enhancing the overall system stability.
[0095] Branch 2: If a target contextualized prompt word corresponding to the target application scenario is matched in the prompt word library, the routing intelligence module 202 can input the question information and the target contextualized prompt word into the baseline model 204. The baseline model 204 then performs question-and-answer processing guided by the target contextualized prompt word to obtain the second answer information. In this process, the baseline model 204 is called by the routing intelligence module 202 and undertakes the question-and-answer task guided by the contextualized prompt word. For example... Figure 2 As shown, after obtaining the second answer information, the second answer information can be output through the human-computer interaction module 201.
[0096] In this embodiment of the application, the specific implementation method of the baseline model 204 performing question-and-answer processing guided by the target contextual prompts to obtain the second answer information is not limited. It can be flexibly implemented in combination with the implementation structure of the target contextual prompts.
[0097] In one optional embodiment, the target contextualized prompts are structured to fully guide the baseline model 204 in generating high-quality answer information within the target application scenario. The target contextualized prompts include scenario description information corresponding to the target application scenario, positive sample examples within that target application scenario, and the question-and-answer process within that target application scenario.
[0098] The scenario description information is a general description of the target application scenario, used to enable the baseline model 204 to understand its current context and role. This section may include the following elements: Scenario name: such as "credit card loss reporting", "password reset", "complaint handling", etc., clearly specifying the category of the target application scenario; Role definition: Clarify the role that baseline model 204 should play in this target application scenario, such as "bank customer service specialist", "technical support personnel", "complaint specialist", etc. Task Objectives: Describe the core tasks that baseline model 204 needs to complete in the target application scenario, such as "guiding users to complete the credit card loss reporting", "assisting users to reset their passwords", and "initiating and executing the complaint process". Tone and style: Specifies the tone and expression that the baseline model 204 should use when generating answers, such as "professional and patient", "gentle and empathetic", "concise and clear"; Note: The baseline model 204 highlights key points that require special attention during the answer generation process, such as compliance requirements and handling of sensitive topics.
[0099] Based on the above, an example of scenario description information would be: "You are a bank customer service representative, and the current scenario is a user reporting a lost credit card. Please handle the user's request with a professional and patient attitude. Be careful to avoid causing the user anxiety and do not ask for the user's password or verification code or other sensitive information." Positive sample examples are high-quality question-answer pair demonstrations provided for the target application scenario. They are used to show the baseline model 204 the style and standards of ideal answers in the target application scenario. This part can include one or more question information that can serve as positive samples and their corresponding standard answer information. Positive sample examples can provide the baseline model 204 with a reference paradigm, allowing it to understand the structure, length, and level of detail of answer information in the target application scenario. They can also demonstrate key elements to the baseline model 204, showing it which core information should be included in the answer information. Furthermore, they can standardize the expression of the baseline model 204, ensuring that the answer information output by the baseline model 204 conforms to the tone, wording, and expression habits required by the scenario.
[0100] The question-and-answer process is a sequence of steps that the baseline model 204 should follow when performing question-and-answer tasks. It standardizes the logical structure and processing order of generating answer information. This part can be presented in the form of a step list, flowchart, or pseudocode, clearly defining the operations and precautions to be taken at each stage. The question-and-answer process can standardize the logic of the baseline model 204 in generating answer information, ensuring that answer information is generated in a reasonable order and avoiding logical confusion. It can also guide the baseline model 204 to cover necessary information and not omit important information during the process of generating answer information. Furthermore, it can clarify the relevant time in the process of generating answer information, such as when to ask the question, when to inform, and when to confirm, ensuring that the answer information is more natural and fluent.
[0101] Based on the above implementation structure of the target contextualized prompt, an implementation method that inputs question information and the target contextualized prompt into a baseline model, performs question-and-answer processing guided by the target contextualized prompt, and obtains second answer information includes: inputting question information and the target contextualized prompt into a baseline model 204, and performing the following operations in the baseline model 204: Based on the scenario description information of the target application scenario, model roles, task context, and scenario boundary constraints are configured. The question-answering process is encoded into step-by-step reasoning instructions, and the structural paradigms and domain representations in the positive sample examples are parsed. Using the configured model roles, the step-by-step reasoning instructions are executed according to the task context and scenario boundary constraints to obtain intermediate reasoning results. The structural paradigms and domain representations in the positive sample examples are reused to standardize and structure the intermediate reasoning results to obtain the second answer information. In this implementation, by using scenario constraints, step-by-step reasoning, and paradigm reuse, the accuracy, logic, and standardization of the second answer information can be improved.
[0102] like Figure 5 The diagram shown illustrates the internal structure of another baseline model provided in this embodiment. In this example, the baseline model includes: a scenario constraint configuration module, a process instruction compilation module, an example paradigm parsing module, a step-by-step reasoning execution module, and an answer normalization generation module.
[0103] based on Figure 5 The baseline model shown has an internal structure. A specific implementation method for inputting question information and target contextualized prompts into the baseline model and performing question-and-answer processing guided by the target contextualized prompts to obtain a second answer includes: inputting question information and target contextualized prompts into the baseline model; within the baseline model: inputting the scenario description information from the target contextualized prompts into a scenario constraint configuration module to read the scenario description information and configure model roles, task contexts, and scenario boundary constraints; inputting the question-and-answer flow from the target contextualized prompts into a flow instruction compilation module to convert the question-and-answer flow into executable step-by-step inference instructions; inputting the positive sample examples from the target contextualized prompts into an example paradigm parsing module to parse the positive sample examples and obtain structural paradigms and domain representations; after the above configuration is completed, inputting the model roles, task contexts, scenario boundary constraints, and step-by-step inference instructions into a step-by-step inference execution module to gradually produce intermediate inference results according to the step-by-step inference instructions; inputting the question information, intermediate inference results, structural paradigms, and domain representations into an answer normalization generation module, reusing the example paradigms and domain representations to normalize and structure the intermediate inference results, and outputting the second answer information.
[0104] The scenario constraint configuration module is the configuration module responsible for scenario description information in the baseline model. It is used to convert scenario description information into control signals that can constrain the generation process, including at least: model role (e.g., "bank customer service representative"), task context (e.g., "guide users to complete credit card loss reporting"), and scenario boundary constraints (e.g., "do not ask for passwords or verification codes, do not guide users to disclose sensitive information"). The model role is the set of identities / positions / styles and permissions that the model is required to play in the dialogue, determining its position, tone, and what it can and cannot do when responding. For example: you are a "customer service assistant," "legal advisor-style assistant," "classroom teacher," "code reviewer," etc. The task context is a set of background information and constraints provided to complete a specific task, answering "what problem you are solving, why you are solving it, and what the output should look like." It can include: task objectives, input materials, expected output format, target audience, time frame, success criteria (e.g., "provide 3 executable solutions and label the risks"), etc. Scene boundary constraints are a set of rules defining what actions are prohibited and what boundaries cannot be crossed within a given scene. These boundaries can include: information boundaries (no fabrication, no privacy breaches), capability boundaries (no promises of offline operation, no continuous background tracking), security boundaries (no providing illegal / dangerous guidance), resource boundaries (no access to unconnected data sources), and time boundaries (only information provided in the dialogue or from searchable sources is allowed). This module ensures that the baseline model maintains consistent context and boundaries with the target application scenario during subsequent generation, preventing cross-scenario wording, unauthorized suggestions, or non-compliant responses.
[0105] The process instruction compilation module is the process transformation module in the baseline model responsible for making the question-and-answer process executable. It converts the question-and-answer process from natural language step descriptions, pseudocode, or flowcharts into step-by-step reasoning instructions that the model can directly execute. Step-by-step reasoning instructions clearly define the objectives to be achieved at each step, the key information points to be collected, the rule judgments to be triggered, and the conditions for jumping to the next step. For example, "first confirm whether the user can log in → then verify identity → then guide the user to report the loss → prompt risk and subsequent re-issuance" can be compiled into a sequence of instructions from Step 1 to Step N. Each step is further supplemented with elements such as "mandatory fields," "conditional branches (if the user cannot log in, follow alternative paths)," and "closing actions," ensuring that the generation process proceeds in a logical order and covers necessary information, reducing the probability of omissions and logical confusion.
[0106] The example paradigm parsing module, within the baseline model, is responsible for reusing positive sample examples. It extracts reusable answer paradigms and domain-specific expressions from these examples. The answer paradigm can include an answer structure template, a key element coverage list, and domain-specific fixed terms. For example, an answer structure template might include empathetic reassurance, core steps, precautions, and next steps. Similarly, a key element coverage list in a lost card reporting scenario might include emergency loss mitigation measures, reporting procedures, replacement card path, and fee / time-sensitive reminders. Domain-specific fixed terms might include phrases like "to ensure account security," "we suggest you do it immediately," or "if the merchant refuses, you can apply for platform intervention." Domain-specific expressions refer to the way content is expressed using language and notation common in a specific domain. Through the example paradigm parsing module, the baseline model learns not only what to say but also how to say it and in what structure, thereby improving the standardization and stability of the second answer information.
[0107] The step-by-step reasoning execution module is the execution module in the baseline model responsible for generating intermediate reasoning results according to the process. Under the combined action of role / boundary constraints output by the scenario constraint configuration module and step-by-step instructions output by the process instruction compilation module, it gradually completes information alignment and decision advancement. The step-by-step reasoning execution module can output corresponding intermediate reasoning results at each generation stage. For example: Step 1 outputs "Confirm the urgency level and reassure the user"; Step 2 outputs "Need to confirm whether fraudulent transactions have occurred, whether the app can be logged in, and whether the location is domestic / overseas"; Step 3 outputs "Provide the card replacement path and alternative paths"; Step 4 outputs "Provide card replacement and fee / time reminders"; Step 5 outputs "Security reminder and confirmation of whether a human agent is needed". These intermediate reasoning results can be used as explicit intermediate products for subsequent module integration, or as implicit control signals to directly drive the generation of the final second answer information.
[0108] The answer normalization generation module is the expression assembly module in the baseline model responsible for forming the final second answer information. It organizes the intermediate reasoning results obtained from the step-by-step reasoning execution module according to the structural paradigm extracted by the example paradigm parsing module, and performs language polishing and structured output under the tone style and boundary rule constraints of the scenario constraint configuration module. The answer normalization generation module can transcribe the intermediate reasoning results into user-readable final response text and output it in a pre-defined format, such as paragraph-style, numbered, or field-style answer. For example, it can output the structure of executable steps, precautions, information requiring user supplementation, and next step suggestions to ensure that the second answer information is more natural, fluent, and operable.
[0109] Based on the internal structure of the baseline model, the order of answer generation and the completeness of information coverage can be improved. Example paradigm parsing enables the reuse of positive sample expression paradigms and domain terminology, thereby improving the standardization, consistency and readability of the output.
[0110] Further optional, such as Figure 2 As shown, after obtaining the second answer information, the target contextualized prompt words can be iteratively optimized based on the second answer information, question information, and / or target application scenario, and the optimized contextualized prompt words can be updated to the prompt word library. It should be noted that the optimization here mainly refers to the process of optimizing the target contextualized prompt words.
[0111] In this embodiment, the execution entity for iteratively optimizing the target contextualized prompts is not limited; for example, it could be the baseline model 204, the reflection intelligence module 203, or the routing intelligence module 202. Furthermore, this embodiment does not limit the specific implementation method for iteratively optimizing the target contextualized prompts; it can be combined with the implementation structure of the target contextualized prompts to support optimization of at least a portion of the content within the target contextualized prompts.
[0112] Optionally, taking the target contextualized prompt word as including the scenario description information corresponding to the target application scenario, the positive sample example under the target application scenario, and the question-and-answer process under the target application scenario as an example, at least part of the scenario description information, positive sample example, and question-and-answer process in the target contextualized prompt word can be optimized based on the second answer information, question information, and / or target application scenario.
[0113] For example, new positive sample examples can be generated based on the second answer information and question information, and these new positive sample examples can be used to update the positive sample examples in the target contextualized prompts. Further, optionally, before updating the positive sample examples in the target contextualized prompts with new positive sample examples, it can be determined whether to update the positive sample examples in the target contextualized prompts based on the quality of the positive sample examples or their fit with the contextual description information. If the quality of the positive sample examples is lower than a set quality threshold or lower than the quality of the new positive sample examples, or if the fit between the positive sample examples and the contextual description information is lower than a set fit threshold or lower than the fit between the new positive sample examples and the contextual description information, then it is determined that the positive sample examples in the target contextualized prompts need to be updated. Alternatively, the most recently occurring application scenario can be determined based on the proportion of application scenarios to which multiple recent question information belongs. If the fit between the current positive sample example and the most recently occurring application scenario is low, then the question information and answer information with a higher fit with the most recently occurring application scenario are selected as new positive sample examples and used to update the positive sample examples in the target contextualized prompts.
[0114] For example, new scene description information can be generated based on scene analysis of the target application scenario. This new scene description information is then compared with the scene description information in the target contextualized prompts to determine the differences between them. The scene description information in the target contextualized prompts is then updated based on these differences. Updating the scene description information in the target contextualized prompts includes adding new information, deleting some information, or modifying some information.
[0115] For example, new scenario description information can be generated based on scenario analysis of the target application scenario. Based on the new scenario description information, a new question-and-answer process can be generated, and the answer information corresponding to the question information can be generated according to the new question-and-answer process. If the quality of the answer information is higher than that of the second answer information, the question-and-answer process in the target scenario-based prompt words can be updated using the new question-and-answer process.
[0116] In the above embodiments, through iterative optimization of the target contextualized prompts, the contextualized prompts can automatically evolve as the complexity of the question-and-answer task changes or new application scenarios emerge, maintaining a better guiding state and avoiding the problem of failing to correctly guide the baseline model over time, thus leading to a decline in the performance of the baseline model.
[0117] In one optional embodiment, if the first answer fails the multi-dimensional quality assessment, the question information is re-input into the baseline model, and question-and-answer processing without contextual prompts is performed until the first answer passes the multi-dimensional quality assessment or the retry limit is reached. When the first answer fails the multi-dimensional quality assessment, the system does not output it directly, but instead re-inputs the same question into the baseline model repeatedly until the answer meets the standard or the retry limit is reached. This reduces issues such as off-topic or arbitrary conclusions caused by role setting / application scenario packaging, thereby improving the stability and controllability of the first answer information. Simultaneously, setting a retry limit prevents infinite loops and controls costs and latency.
[0118] In one optional embodiment, before re-inputting the question information into the baseline model, the method further includes: generating quality optimization guidance words based on the target quality dimension that the first answer information failed the evaluation, and injecting the quality optimization guidance words into the question information; wherein, the quality optimization guidance words are used to guide the baseline model to specifically improve the performance of the first answer information on the target quality dimension when regenerating the first answer information.
[0119] The target quality dimensions are the specific sets of dimensions that failed to meet the standards in the multi-dimensional quality assessment, causing the first answer to fail. This isn't a general case of poor quality, but rather a clear indication of where the deficiency lies. For example, the first answer might fail in completeness (whether it covers all problem points) or logical consistency (whether it is contradictory). These identified failures are the target quality dimensions that need to be prioritized for improvement in the next round. The quality optimization guidance text is an automatically generated prompt / constraint text designed to improve specific target quality dimensions. It can also be understood as a targeted correction prompt, transforming the failed dimensions into actionable rewrite requirements for the model, giving it a clear direction for improvement during retrying. Based on this approach, the pass rate for generating the first answer can be increased, the number of retries reduced, and ultimately, a more stable and compliant first answer can be output. In this embodiment, prompt word optimization is deeply integrated into the question-and-answer process. Without relying on external models, it can leverage the collaboration between multiple intelligent modules to directly execute question-and-answer processing without contextual prompt words when the prompt word library does not contain contextual prompt words corresponding to the application scenario of the question information. Furthermore, by utilizing the reflective capabilities of the baseline model, it can perform structured reflection on the question-and-answer process without contextual prompt words, generating new contextual prompt words and achieving automatic prompt word optimization. This optimization process requires no manual intervention, which helps improve the efficiency of prompt word optimization and reduce labor costs.
[0120] Figure 6 This is a flowchart illustrating a prompt word optimization method integrated into a question-and-answer process, provided as an embodiment of this application. Figure 6 As shown, the method includes: S601, Receive problem information; S602. The intelligent routing module is used to perform scene recognition based on semantic understanding of the problem information, and the target application scenario is matched in the prompt word library based on the identified target application scenario. The prompt word library includes multiple scenario-based prompt words and their corresponding application scenarios. S603. If no target contextual prompt word is matched with the target application scenario, the question information is directly input into the baseline model, and question-and-answer processing without contextual prompt word guidance is performed on the question information to obtain the first answer information. S604. Use the reflection intelligence module to perform multi-dimensional quality assessment on the first answer information. If the first answer information passes the multi-dimensional quality assessment, instruct the baseline model to perform structured reflection on the question-and-answer process without contextual prompts, and generate target contextual prompts based on the structured reflection results. S605. Update the target contextualized prompt words and target application scenarios to the prompt word library, and output the first answer information.
[0121] The detailed implementation methods and beneficial effects of each step in this embodiment have been described in detail in the foregoing embodiments, and will not be elaborated here.
[0122] Furthermore, in some of the processes described in the above embodiments and accompanying drawings, multiple operations appear in a specific order. However, it should be clearly understood that these operations may not be executed in the order they appear herein, or they may be executed in parallel. The operation numbers, such as 601, 602, etc., are merely used to distinguish different operations and do not represent any execution order. Additionally, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel. It should be noted that the descriptions such as "first" and "second" in this document are used to distinguish different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to different types.
[0123] Figure 7 This is a schematic diagram of a prompt word optimization device provided in an embodiment of this application. Figure 7 As shown, the device includes: The human-computer interaction module 701 receives question information and provides it to the routing intelligence module 702. The routing intelligence module 702 performs semantic understanding-based scene recognition on the question information and matches it against a prompt word library based on the identified target application scenario. The prompt word library includes multiple scenario-based prompt words and their corresponding application scenarios. If no target scenario-based prompt word is matched with the target application scenario, the question information is directly input into the baseline model, and question-and-answer processing without scenario-based prompt words is performed to obtain the first answer information. The reflection intelligence module 703 performs multi-dimensional quality evaluation on the first answer information. If the first answer information passes the multi-dimensional quality evaluation, it instructs the baseline model to perform structured reflection on the question-and-answer process without scenario-based prompt words and generates target scenario-based prompt words based on the structured reflection results. It also updates the target scenario-based prompt words and target application scenarios to the prompt word library. The human-computer interaction module 701 is also used to output the first answer information.
[0124] Optionally, the reflection intelligence module 703 instructs the baseline model to perform structured reflection on the question-and-answer process without contextualized prompts, and generates target contextualized prompts based on the structured reflection results. Specifically, it is used to: obtain the prompt structure template corresponding to the contextualized prompts, the prompt structure template including multiple component fields, the component fields being used to define the components of the contextualized prompts; determine the reflection object and reflection logic based on the component fields in the prompt structure template; generate reflection prompts based on the reflection object and reflection logic; and, based on the reflection prompts, instruct the baseline model to perform structured reflection on the question-and-answer process without contextualized prompts, and generate target contextualized prompts based on the structured reflection results.
[0125] Optionally, the reflection intelligence module 703 includes at least the following component fields: a component field for defining scenario description information, a component field for defining positive sample examples, and a component field for defining the question-and-answer process; based on the component fields in the prompt word structure template, it determines the reflection object and reflection logic, specifically: based on the component fields, it takes the scenario description, the generation of positive sample examples, and the generation of the question-and-answer process as the reflection object; it takes the target application scenario and question information as reflection constraints, executes a question-and-answer process without scenario-based prompt words based on the baseline model, and constructs an execution process including scenario description, data acquisition, inference playback, data structuring, and example generation to obtain the reflection logic.
[0126] Optionally, the reflection intelligence module 703, based on the reflection prompts, instructs the baseline model to perform structured reflection on the question-and-answer process guided by undefined contextual prompts, and generates target contextual prompts based on the structured reflection results. Specifically, it is used to: input the reflection prompts into the baseline model, and perform the following structured reflection operations on the reflection object according to the reflection logic: infer the target application scenario to which the question belongs based on the question information, and generate the scenario description information corresponding to the target application scenario; obtain the structured log records or explicit thought chains generated by the baseline model during the question-and-answer process guided by undefined contextual prompts; replay the question-and-answer process from the question information to the generation of the first answer information based on the structured log records or explicit thought chains, and abstract, generalize, and structure the question-and-answer process to obtain the question-and-answer flow under the target application scenario; generate positive sample examples under the target application scenario based on the question information and the first answer information; and embed the scenario description information, positive sample examples, and question-and-answer flow corresponding to the target application scenario into the corresponding component fields in the prompt structure template to obtain the target contextual prompts.
[0127] Optionally, the routing intelligence module 702 performs scene recognition based on semantic understanding on the question information and matches it in the prompt word library based on the identified target application scenario. Specifically, it is used to: input the question information into the routing intelligence module and encode the question information into a question semantic vector using a domain adaptive semantic encoder; calculate the semantic similarity between the question semantic vector and the scene prototype vector of the existing application scenario in the prompt word library, and determine candidate application scenarios from the existing application scenarios in the prompt word library based on the semantic similarity; calculate the matching confidence between the question semantic vector and the candidate application scenario based on the local density or prediction stability of the question semantic vector in the neighborhood of the candidate application scenario; if the matching confidence is less than a preset confidence threshold, generate a new application scenario as the target application scenario based on the question semantic vector, and there is no target scenario-based prompt word in the prompt word library corresponding to the target application scenario; if the matching confidence is greater than or equal to the preset confidence threshold, use the candidate application scenario as the target application scenario, and use the scenario-based prompt word in the prompt word library corresponding to the candidate application scenario as the target scenario prompt word.
[0128] Optionally, the routing intelligence module 702 uses the candidate application scenario as the target application scenario, specifically: calling the baseline model, and performing a binary classification judgment on whether the problem information belongs to the candidate application scenario based on the problem semantic vector and the scenario prototype vector of the candidate application scenario; if the binary classification judgment result is yes, then the candidate application scenario is used as the target application scenario.
[0129] Optionally, the reflection intelligence module 703 performs a multi-dimensional quality assessment of the first answer information, specifically for: assessing the accuracy of factual content in the first answer information based on a preset domain factual knowledge base; assessing the completeness of information dimensions covered by the first answer information based on the answer information dimensions required by the question information, whereby answer information dimensions include key elements, necessary explanations, risk warnings, and / or action suggestions; assessing the logical consistency between the various information statements included in the first answer information to evaluate whether there are contradictions, circular arguments, or reasoning breaks; assessing the fit between the first answer information and the question information based on at least one of the intent information, topic information, and expression style of the first answer information; and assessing the compliance and security of the first answer information based on compliance information.
[0130] Optionally, the routing intelligence module 702 is further configured to: if a target contextualized prompt word is matched, input the question information and the target contextualized prompt word into the baseline model, perform question-and-answer processing guided by the target contextualized prompt word, and obtain the second answer information; iteratively optimize the target contextualized prompt word based on the second answer information, the question information, and / or the target application scenario, and update the optimized contextualized prompt word to the prompt word library.
[0131] Optionally, the routing intelligence module 702 includes target scenario-based prompts, which include scenario description information, positive sample examples, and question-and-answer processes corresponding to the target application scenario. The module inputs the question information and target scenario-based prompts into the baseline model and performs question-and-answer processing guided by the target scenario-based prompts to obtain second answer information. Specifically, this involves: inputting the question information and target scenario-based prompts into the baseline model and performing the following operations within the baseline model: configuring model roles, task contexts, and scenario boundary constraints based on the scenario description information; encoding the question-and-answer process into step-by-step inference instructions; parsing the structural paradigms and domain representations in the positive sample examples; executing step-by-step inference instructions based on the task context and scenario boundary constraints using the model role to obtain intermediate inference results; and reusing the structural paradigms and domain representations in the positive sample examples to standardize and structure the intermediate inference results to obtain second answer information.
[0132] Optionally, the reflection intelligence module 703 is also used to: if the first answer information fails the multi-dimensional quality assessment, re-input the question information into the baseline model, perform question-and-answer processing without contextual prompts for the question information, until the first answer information passes the multi-dimensional quality assessment, or the maximum number of retries is reached.
[0133] Optionally, the reflective intelligence module 703 is also used to generate quality optimization guidance words based on the target quality dimension that the first answer information failed to evaluate before re-inputting the question information into the baseline model, and inject the quality optimization guidance words into the question information; wherein, the quality optimization guidance words are used to guide the baseline model to specifically improve the performance of the first answer information on the target quality dimension when regenerating the first answer information.
[0134] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 8 As shown, in practice, this electronic device includes a memory 84 and a processor 85.
[0135] Memory 84 is used to store computer programs and can be configured to store various other data to support operation of the electronic device. Examples of this data include instructions for any application or method operating on a computing platform, question information, contextual prompts, first-answer information, etc.
[0136] The processor 85, coupled to the memory 84, executes the computer program in the memory 84 for: receiving question information; performing semantic understanding-based scene recognition on the question information using a routing intelligence module, and matching the identified target application scenario in a prompt word library, which includes multiple scenario-based prompt words and their corresponding application scenarios; if no target scenario-based prompt word corresponding to the target application scenario is matched, the question information is directly input into the baseline model, and question-and-answer processing without scenario-based prompt words is performed on the question information to obtain the first answer information; the first answer information is subjected to multi-dimensional quality evaluation using a reflection intelligence module; if the first answer information passes the multi-dimensional quality evaluation, the baseline model is instructed to perform structured reflection on the question-and-answer process without scenario-based prompt words, and generate target scenario-based prompt words based on the structured reflection results; the target scenario-based prompt words and target application scenarios are updated to the prompt word library, and the first answer information is output.
[0137] In one optional embodiment, the processor 85 instructs the baseline model to perform structured reflection on the question-and-answer process without contextualized prompts, and generates target contextualized prompts based on the structured reflection results. This includes: obtaining a prompt structure template corresponding to the contextualized prompt, the prompt structure template including multiple component fields, the component fields being used to define the components of the contextualized prompt; determining the reflection object and reflection logic based on the component fields in the prompt structure template; generating reflection prompts based on the reflection object and reflection logic; and instructing the baseline model to perform structured reflection on the question-and-answer process without contextualized prompts based on the reflection prompts, and generating target contextualized prompts based on the structured reflection results.
[0138] In an optional embodiment, the component element fields include at least: a component element field for defining scenario description information, a component element field for defining positive sample examples, and a component element field for defining the question-and-answer process; the processor 85 determines the reflection object and reflection logic based on the component element fields in the prompt word structure template, including: taking the scenario description, the generation of positive sample examples, and the generation of the question-and-answer process as reflection objects based on the component element fields; taking the target application scenario and question information as reflection constraints, executing a question-and-answer process without scenario-based prompt words based on the baseline model, and constructing an execution process including scenario description, data acquisition, inference playback, data structuring, and example generation to obtain the reflection logic.
[0139] In an optional embodiment, the processor 85 instructs the baseline model to perform structured reflection on the question-and-answer process guided by unguided contextual prompts based on the reflection prompts, and generates target contextual prompts based on the structured reflection results. This includes: inputting the reflection prompts into the baseline model, and performing the following structured reflection operations on the reflection object according to the reflection logic: inferring the target application scenario to which the question belongs based on the question information, and generating scenario description information corresponding to the target application scenario; obtaining the structured log records or explicit thought chains generated by the baseline model during the question-and-answer process guided by unguided contextual prompts; replaying the question-and-answer process from the question information to the generation of the first answer information based on the structured log records or explicit thought chains, and abstracting, generalizing, and structuring the question-and-answer process to obtain the question-and-answer flow under the target application scenario; generating positive sample examples under the target application scenario based on the question information and the first answer information; and embedding the scenario description information, positive sample examples, and question-and-answer flow corresponding to the target application scenario into the corresponding component fields in the prompt structure template to obtain the target contextual prompts.
[0140] In an optional embodiment, the processor 85 utilizes a routing intelligence module to perform scene recognition based on semantic understanding on the question information, and matches it against a prompt word library based on the identified target application scenario. This includes: inputting the question information into the routing intelligence module, encoding the question information into a question semantic vector using a domain-adaptive semantic encoder; calculating the semantic similarity between the question semantic vector and the scene prototype vectors of existing application scenarios in the prompt word library, and determining candidate application scenarios from the existing application scenarios in the prompt word library based on the semantic similarity; calculating the matching confidence between the question semantic vector and the candidate application scenario based on the local density or prediction stability of the question semantic vector in the neighborhood of the candidate application scenario; if the matching confidence is less than a preset confidence threshold, generating a new application scenario as the target application scenario based on the question semantic vector, and there is no target scenario-based prompt word in the prompt word library corresponding to the target application scenario; if the matching confidence is greater than or equal to the preset confidence threshold, using the candidate application scenario as the target application scenario, and using the scenario-based prompt word in the prompt word library corresponding to the candidate application scenario as the target scenario-based prompt word.
[0141] In an optional embodiment, the processor 85 uses the candidate application scenario as the target application scenario, including: calling the baseline model, and performing a binary classification judgment on whether the problem information belongs to the candidate application scenario based on the problem semantic vector and the scenario prototype vector of the candidate application scenario; if the binary classification judgment result is yes, then the candidate application scenario is used as the target application scenario.
[0142] In an optional embodiment, the processor 85 utilizes a reflective intelligence module to perform a multi-dimensional quality assessment of the first answer information, including performing at least two of the following assessment operations: assessing the accuracy of factual content in the first answer information based on a preset domain factual knowledge base; assessing the completeness of information dimensions covered by the first answer information based on the answer information dimensions required by the question information, where the answer information dimensions include key elements, necessary explanations, risk warnings, and / or action suggestions; assessing the logical consistency between the various information statements included in the first answer information to evaluate whether there are contradictions, circular arguments, or reasoning breaks; assessing the fit between the first answer information and the question information based on at least one of the intent information, topic information, and expression style of the first answer information; and assessing the compliance and security of the first answer information based on compliance information.
[0143] In an optional embodiment, if the processor 85 matches a target contextualized prompt word, it inputs the question information and the target contextualized prompt word into the baseline model, performs question-and-answer processing guided by the target contextualized prompt word, and obtains the second answer information; based on the second answer information, the question information and / or the target application scenario, it iteratively optimizes the target contextualized prompt word, and updates the optimized contextualized prompt word to the prompt word library.
[0144] In one optional embodiment, the target contextualized prompt includes scenario description information corresponding to the target application scenario, positive sample examples, and a question-and-answer process. The processor 85 inputs the question information and the target contextualized prompt into the baseline model, performs question-and-answer processing guided by the target contextualized prompt, and obtains the second answer information. This includes: inputting the question information and the target contextualized prompt into the baseline model, and performing the following operations in the baseline model: configuring model roles, task contexts, and scenario boundary constraint information according to the scenario description information; encoding the question-and-answer process into step-by-step inference instructions; parsing the structural paradigms and domain expressions in the positive sample examples; executing the step-by-step inference instructions according to the task context and scenario boundary constraint information in the model role to obtain intermediate inference results; reusing the structural paradigms and domain expressions in the positive sample examples to standardize and structure the intermediate inference results to obtain the second answer information.
[0145] In an optional embodiment, if the first answer information fails the multi-dimensional quality assessment, the processor 85 re-inputs the question information into the baseline model and performs question-and-answer processing without contextual prompts until the first answer information passes the multi-dimensional quality assessment or the maximum number of retries is reached.
[0146] In an optional embodiment, before re-inputting the question information into the baseline model, the processor 85 further includes: generating quality optimization guidance words based on the target quality dimension that the first answer information failed to evaluate, and injecting the quality optimization guidance words into the question information; wherein, the quality optimization guidance words are used to guide the baseline model to specifically improve the performance of the first answer information on the target quality dimension when regenerating the first answer information.
[0147] Furthermore, such as Figure 8 As shown, the electronic device also includes other components such as a communication component 86, a display 87, a power supply component 88, and an audio component 89. Figure 8 The diagram only shows some components and does not mean that the electronic device includes only these components. Figure 8 The components shown. Additionally... Figure 8 The components within the dashed box are optional, not mandatory, and their specific requirements depend on the product form of the work node. In this embodiment, the work node can be a terminal device such as a desktop computer, laptop computer, smartphone, or IoT device, or a server-side device such as a conventional server, cloud server, or server array. If the work node in this embodiment is implemented as a terminal device such as a desktop computer, laptop computer, or smartphone, it may include... Figure 8 The components within the dashed box; if the working node in this embodiment is implemented as a server-side device such as a conventional server, cloud server, or server array, it may be omitted. Figure 8 The component within the dashed box.
[0148] The aforementioned memory 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.
[0149] The aforementioned communication component is configured to facilitate wired or wireless communication between the device containing the communication component and other devices. The device containing the communication component can access wireless networks based on communication standards, such as 2G, 3G, 4G / LTE, 5G, or combinations thereof. In one exemplary embodiment, the communication component receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel.
[0150] The aforementioned display includes a screen, which may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a Touch Panel, the screen can be implemented as a touchscreen to receive input signals from the user. The Touch Panel includes one or more touch sensors to sense touches, swipes, and gestures on the Touch Panel. The touch sensors can sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation.
[0151] The aforementioned power supply components provide power to various components within the device in which they reside. These power supply components may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device in which they reside.
[0152] The aforementioned audio component can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC) configured to receive external audio signals when the device containing the audio component is in an operating mode, such as call mode, recording mode, or voice recognition mode. The received audio signals can be further stored in memory or transmitted via a communication component. In some embodiments, the audio component also includes a speaker for outputting audio signals.
[0153] Accordingly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to implement the steps in the above-described method embodiments. The computer-readable storage medium includes volatile or non-volatile components, or a combination thereof, and can be removable or non-removable. Examples of computer-readable storage media include, but are not limited to, phase-change random access memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random-access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), flash memory or other memory technologies, CD-ROM, Digital Video Disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium. Accordingly, this application also provides a computer program product, which includes a computer program or instructions that, when executed by a processor, cause the processor to implement the steps in the above method embodiments. It should be understood that each step or combination of steps in the above method flow can be implemented by the computer program or instructions. Furthermore, these computer programs or instructions can be applied to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device, enabling the processor of the general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to function as an apparatus for implementing the corresponding functions in the above method embodiments.
[0154] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0155] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method for optimizing prompt words integrated into a question-and-answer process, characterized in that, Applied to an intelligent question-answering system, the system comprising: a routing intelligence module, a reflective intelligence module, and a baseline model deployed in a production environment, the method comprising: Receive problem information; The routing intelligence module is used to perform scene recognition based on semantic understanding on the problem information, and to match the identified target application scenario in the prompt word library. The prompt word library includes multiple scenario-based prompt words and their corresponding application scenarios. If no target contextual prompt word is matched with the target application scenario, the question information is directly input into the baseline model, and question-and-answer processing without contextual prompt word guidance is performed on the question information to obtain the first answer information; The reflection intelligence module is used to perform a multi-dimensional quality assessment on the first answer information. If the first answer information passes the multi-dimensional quality assessment, the baseline model is instructed to perform a structured reflection on the question-and-answer process without contextual prompts, and generate the target contextual prompts based on the structured reflection results. The target contextualized prompt words and the target application scenario are updated to the prompt word library, and the first answer information is output.
2. The method according to claim 1, characterized in that, The baseline model is instructed to perform structured reflection on the question-and-answer process without contextualized prompts, and to generate the target contextualized prompts based on the results of the structured reflection, including: Obtain the prompt word structure template corresponding to the contextual prompt word. The prompt word structure template includes multiple component element fields, which are used to define the component elements of the contextual prompt word. Based on the component element fields in the prompt word structure template, determine the reflection object and reflection logic, and generate reflection prompt words based on the reflection object and reflection logic; Based on the reflection prompts, the baseline model is instructed to perform structured reflection on the question-and-answer process without contextual prompts, and generate the target contextual prompts based on the structured reflection results.
3. The method according to claim 2, characterized in that, The component element fields include at least: a component element field for defining scenario description information, a component element field for defining positive sample examples, and a component element field for defining the question-and-answer process; Based on the component element fields in the aforementioned prompt word structure template, the reflection object and reflection logic are determined, including: Based on the aforementioned constituent element fields, the scene description, the generation of positive sample examples, and the generation of the question-and-answer process are taken as reflection objects; Using the target application scenario and the problem information as reflection constraints, a question-and-answer process without contextual prompts is executed based on the baseline model. An execution process is constructed, including scenario description, data acquisition, reasoning replay, data structuring, and example generation, to obtain the reflection logic.
4. The method according to claim 3, characterized in that, Based on the reflection prompts, the baseline model is instructed to perform structured reflection on the question-and-answer process without contextual prompts, and to generate the target contextual prompts based on the structured reflection results, including: Input the reflection prompts into the baseline model, and perform the following structured reflection operation on the reflection object according to the reflection logic: Based on the problem information, infer the target application scenario to which it belongs, and generate scenario description information corresponding to the target application scenario; Obtain the structured log records or explicit thought chains generated by the baseline model during the execution of question-and-answer sessions without contextual prompts; based on the structured log records or explicit thought chains, replay the question-and-answer process from the question information to the generation of the first answer information, and abstract, generalize, and structure the question-and-answer process to obtain the question-and-answer flow under the target application scenario; Based on the question information and the first answer information, generate positive sample examples for the target application scenario; The scenario description information, positive sample examples, and question-and-answer process corresponding to the target application scenario are embedded into the corresponding component fields of the prompt word structure template to obtain the target scenario-based prompt word.
5. The method according to any one of claims 1-4, characterized in that, The routing intelligence module utilizes semantic understanding to perform scene recognition on the problem information, and matches it against a prompt word library based on the identified target application scenario, including: The problem information is input into the routing intelligence module, and the problem information is encoded into a problem semantic vector using a domain adaptive semantic encoder; Calculate the semantic similarity between the question semantic vector and the scenario prototype vector of the existing application scenarios in the prompt word library, and determine candidate application scenarios from the existing application scenarios in the prompt word library based on the semantic similarity; Based on the local density or prediction stability of the question semantic vector in the neighborhood of the candidate application scenario, calculate the matching confidence between the question semantic vector and the candidate application scenario; If the matching confidence is less than a preset confidence threshold, a new application scenario is generated based on the question semantic vector as the target application scenario, and there is no target scenario-based prompt word in the prompt word library that corresponds to the target application scenario. If the matching confidence is greater than or equal to a preset confidence threshold, the candidate application scenario is taken as the target application scenario, and the contextualized prompt words in the prompt word library that correspond to the candidate application scenario are taken as the target contextualized prompt words.
6. The method according to claim 5, characterized in that, Using the candidate application scenarios as the target application scenarios includes: The baseline model is invoked, and a binary classification judgment is made on whether the problem information belongs to the candidate application scenario based on the problem semantic vector and the scenario prototype vector of the candidate application scenario. If the binary classification result is "yes", then the candidate application scenario is taken as the target application scenario.
7. The method according to any one of claims 1-4, characterized in that, The reflection intelligence module is used to perform a multi-dimensional quality assessment of the first answer information, including performing at least two of the following assessment operations: Based on a pre-defined domain factual knowledge base, the accuracy of the factual content in the first answer information is assessed; Based on the answer information dimensions required by the question information, a completeness assessment is performed on the information dimensions covered by the first answer information, wherein the answer information dimensions include key elements, necessary explanations, risk warnings and / or action suggestions; The logical consistency among the information statements included in the first answer information is evaluated to assess whether there are contradictions, circular arguments, or breaks in reasoning. Based on at least one of the intent information, topic information, and expression style of the first answer information, the fit between the first answer information and the question information is evaluated. Based on compliance information, a compliance and security assessment is conducted on the first answer information.
8. The method according to any one of claims 1-4, characterized in that, Also includes: If the target contextual prompt word is matched, the question information and the target contextual prompt word are input into the baseline model, and question-answering processing guided by the target contextual prompt word is performed to obtain the second answer information; Based on the second answer information, the question information, and / or the target application scenario, the target scenario-based prompt words are iteratively optimized, and the optimized scenario-based prompt words are updated to the prompt word library.
9. The method according to claim 8, characterized in that, The target contextualized prompts include the scenario description information, positive sample examples, and question-and-answer process corresponding to the target application scenario; The question information and target contextualized prompts are input into the baseline model, and question-answering processing guided by the target contextualized prompts is performed to obtain second answer information, including: Input the problem information and target contextualized prompts into the baseline model, and perform the following operations in the baseline model: Configure model roles, task contexts, and scene boundary constraints based on the scene description information, encode the question-answering process into step-by-step reasoning instructions, and parse the structural paradigms and domain representations in the positive sample examples; Using the model role, the step-by-step reasoning instructions are executed based on the task context and scene boundary constraint information to obtain intermediate reasoning results; By reusing the structural paradigm and domain representation from the positive sample examples, the intermediate reasoning results are standardized and structured to obtain the second answer information.
10. The method according to any one of claims 1-4, characterized in that, Also includes: If the first answer information fails the multi-dimensional quality assessment, the question information is re-input into the baseline model, and question-and-answer processing without contextual prompts is performed on the question information until the first answer information passes the multi-dimensional quality assessment or the maximum number of retries is reached.
11. The method according to claim 10, characterized in that, Before re-inputting the problem information into the baseline model, the following steps are also included: Based on the target quality dimension that failed the evaluation of the first answer information, quality optimization guidance words are generated and injected into the question information; The quality optimization guidance words are used to guide the baseline model to specifically improve the performance of the first answer information on the target quality dimension when regenerating the first answer information.
12. An intelligent question-answering system, characterized in that, include: Human-computer interaction module, routing intelligence module, reflective intelligence module, and baseline model deployed in the production environment; The human-computer interaction module is used to receive problem information and provide it to the routing intelligence module; The intelligent routing module is used to perform scene recognition based on semantic understanding on the question information, and to match the identified target application scenario in the prompt word library. The prompt word library includes multiple scenario-based prompt words and their corresponding application scenarios. If no target scenario-based prompt word corresponding to the target application scenario is matched, the question information is directly input into the baseline model, and question-and-answer processing without scenario-based prompt word guidance is performed on the question information to obtain the first answer information. The reflection intelligence module is used to perform multi-dimensional quality assessment on the first answer information. If the first answer information passes the multi-dimensional quality assessment, the baseline model is instructed to perform structured reflection on the question-and-answer process without contextual prompts, and generate the target contextual prompts based on the structured reflection results. And update the target contextualized prompt words and the target application scenario to the prompt word library; The human-computer interaction module is also used to: output the first answer information.
13. An electronic device, characterized in that, include: Memory and processor; The memory is used to store computer programs; The processor is coupled to the memory for executing the computer program to implement the steps of the method according to any one of claims 1-11.
14. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it causes the processor to perform the steps of the method according to any one of claims 1-11.
15. A computer program product, characterized in that, include: A computer program / instruction that, when executed by a processor, causes the processor to perform the steps of the method according to any one of claims 1-11.