Large language model prompt enhancement method and device, equipment, storage medium and product

CN122927318APending Publication Date: 2026-10-16CHINA MERCHANTS BANK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611137697.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-29
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0008]本申请的主要目的在于提供一种大语言模型提示增强方法、装置、设备、存储介质及产品,旨在解决现有技术中难以精细适配问题差异,无法提供精准的提示词推荐策略的问题

Benefits of technology

[0029] One or more technical solutions proposed in this application have at least the following technical effects: receiving the current user's question; reading candidate problem-solving strategies from a pre-built problem-solving strategy library based on the current user's question; constructing problem-strategy matching features between the current user's question and each candidate problem-solving strategy, and inputting these features into a trained routing model to obtain a matching score for each candidate problem-solving strategy; selecting a target problem-solving strategy based on the matching score; generating a complete hint based on the target problem-solving strategy, and inputting it into a large language model to generate a final answer. The technical solutions of this application can read candidate problem-solving strategies from a problem-solving strategy library based on the current user's question; construct problem-strategy matching features between the current user's question and each candidate problem-solving strategy; perform matching evaluation using a large model to select a target problem-solving strategy, thereby generating a complete hint. By using the combination of problem-solving steps themselves as recommendable objects and learning matching relationships based on historical answer effects, a hint strategy recommendation mechanism can achieve fine-grained adaptation to question differences and provide accurate, more granular strategy selection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122927318A_ABST
    Figure CN122927318A_ABST
Patent Text Reader

Abstract

The application discloses a large language model prompt enhancement method and device, equipment, a storage medium and a product, relates to the technical field of large language model application, and the method comprises the steps of receiving a current user question; reading a candidate problem solving strategy from a pre-constructed problem solving strategy library according to the current user question; constructing problem-strategy matching features of the current user question and each candidate problem solving strategy, and inputting a trained routing model to obtain a matching score of each candidate problem solving strategy; selecting a target problem solving strategy according to the matching score; generating a complete prompt according to the target problem solving strategy, and inputting the large language model to generate a final answer. The application can realize fine adaptation to problem differences and provide accurate and more fine-grained strategy selection by taking the combination of problem solving steps itself as a recommendable object and learning a prompt strategy recommendation mechanism according to the matching relationship of historical answer effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of large language model application technology, and in particular to a method, apparatus, device, storage medium and product for enhancing prompts in large language models. Background Technology

[0002] Current intelligent question-answering systems for large language models typically constrain the model's response through prompt word design. Common practices include unifying system prompt words, rule-based prompt word concatenation, prompt word selection based on question type, and prompt word optimization based on task sets.

[0003] A unified system prompt scheme typically pre-designs a set of general answer rules, such as role settings, answer boundaries, output format, tone style, and security and compliance requirements. After receiving a user's question, the system inputs the user's question along with the unified prompt into a large language model, allowing the model to generate an answer according to the unified rules.

[0004] The rule-based prompt concatenation scheme breaks down prompts into several segments and concatenates different prompt segments based on keywords, business rules, question tags, user input fields, or contextual states. For example, when a question is identified as an operation guidance type, it adds operation steps; when a question involves risk matters, it adds risk warning requirements; and when a question contains negative emotions, it adds reassuring expressions.

[0005] The prompt word selection scheme based on question type first categorizes or routes user questions, and then matches different prompt word templates or answer strengths to different question types. For example, questions can be divided into query, analysis, comparison, summary, and operation types, and rules for short answers, detailed analysis, step-by-step reasoning, or structured output can be set for each type.

[0006] Prompt optimization algorithms optimize prompts, instructions, few-shot examples, or prompt parameters in language model programs based on training samples and evaluation metrics. For example, methods or framework components such as GEPA, MIPROv2, and COPRO attempt to search, generate, or iterate high-performing prompt configurations for a specific task class or a particular language model program, thereby achieving better overall performance on the target task set.

[0007] While the aforementioned solutions can improve the stability and answer quality of intelligent question-answering systems to some extent, their focus is typically on designing a set of general rules, configuring different templates for different question types, or optimizing relatively better prompt words for a class of tasks. For different specific questions within the same task set, or even different questioners, it is difficult to precisely adapt to the differences in questions, and therefore, it cannot provide accurate prompt word recommendation strategies. Summary of the Invention

[0008] The main objective of this application is to provide a method, apparatus, device, storage medium, and product for enhancing prompts in large language models, aiming to solve the problem that existing technologies are unable to finely adapt to differences in problem-solving and cannot provide accurate prompt word recommendation strategies.

[0009] To achieve the above objectives, this application proposes a method for enhancing prompts in a large language model, the method comprising: Receive the current user's question; Based on the current user question, candidate problem-solving strategies are read from a pre-built problem-solving strategy library; Construct the problem-policy matching features between the current user problem and each candidate problem-solving strategy, and input them into the trained routing model to obtain the matching score for each candidate problem-solving strategy; Select the target problem-solving strategy based on the matching score; Based on the target problem-solving strategy, generate complete hints and input them into a large language model to generate the final answer.

[0010] In one embodiment, the step of constructing the problem-solving strategy library includes: A set of problem-solving steps consisting of several standardized problem-solving steps is maintained in advance, and each standardized problem-solving step includes a step identifier and a step template; A problem-solving strategy library is constructed based on the set of problem-solving steps. The problem-solving strategy library contains several problem-solving strategies. Each problem-solving strategy includes a strategy identifier and a sequence of steps consisting of at least one standardized problem-solving step in a preset order.

[0011] In one embodiment, the step of constructing the problem-solving strategy library further includes: The sequence of steps is subject to constraint processing, which includes one or more of the following: whitelist filtering, deduplication of duplicate steps, processing of mutually exclusive steps, and standardization of step order.

[0012] In one embodiment, the training steps of the routing model include: Obtain historical samples, which include the original user question, the original prompt, and the original answer generated based on the original prompt; Based on the historical samples and the problem-solving strategy library, a strategy preference sample for the same problem is formed through candidate strategy replacement, candidate answer generation, and unified evaluation. Based on the policy preference samples, the matching relationship between the learning problem and the solution strategy is learned, and preference learning route training is performed to obtain the trained route model.

[0013] In one embodiment, the step of forming a strategy preference sample for the same problem based on the historical samples and the problem-solving strategy library, through candidate strategy replacement, candidate answer generation, and unified evaluation, includes: Locate the solution outline segment in the original prompt; The original prompt is broken down into the pre-prompt content before the solution outline, the original solution outline, and the subsequent content after the solution outline; Select several candidate problem-solving strategies from the problem-solving strategy library; Render the step sequence of each candidate problem-solving strategy into a candidate problem-solving outline; Replace the original solution outline with the candidate solution outline to generate candidate hints corresponding to each candidate solution strategy; The large language model is invoked to generate corresponding candidate answers based on the candidate prompts; The candidate answers and the original answers are scored using a unified evaluation model or unified evaluation rules to obtain the strategy score corresponding to each answer. Based on the strategy scores corresponding to each answer, a strategy preference sample is constructed among multiple answers corresponding to the same original user question.

[0014] In one embodiment, constructing a strategy preference sample among multiple answers corresponding to the same original user question based on the strategy scores corresponding to each answer includes: Compare multiple strategy scores corresponding to the same original user question; When the difference between the score of the better strategy and the score of the worse strategy reaches a preset threshold, a strategy preference sample is constructed. The strategy preference sample includes at least the original user question, the identifier of the better strategy, the identifier of the worse strategy, and the score difference information.

[0015] In one embodiment, the step of learning the matching relationship between the problem and the solution strategy based on the policy preference samples, and performing preference learning route training to obtain a trained routing model includes: Construct a problem-policy matching feature, wherein the problem-policy matching feature includes at least a vector representation of the original user problem, a vector representation of the candidate problem-solving strategy, and the interaction feature between the two; The problem-policy matching features are input into the routing model, and the routing model outputs the matching score between the original user problem and the candidate problem-solving strategies. The parameters of the routing model are trained using the policy preference samples as training data and with the goal of achieving a higher matching score for the better policy than for the worse policy.

[0016] In one embodiment, the construction of the problem-policy matching feature includes at least a vector representation of the original user problem, vector representations of candidate problem-solving strategies, and interaction features between the two, including: The original user question and candidate solution strategies in the strategy preference sample are respectively feature-encoded. The original user question is encoded as a question vector, and the candidate solution strategy is encoded as a strategy vector. In this way, a question-strategy matching feature is constructed. The question-strategy matching feature includes the question vector, the strategy vector, the dimension-wise product of the question vector and the strategy vector, the absolute value of the dimension-wise difference between the question vector and the strategy vector, and structured features.

[0017] In one embodiment, the step sequence of each candidate problem-solving strategy is rendered as a candidate problem-solving outline, including: Read the step template corresponding to each standardized problem-solving step, and concatenate them into the problem-solving approach part according to the step sequence of the candidate problem-solving strategies; Read the step principles corresponding to each standardized problem-solving step, and concatenate them into the problem-solving principle part according to the step sequence of the candidate problem-solving strategies; Add global format principles and fixed answer principles, and output candidate solution outlines.

[0018] In one embodiment, the method of selecting several candidate problem-solving strategies from the problem-solving strategy library includes at least one of the following: random sampling, full enumeration, selecting the top several strategies after deduplication of the original strategies corresponding to the original prompt, recall based on initial similarity, and using the original strategy corresponding to the original prompt as the benchmark strategy.

[0019] In one embodiment, the method for locating the problem-solving outline fragment in the original prompt includes at least one of the following: locating by chapter title, locating by preset tag, locating by placeholder, locating by structured field, and locating by database field.

[0020] In one embodiment, the unified evaluation model or unified evaluation rule adopts at least one of the following evaluation methods: evaluation by a large language model reviewer, evaluation by a trained discriminant model, and evaluation by a human rule scorer; the evaluation dimensions of the unified evaluation model or unified evaluation rule include at least one of the following: whether it directly answers the core question, factual accuracy or professional correctness, security compliance, degree of personalization, executability, structural clarity, and degree of matching with a given strategy.

[0021] In one embodiment, the method further includes: When the routing model has not been trained, a large language model is used as a step selector to select a combination of steps from the set of problem-solving steps according to the user's question and generate a problem-solving outline. When a user's problem cannot be coded or the problem-solving strategy library is empty, a solution outline is generated using the default fallback step combination. When the unified evaluation model or unified evaluation rule returns an anomaly or the score is unavailable, the candidate sample is skipped or supplemented with the results of manual review.

[0022] In one embodiment, the training step of the routing model further includes: Obtain user profile features and user historical feedback data; The question-policy matching feature is extended to a user-question-policy ternary matching feature, which includes user vector representation, question vector representation, policy vector representation, and interaction features between the vectors. The user-question-strategy ternary matching features are input into the routing model, which outputs the matching score between the user and each candidate solution strategy for the question. When there is insufficient historical data for the user, the system reverts to the question-strategy matching mode.

[0023] In one embodiment, selecting the target problem-solving strategy based on the matching score includes at least one of the following: Select the candidate solution strategy with the highest matching score as the target solution strategy; Select the top K candidate solution strategies based on matching scores for fusion, manual review, or online verification; When the difference in matching scores between candidate problem-solving strategies is less than a preset threshold, the original online strategy, the default robust strategy, or the top K candidate problem-solving strategies with the highest scores are selected and fused together, where K is a positive integer.

[0024] In one embodiment, generating complete hints based on the target problem-solving strategy and inputting them into a large language model to generate the final answer includes: The sequence of steps of the target problem-solving strategy is rendered into a target problem-solving outline; The target problem-solving outline is injected into the preset position of the current hint template to generate a complete hint; The complete prompt is input into the large language model to generate the final answer.

[0025] Furthermore, to achieve the above objectives, this application also proposes a large language model prompt enhancement device, the device comprising: The receiving module is used to receive questions from the current user. The reading module is used to read candidate problem-solving strategies from a pre-built problem-solving strategy library based on the current user problem; The matching module is used to construct the problem-policy matching features between the current user problem and each of the candidate problem-solving strategies, and input them into the trained routing model to obtain the matching score of each candidate problem-solving strategy; The selection module is used to select a target problem-solving strategy based on the matching score. The generation module is used to generate complete hints based on the target problem-solving strategy and input them into a large language model to generate the final answer.

[0026] Furthermore, to achieve the above objectives, this application also proposes a large language model prompt enhancement device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the large language model prompt enhancement method as described above.

[0027] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the large language model prompt enhancement method described above.

[0028] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the large language model prompt enhancement method described above.

[0029] One or more technical solutions proposed in this application have at least the following technical effects: receiving the current user's question; reading candidate problem-solving strategies from a pre-built problem-solving strategy library based on the current user's question; constructing problem-strategy matching features between the current user's question and each candidate problem-solving strategy, and inputting these features into a trained routing model to obtain a matching score for each candidate problem-solving strategy; selecting a target problem-solving strategy based on the matching score; generating a complete hint based on the target problem-solving strategy, and inputting it into a large language model to generate a final answer. The technical solutions of this application can read candidate problem-solving strategies from a problem-solving strategy library based on the current user's question; construct problem-strategy matching features between the current user's question and each candidate problem-solving strategy; perform matching evaluation using a large model to select a target problem-solving strategy, thereby generating a complete hint. By using the combination of problem-solving steps themselves as recommendable objects and learning matching relationships based on historical answer effects, a hint strategy recommendation mechanism can achieve fine-grained adaptation to question differences and provide accurate, more granular strategy selection. Attached Figure Description

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

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

[0032] Figure 1 This is a flowchart illustrating the first embodiment of the large language model suggestion enhancement method of this application. Figure 2 This is a schematic diagram illustrating the online inference process of an example of the large language model hint enhancement method in this application; Figure 3 A complete flowchart illustrating the large language model suggestion enhancement method provided in this application embodiment; Figure 4 This is a schematic diagram of the module structure of the large language model prompt enhancement device in an embodiment of this application; Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the large language model prompt enhancement method in the embodiments of this application.

[0033] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0034] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0035] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0036] The main solution of this application embodiment is as follows: receiving the current user question; reading candidate problem-solving strategies from a pre-built problem-solving strategy library based on the current user question; constructing problem-strategy matching features between the current user question and each candidate problem-solving strategy, and inputting these features into a trained routing model to obtain a matching score for each candidate problem-solving strategy; selecting a target problem-solving strategy based on the matching score; generating a complete hint based on the target problem-solving strategy, and inputting this hint into a large language model to generate the final answer. This technical solution can read candidate problem-solving strategies from a problem-solving strategy library based on the current user question; construct problem-strategy matching features between the current user question and each candidate problem-solving strategy; perform matching evaluation using a large model to select a target problem-solving strategy, thereby generating a complete hint. By using the combination of problem-solving steps themselves as recommendable objects and learning matching relationships based on historical answer effects, a hint strategy recommendation mechanism can achieve fine-grained adaptation to problem differences and provide accurate, more granular strategy selection.

[0037] While existing technologies employ methods such as unified system prompts, rule-based prompt concatenation, question type-based prompt selection, and task set-oriented prompt optimization to constrain the model's response, and can improve the stability and answer quality of intelligent question-answering systems to some extent, their focus is typically on designing a set of general rules, configuring different templates for different question types, or optimizing relatively better prompts for a class of tasks. For different specific questions within the same task set, or even different questioners, it is difficult to precisely adapt to the differences in questions, thus failing to provide accurate prompt recommendation strategies. There is a lack of a prompt recommendation mechanism that considers the combination of problem-solving steps themselves as recommendable objects and learns matching relationships based on historical answer performance.

[0038] Specifically, existing similar technologies have the following shortcomings: 1. Uniform prompts or fixed templates are insufficient to precisely adapt to the differences in questions. Different questions may require a conclusion first, multi-dimensional analysis, operational guidance, risk warnings, or emotional support. If all questions use the same set of answer requirements, it is easy to have answers that are too long, deviate from the focus, or lack necessary steps.

[0039] 2. The granularity of prompt selection based on manual rules or question classification is limited. Classifying questions into query, analysis, and operation categories allows for different prompt intensities, but this approach mainly relies on preset categories or rules, making it difficult to directly learn from historical response results which step combination is more suitable for a particular type of question.

[0040] 3. Existing routing solutions focus more on the selection of tools, retrieval systems, knowledge sources, or processing flows, and rarely consider "which combination of problem-solving steps to use as a hint strategy when answering" as a trainable and recommendable object.

[0041] 4. Prompt word optimization algorithms are usually geared towards the overall optimization of task sets or language model programs. The goal is to obtain a set of prompt word configurations that perform well on the target task set. However, they cannot directly solve the problem of which specific problem to solve, or even which problem-solving strategy to match for each questioner.

[0042] 5. If candidate answer evaluation is only used for the current answer selection, it is difficult to distill it into policy recommendation capabilities. Generating multiple answers online for re-evaluation each time increases cost and latency; if offline evaluation results are not transformed into a trainable policy routing model, they are difficult to reuse for subsequent problems.

[0043] Therefore, this application provides a solution that decomposes the answer framework into standardized problem-solving steps, forming a manageable, combinable, and renderable strategy library for combining these steps. While retaining the original complete hint body, only fragments of the problem-solving outline are replaced to construct comparable candidate hints and answers for the same question. A unified evaluation method is used to assess the quality of answers generated by different candidate strategies, and strategy preference samples are constructed within the same question. A question-strategy routing model is trained based on these preference samples, enabling the system to directly select the target strategy during the reasoning phase, reducing the cost of online multi-candidate generation and evaluation. Furthermore, for the enhanced objective of "using different problem-solving strategies for different users on the same question," user-level preference samples such as user profiles, explicit feedback, or implicit feedback are required. This application extends the user-question-strategy ternary matching scheme for this purpose.

[0044] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device capable of implementing the above functions, such as a large language model prompting enhancement system. The following description uses a large language model prompting enhancement system as an example to illustrate the various embodiments.

[0045] The relevant terms used in the description of the embodiments in this application are explained as follows: Problem-solving steps: refers to a standardized answering behavior or functional module when answering questions, such as conclusion answering, multidimensional analysis, operation guidance, risk warning, key point summary, etc.

[0046] Problem-solving strategy: refers to a combination of one or more problem-solving steps arranged in a certain order.

[0047] Problem-solving strategy library: refers to a data collection that stores multiple problem-solving strategies, each of which can be rendered as a problem-solving outline.

[0048] Solution outline: refers to the prompts formed by piecing together step templates and answer principles, used to guide the large language model in generating answers.

[0049] Routing model: refers to a machine learning model that, after being trained with policy preference samples, matches and scores the current problem with candidate policies and selects the target policy.

[0050] Same-question preference sample: refers to the training sample formed by comparing the quality of answers from different strategies for the same question, where "the better strategy is better than the worse strategy".

[0051] User-Question-Strategy Triad Matching: This refers to a recommendation method that considers user characteristics, question characteristics, and strategy characteristics simultaneously when making strategy recommendations.

[0052] Based on this, embodiments of this application provide a method for enhancing prompts in a large language model, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the large language model suggestion enhancement method of this application.

[0053] In this embodiment, the large language model prompt enhancement method includes steps S10 to S50. The following provides a detailed explanation of each step.

[0054] like Figure 1 As shown, the first embodiment of this application proposes a method for enhancing prompts based on a large language model. The smart doorbell is equipped with an ultrasonic sensor and an audio module. The method includes: Step S10: Receive the current user's question; This embodiment provides a method for enhancing prompts using a large language model. The core of this method lies in the following: Given that the system has completed offline training and the routing model is ready, after receiving a user's question online, the routing model selects the most suitable problem-solving strategy from a pre-built problem-solving strategy library for the current question, renders this strategy as a problem-solving outline, injects it into the prompt template, and finally generates an answer. This embodiment describes the complete implementation of the online inference phase of this method.

[0055] First, the system receives the current user's question. The user question refers to the text input by the user in natural language. The user question can be received through various methods such as application programming interfaces (APIs), web forms, instant messaging messages, or speech-to-text conversion. After receiving the user question, the system may optionally preprocess it, including but not limited to text cleaning, sensitive word filtering, and question length truncation, to ensure input quality.

[0056] Step S20: Read candidate problem-solving strategies from the pre-built problem-solving strategy library according to the current user problem; Then, the system reads candidate problem-solving strategies from a pre-built problem-solving strategy library based on the current user's problem. The problem-solving strategy library is a pre-built dataset containing multiple problem-solving strategies. Each strategy includes a strategy identifier and a sequence of at least one standardized problem-solving step in a preset order. The system can read all strategies in the strategy library as candidates, or it can recall some relevant strategies from the strategy library as candidates based on preliminary characteristics of the current problem (such as problem length, keyword matching, etc.) to reduce online computation. The reading operation can retrieve strategy data from a memory cache, database, or configuration file.

[0057] Step S30: Construct the problem-policy matching features between the current user problem and each of the candidate problem-solving strategies, and input them into the trained routing model to obtain the matching score of each candidate problem-solving strategy; Next, the system constructs problem-policy matching features between the current user's problem and each candidate solution strategy, and inputs these features into the trained routing model to obtain a matching score for each candidate solution strategy. The problem-policy matching features are structured data used to characterize the degree of matching between the current problem and a particular candidate strategy.

[0058] In this embodiment, the construction method of the problem-policy matching feature specifically includes: The text of the current user's question is converted into a question vector using a text vector encoding model. The text of candidate problem-solving strategies (including strategy name, strategy source, step combination text, and rendered solution outline) is converted into a strategy vector using the same model. The Hadamard product (one-dimensional product of the question vector and strategy vector) is calculated to capture the interaction information between the question and strategy. The absolute value of the one-dimensional difference between the question vector and strategy vector is calculated to capture the difference information between the question and strategy. Structured features are extracted, such as question length, number of strategy steps, whether the strategy includes multi-dimensional analysis steps, whether it includes operation guidance steps, whether it includes personalized response steps, whether it includes risk constraint steps, and whether the strategy originates from online prompts. These question vectors, strategy vectors, one-dimensional products, absolute values ​​of one-dimensional differences, and structured features are then concatenated to form a complete problem-strategy matching feature set.

[0059] The routing model is a pre-trained machine learning model that receives the question-policy matching features mentioned above and outputs a scalar score. This scalar score represents the degree of matching between the current question and the corresponding policy. The higher the score, the more suitable the policy is for answering the current question.

[0060] As one implementation method, the routing model can adopt any of the following model structures: multilayer perceptron, neural collaborative filtering model, dual-tower model, interactive sorting model, matrix factorization model, factorization machine, and gradient boosting tree.

[0061] Taking a multilayer perceptron as an example, the routing model includes an input layer, several hidden layers, and an output layer. The input layer receives the concatenated question-policy matching feature vector. The hidden layers transform and abstract the features layer by layer through fully connected layers and non-linear activation functions (such as the ReLU function). The output layer outputs a scalar matching score. The dual-tower model processes the question encoding and policy encoding through two independent encoding towers (i.e., two independent neural networks), and finally calculates the matching score through a fully connected layer after dot product or concatenation. All of the above model structures can achieve the function of inputting question-policy matching features and outputting a matching score. The specific choice can be determined based on the computing resources and performance requirements of the actual deployment environment.

[0062] Step S40: Select the target problem-solving strategy based on the matching score; The system then selects the target problem-solving strategy based on the matching score. Specifically, the system sorts all candidate strategies from highest to lowest matching score.

[0063] The methods for selecting a target strategy include at least one of the following: The first approach is to select the candidate solution strategy with the highest matching score as the target solution strategy. This approach is the most direct, applicable to most common scenarios, and enables quick decision-making. The second approach is to select the top K candidate problem-solving strategies based on matching scores for fusion, manual review, or online verification, where K is a positive integer. This approach is suitable for scenarios where additional quality assurance is required for the recommendation results, such as presenting the output results of the top 3 strategies to human reviewers for review, or fusion of the problem-solving outlines of the top 3 strategies to generate a comprehensive answer. The third approach is to consider the following: when the difference in matching scores among candidate problem-solving strategies is less than a preset threshold, it indicates that the matching degree of each candidate strategy is similar. At this point, there is no obviously optimal strategy. Therefore, the original online strategy, the default robust strategy, or the fusion of the top K scoring strategies can be selected to avoid the strategy selected due to small score differences from performing unstablely in the actual answer. Here, K is a positive integer.

[0064] Step S50: Generate complete hints based on the target problem-solving strategy, and input them into the large language model to generate the final answer.

[0065] Finally, the system generates complete hints based on the target problem-solving strategy and inputs them into a large language model to generate the final answer. Specifically, firstly, the step sequence of the target problem-solving strategy is rendered into a target problem-solving outline. This rendering refers to converting the abstract standardized step identifiers in the strategy into natural language descriptions that the large language model can understand. Specifically, the system reads the step templates corresponding to each standardized problem-solving step in the step sequence of the target problem-solving strategy and assembles them into the problem-solving approach section according to the step order; it also reads the step principles corresponding to each standardized problem-solving step and assembles them into the problem-solving principles section according to the step order; finally, it adds global format principles and fixed answer principles to form a complete problem-solving outline.

[0066] The solution outline is a structured natural language text used to guide the large language model to follow specific thought processes and answer methods when generating responses.

[0067] Then, the system injects the target problem-solving outline into the preset position of the current prompt template, generating a complete prompt. The current prompt template refers to the complete prompt word framework used by the system to call the large language model, typically including components such as role settings, task description, knowledge context, and output format requirements. The preset position is a specific location reserved in the prompt template for placing the problem-solving outline, such as after the role settings, before the knowledge context, or at the end of the task description. This preset position can be marked using chapter titles, preset tags, placeholders, or structured fields. Injecting the target problem-solving outline into this preset position forms the complete prompt word. Finally, the complete prompt is input into the large language model, which generates the final answer based on the problem-solving outline and returns it to the user.

[0068] The online inference process in this embodiment can be as follows: Figure 2 As shown.

[0069] Through the above steps, this embodiment realizes online strategy recommendation and dynamic injection in large language model suggestion enhancement. Its technical advantages are: In the online inference stage, there is no need to generate multiple candidate answers for each request and evaluate them one by one; only a lightweight forward computation through the routing model is needed to select the optimal strategy, significantly reducing the computational cost and response latency of online inference. Simultaneously, since each strategy in the strategy library can be fully evaluated and verified offline, the online selected strategy has reliable quality assurance, achieving fine-grained adaptation to question differences and providing accurate, more granular strategy selection, thereby improving the matching degree between the answer and the question, and enhancing the quality and stability of the final answer.

[0070] Based on the first embodiment described above, a second embodiment of this application is proposed, in which the construction steps of the problem-solving strategy library are specifically defined.

[0071] As one implementation method, the steps for constructing the problem-solving strategy library include: A set of problem-solving steps consisting of several standardized problem-solving steps is maintained in advance, and each standardized problem-solving step includes a step identifier and a step template; A problem-solving strategy library is constructed based on the set of problem-solving steps. The problem-solving strategy library contains several problem-solving strategies. Each problem-solving strategy includes a strategy identifier and a sequence of steps consisting of at least one standardized problem-solving step in a preset order.

[0072] Specifically, in this embodiment, the construction of the problem-solving strategy library is the first step in the offline phase. Its purpose is to abstract the answer framework, which was originally scattered among the prompts, into standardized, manageable, and composable problem-solving strategy objects. This construction step specifically includes the following:

[0073] First, the system pre-maintains a set of standardized problem-solving steps. These standardized steps refer to a standardized answering behavior or functional module when answering a question; each step expresses an answering function or problem-solving behavior, rather than a specific business product, knowledge item, or final answer.

[0074] For example, in intelligent question-answering scenarios, standardized problem-solving steps can include: a conclusion-answering step, requiring the model to directly provide a clear conclusion at the beginning of the answer; a multi-dimensional analysis step, requiring the model to systematically analyze the problem from multiple dimensions; a specific-dimensional analysis step, requiring the model to conduct in-depth analysis on a specific dimension; a comparative analysis step, requiring the model to compare two or more objects; a recommendation decision step, requiring the model to provide clear recommendations or decision suggestions; a condition evaluation step, requiring the model to evaluate based on specific conditions; an operation guidance step, requiring the model to provide specific operation steps or execution guidelines; a personalized response step, requiring the model to provide personalized answers based on user profiles; an emotion processing step, requiring the model to address and soothe users' negative emotions; a risk constraint step, requiring the model to indicate relevant risks or limitations; a standard prompt step, requiring the model to comply with industry standards or policy and regulatory requirements; and a key point summary step, requiring the model to provide a key point summary or extract essential information at the end of the answer.

[0075] Each standardized problem-solving step includes a step identifier and a step template. The step identifier is a code or number used to uniquely identify the step. The step template is a natural language description template corresponding to the step, used to generate guidance text that can be understood by a large language model during rendering.

[0076] Furthermore, each standardized problem-solving step may also include a step name, a step definition, a step principle, and applicable constraints. The step name is a short name for the step; the step definition is a detailed description of the function of the step, used to help understand the applicable scenarios of the step; the step principle is the specific answer principle corresponding to the step; the applicable constraints are the conditions and limitations on the application of the step, such as certain steps only applicable to specific business areas or specific types of questions.

[0077] After maintaining a set of standardized problem-solving steps, the system constructs a problem-solving strategy library based on this set. The strategy library contains several problem-solving strategies, each strategy comprising a strategy identifier and a sequence of steps consisting of at least one standardized problem-solving step in a preset order. The strategy identifier is a code or number used to uniquely identify the strategy. The step sequence is an ordered list of the standardized problem-solving steps contained in the strategy. The order of the steps in the strategy determines the sequential structure of the answer; for example, the conclusion may be given first, followed by detailed analysis, or a multi-dimensional analysis may be performed first, followed by a recommendation.

[0078] The problem-solving strategy library can be constructed in ways including but not limited to the following: Manual configuration, which involves domain experts manually configuring strategies and their sequence of steps based on business experience and best practices; The strategy for extracting high-quality answers from history involves selecting high-quality answers from past responses, analyzing their structure, and then extracting them in reverse. The rule generation method automatically generates reasonable combinations of steps based on predefined rules (such as the compatibility and complementarity between steps); The search enumeration method involves enumerating all reasonable combinations of steps within the set of steps using a search algorithm. The large language model-assisted generation method involves calling a large language model to automatically generate recommendation strategies based on the problem type and business scenario.

[0079] In order to keep the strategy controllable, the strategy library preferably only records the combination of steps themselves, without binding it to specific business objects or specific answers.

[0080] Furthermore, the construction of the problem-solving strategy library also includes a sub-step for constraining the sequence of steps. This constraint processing ensures that each strategy in the strategy library is reasonable, effective, and free of redundancy. Specifically, the constraint processing includes one or more of the following: Whitelist filtering allows only standardized problem-solving steps that appear in a preset whitelist within the sequence of steps, filtering out invalid steps that are not in the whitelist, ensuring that every step in the strategy is a standardized step that is supported by the system and has been verified.

[0081] Repeated steps are deduplicated, meaning that if there are duplicate standard problem-solving steps in the same strategy, only one is retained. Multidimensional analysis steps can appear at most once, avoiding the repeated execution of the same problem-solving behavior in the answer.

[0082] Mutually exclusive steps are handled by retaining only one of the mutually exclusive standard problem-solving steps when they coexist in the same solution strategy. Mutually exclusive steps refer to steps that are functionally conflicting or should not appear simultaneously in the same answer.

[0083] Standardizing the step sequence means rearranging the sequence of steps according to the standard order preset by the strategy library or the order declared by the strategy itself, so as to ensure that the same strategy has a consistent output effect when rendered at different times.

[0084] Furthermore, after obtaining the sequence of steps, a problem-solving outline is rendered.

[0085] Specifically, the system renders the sequence of steps in the strategy into a problem-solving outline that can be understood by the large language model. During rendering, the system reads the step template corresponding to each step and concatenates them into a problem-solving approach, reads the answer principle corresponding to each step and concatenates it into a problem-solving principle, and then adds global format principles and fixed answer principles.

[0086] Furthermore, the construction of the problem-solving strategy library also includes an input-output relationship. This step receives a preset set of steps and strategy configurations, and outputs a problem-solving strategy library that can be used for subsequent training and online inference, as well as a renderable problem-solving outline for each strategy. Its output serves as input to the candidate strategy evaluation step and the online strategy application step.

[0087] The specific processing procedure is as follows: First, define standardized problem-solving steps, their templates, principles, and applicable constraints.

[0088] Then, a combination strategy for steps is formed based on manual configuration, historical prompts, or model-assisted generation of results.

[0089] Then, the sequence of steps in the strategy is subjected to whitelist filtering, deduplication, mutual exclusion processing, and sequence standardization.

[0090] Then, the step templates are pieced together to form a problem-solving approach, and the step principles are pieced together to form a problem-solving principle.

[0091] Finally, add global formatting requirements and fixed answer principles, and output a complete solution outline.

[0092] In one embodiment, the rendered problem-solving outline may include a set of step execution instructions, a set of answer constraints, and a set of output format constraints. The set of step execution instructions is generated by the step templates corresponding to each problem-solving step in a strategic order; the set of answer constraints is generated by merging the step principles, global principles, and fixed principles corresponding to each problem-solving step; and the set of output format constraints is used to limit the title level, list format, key points, risk warning location, and conclusion closing method. The above content can be saved as structured fields or converted into natural language prompt fragments and then injected into a complete prompt template.

[0093] To facilitate understanding of the meaning of "strategy," the following example uses a user inquiring about the waiting period of a purchased critical illness insurance policy within an insurance consultation AI. This example is only used to illustrate the manifestation of a strategy as a prompt template and does not limit the application of this invention to insurance business.

[0094] In this application, "strategy" can be understood as a designed requirement for answering or thinking, used to guide the large language model on how to understand the question, how to organize the answer, what information to focus on, and what constraints to follow when answering. Essentially, it can be represented as a replaceable, evaluable, and trainable prompt template. For example, for the user question "I bought a critical illness insurance policy last year, and I would like to ask how long the waiting period is?", one possible strategy could be a "precise policy terms query strategy," with a prompt template example as follows:

[0095] The aforementioned prompt template is one specific strategy. The system can also maintain other strategies, such as a "policy clause comparison query strategy," a "claims progress tracking strategy," and a "renewal reminder strategy." The difference between different strategies lies not in the specific factual content of the answer, but in the different requirements for the answering method, thought process, key information, risk warnings, and output style. During the offline training phase, different strategies can be used to generate candidate answers and score them for the same question. If historical evaluations show that a certain type of question is more suitable for a particular strategy, the preference learning routing model will learn the matching relationship between this question and the strategy and automatically select the appropriate strategy to inject prompts during the online phase.

[0096] Through the above steps, this embodiment constructs a problem-solving strategy library that is clearly structured, logically structured, and free of redundancy. Its technical advantages are: it makes the answer framework, originally implicit in the prompts, explicit, standardized, and manageable, allowing the answer strategy itself to become an independent object that can be enumerated, rendered, compared, and trained, laying a data foundation for subsequent candidate evaluation, preference learning, and online recommendation; simultaneously, constraint processing ensures the quality and consistency of the strategy library, avoiding a decline in answer quality due to unreasonable strategies.

[0097] Based on any of the above embodiments, a third embodiment of this application is proposed, in which the training steps of the routing model are specifically defined.

[0098] In this embodiment, training the routing model is the core step in the offline phase. Its purpose is to form strategy preference samples based on historical question-and-answer data through candidate strategy replacement, candidate answer generation, and unified evaluation. The routing model is then trained based on these preference samples, enabling it to learn the matching relationship of "which question is suitable for which problem-solving strategy." This training step specifically includes the following:

[0099] First, the system acquires historical samples. These historical samples are question-and-answer records exported from online systems or historical data. Each historical sample includes the original user question, the original prompt, and the original answer generated based on the original prompt. The original user question is the natural language question text entered by the user at the time. The original prompt is the complete prompt word used by the system to call the large language model at that time. The original answer is the answer text generated by the large language model based on the original prompt. Historical samples can be real question-and-answer logs from an online production environment, or question-and-answer data pairs that are manually labeled or automatically generated during the offline evaluation phase. In the basic implementation of this embodiment, historical samples are not required to contain unique user identifiers or long-term user preference data. If the user profile, historical interaction, or feedback fields are empty, the system can still train the question-policy routing model based on the question text, original prompt, candidate strategies, and answer scores.

[0100] Then, based on the aforementioned historical samples and the problem-solving strategy library, the system generates strategy preference samples for the same problem through candidate strategy replacement, candidate answer generation, and unified evaluation. This process is the core of the offline evaluation phase of this invention and includes the following detailed steps.

[0101] First, locate the solution outline segment within the original prompt. This solution outline segment refers to the text content in the original prompt that describes the answer framework or problem-solving approach. The system needs to accurately locate the pre-defined solution outline segment within the complete prompt. For example, the start and end positions of the solution outline can be determined using chapter titles, tags, placeholders, structured fields, or database fields.

[0102] After locating the problem, the system breaks down the original prompt into three parts: the preceding content, the original solution outline, and the subsequent content, as follows: heading_prefix: The title of the solution outline and the preceding hints; outline_text: The original solution outline content; suffix_from_marker: Hints following the solution outline.

[0103] The preceding content (heading_prefix) refers to all the prompts preceding the solution outline fragment, typically including character settings, task description, system background, etc. The original solution outline (outline_text) is the content of the located solution outline fragment itself. The subsequent content (suffix_from_marker) refers to all the prompts following the solution outline fragment, typically including output format requirements, supplementary explanations, etc.

[0104] If the preset solution outline position is not present in the original prompt, the system can throw an exception, skip the sample, or use the default insertion position. To facilitate comparison between candidate strategies, the preferred embodiment requires that all prompt content except the solution outline remain unchanged within the same training sample.

[0105] Second, select several candidate problem-solving strategies from the problem-solving strategy library. For each training sample, the system selects several candidate strategies from the strategy library. Candidate strategies can be determined by random sampling, full enumeration, selecting the top few strategies after deduplication from the original strategy, recall based on initial similarity, or including the original online strategy as a benchmark strategy.

[0106] Third, the step sequence of each candidate problem-solving strategy is rendered into a candidate problem-solving outline. Rendering refers to converting the abstract standardized step identifiers in the strategy into natural language descriptions that the large language model can understand. Specifically, the system reads the step template corresponding to each standardized problem-solving step in the step sequence of the candidate problem-solving strategy, and assembles them into the problem-solving approach section according to the step order; it reads the step principles corresponding to each standardized problem-solving step, and assembles them into the problem-solving principles section according to the step order; then, it adds global format principles and fixed answer principles to form a complete candidate problem-solving outline.

[0107] Fourth, replace the original solution outline with the candidate solution outline to generate candidate hints corresponding to each candidate solution strategy. Specifically, the split-off preceding content, candidate solution outlines, and subsequent content are sequentially concatenated to form a new, complete hint. This can be expressed by the formula: Candidate hints = heading_prefix + candidate solution outline + suffix_from_marker This replacement method ensures that all parts of the cue words remain unchanged except for the answer outline fragment, so that the differences between subsequent candidate answers can purely reflect differences in strategy, rather than differences in other cue factors.

[0108] Fifth, the system uses a large language model to generate corresponding candidate answers based on the candidate prompts. Each candidate prompt is input into the large language model, and the same model version, temperature parameters, decoding strategies, and other generation parameters are used to obtain the candidate answer for each strategy. If the original answer also needs to participate in subsequent evaluation, the system similarly records the model version and generation parameters used when generating the original answer, or regenerates the baseline answer using the original prompts within the same model environment, to reduce scoring bias caused by differences in model version or generation configuration.

[0109] Sixth, use a unified evaluation model or unified evaluation rules to score each candidate answer and the original answer, and obtain the strategy score corresponding to each answer.

[0110] The uniform assessment refers to using the exact same assessment criteria and standards for all responses to be assessed, in order to ensure the fairness and comparability of the scoring.

[0111] The evaluation model can be a large language model reviewer, a trained discriminant model, a human rule scorer, or a combination of these. Evaluation outputs can include a total score, sub-scores, error labels, and reasons for deductions. Common evaluation dimensions may include whether the core question is answered directly, factual accuracy or professional correctness, security compliance, personalization, executability, structural clarity, and fit with a given strategy.

[0112] Preferably, the same large language model version, prompt subject, retrieval context, temperature, decoding strategy, and other generation parameters are used for the same batch of candidate answers. If necessary, the same strategy can be generated multiple times, and the average score, median, or other robust statistical values ​​can be used as the answer quality score for that strategy. The original answer can be used as the online benchmark answer for evaluation. If the original answer is used for preference training, the model version, prompt version, and generation parameters when the answer was generated are recorded, or the benchmark answer is regenerated in the same model environment to reduce the scoring bias caused by differences in model version or generation configuration.

[0113] Through the above steps, this embodiment completes the offline candidate strategy evaluation. Its technical advantages are: by conducting a comparable evaluation of multiple candidate strategies for the same question, historical question-and-answer data is transformed into structured and quantifiable strategy preference information, providing high-quality supervision signals for the training of the routing model; simultaneously, since the evaluation is performed only offline, it does not increase the burden of online inference, ensuring the system's response performance.

[0114] Based on the third embodiment described above, a fourth embodiment of this application is proposed, in which the steps for constructing policy preference samples are specifically defined.

[0115] In this embodiment, after the system completes a unified evaluation of each candidate answer and the original answer, and obtains the strategy score corresponding to each answer, it needs to construct a strategy preference sample based on these scores among multiple answers corresponding to the same user's question. The strategy preference sample serves as supervision data for training the routing model.

[0116] Specifically, the system compares multiple strategy scores for the same user question. Since all candidate answers are generated based on the same original user question, and the prompts are consistent except for the solution outline fragments, the score differences between answers can be directly attributed to the different strategies used. The system compares all strategy scores for the same question pairwise or sorts them from highest to lowest score.

[0117] Suppose there are strategies A and B for the same question, with scores of score_A and score_B respectively, and the score difference delta_AB is defined as: delta_AB = score_A - score_B; if delta_AB >= preference_threshold, then construct a preference sample to indicate that strategy A is better than strategy B.

[0118] Here, `preference_threshold` is a preset minimum score difference threshold used to filter samples with excessively small or unstable score differences. Preference samples can include problem sample identifiers, user questions, better strategy identifiers, better strategy step sequences, better strategy text, better strategy scores, worse strategy identifiers, worse strategy step sequences, worse strategy text, worse strategy scores, and `score_delta`.

[0119] Therefore, taking historical questions, original hints, original answers, and a problem-solving strategy library as input, the output is a sample of problem strategy preferences. This sample of preferences serves as training data for the preference learning route training stage.

[0120] The specific processing procedure is as follows: First, read the history of questions, original hints, and original answers.

[0121] Then, locate and break down the solution outline fragments in the complete hint.

[0122] Then, candidate strategies are selected from the strategy library and candidate solution outlines are rendered.

[0123] Then, keeping all other hints unchanged, only replace the solution outline to generate candidate hints.

[0124] Then, the large language model is invoked to generate candidate answers.

[0125] Then, candidate responses are scored using a uniform evaluation standard.

[0126] Finally, policy preference samples are constructed based on the score differences within the same question.

[0127] Through the above steps, this embodiment achieves automatic construction of policy preference samples within the same problem. Its technical advantages are: no manual labeling of policy merits is required; high-quality training data can be generated on a large scale through offline evaluation and an automated sample construction process, significantly reducing data labeling costs; simultaneously, by filtering out ambiguous samples with insignificant score differences through a preset difference threshold, the reliability of training data and the learning efficiency of the routing model are improved.

[0128] Based on the fourth embodiment described above, a fifth embodiment of this application is proposed, in which the steps of preference learning route training are specifically defined.

[0129] In this embodiment, after obtaining policy preference samples, the system performs preference learning route training based on these preference samples, enabling the routing model to learn the matching relationship between problems and solution strategies. This training step specifically includes the following:

[0130] First, the system constructs problem-policy matching features. These features include at least a vector representation of the original user problem, vector representations of candidate problem-solving strategies, and their interaction features.

[0131] Specifically, the system performs feature encoding on the original user questions and candidate problem-solving strategies in the strategy preference samples, encoding the original user questions into question vectors and the candidate problem-solving strategies into policy vectors, thereby constructing problem-policy matching features.

[0132] The problem-policy matching features include the following components: problem vector, policy vector, dimension-wise product of problem vector and policy vector, absolute value of dimension-wise difference between problem vector and policy vector, and structured features.

[0133] The vector representation of the user question is obtained by encoding the user question text using a text vector encoding model. The text vector encoding model can be a pre-trained language model such as BERT, RoBERTa, or Sentence-BERT, or a text encoding model fine-tuned for a specific domain. Before encoding, the user question text can be pre-processed, for example, by concatenating it with optional user profiles, business stages, complexity, and other fields before encoding, to enrich the information content of the question representation.

[0134] The vector representation of a candidate problem-solving strategy is obtained by encoding the strategy text using a text vector encoding model. The strategy text may include a concatenation of the strategy name, strategy source, descriptive text of the step combinations, and a rendered problem-solving outline. After concatenating the above strategy-related information, it is encoded into a strategy vector using a text vector encoding model, ensuring that the strategy vector fully represents the functional characteristics and applicable scenarios of the strategy.

[0135] The interaction features between the vector representation of the original user problem and the vector representation of the candidate solution strategy include the dimension-wise product and the absolute value of the dimension-wise difference between the problem vector and the strategy vector. The dimension-wise product is used to capture the cooperative matching information between the problem and the strategy, and the absolute value of the dimension-wise difference is used to capture the difference information between the problem and the strategy.

[0136] Structured features refer to the scalar features of problem-policy pairs other than vector representations. These features may include, but are not limited to, the following fields: problem length, number of policy steps, whether the policy includes multidimensional analysis steps, whether the policy includes operational guidance steps, whether the policy includes personalized response steps, whether the policy includes risk constraint steps, and whether the policy originates from online prompts. These structured features provide discrete and statistical information that is difficult to capture directly in vector representations, which helps improve the discriminative ability of routing models.

[0137] One preferred concatenation form of the question-policy matching features can be expressed as: Feature(q,s) = concat( Embedding(q), Embedding(s), Embedding(q) Embedding(s), abs(Embedding(q) - Embedding(s)), ScalarFeatures(q, s) ) Where q represents a problem instance and s represents a candidate policy. The above formula assumes that Embedding(q) and Embedding(s) are in the same vector space and have the same dimension. If the output dimensions of the problem encoder and the policy encoder are different, or if they come from different encoding models, they can be transformed to a unified dimension first through linear projection, multilayer perceptron projection, or other mapping methods before calculating the dimension-wise product and the absolute value of the dimension-wise difference.

[0138] The system then inputs the aforementioned question-policy matching features into the routing model, which outputs a matching score between the original user question and the candidate solution strategies. This model can be a multilayer perceptron, a neural collaborative filtering model, a dual-tower model, an interactive ranking model, a matrix factorization model, a factorization machine, a gradient boosting tree, or another ranking model.

[0139] In one embodiment, the routing model receives a Feature(q,s) and outputs a scalar score, Score(q,s).

[0140] For the better strategy s+ and the worse strategy s- in the preference sample, the routing model calculates the following respectively: score_plus=Router(q,s+) score_minus=Router(q,s-) The training objective is to make score_plus greater than score_minus. The loss function can be a pairwise ranking loss, for example: Loss=softplus(-(score_plus-score_minus)) Weight(score_delta) Here, `score_delta` represents the score difference between the answers corresponding to the better strategy and the answers corresponding to the worse strategy. `Weight(score_delta)` is determined based on this score difference; the larger the score difference, the higher the weight of the preferred sample can be. Alternatively, hinge loss, cross-entropy ranking loss, Bayesian Personalized Ranking loss, pointwise score regression, or listwise ranking learning can also be used.

[0141] During training, the system periodically evaluates the routing model's ranking accuracy and other metrics on the validation set. Training stops when the model's performance no longer significantly improves or when a preset number of training epochs is reached. After training, the system saves the routing model's parameters and metadata. This metadata may include information such as model type, text vector model name, input dimension, vector dimension, structured feature dimension, hidden layer configuration, policy identifier list, training configuration, training epoch history, number of preference samples, number of question samples, and number of policies.

[0142] Therefore, a problem-policy routing model is trained by using the preference samples output from the candidate policy evaluation stage and the policy text and step combinations output from the problem-solving policy library. The trained model parameters and the policy identifier list serve as inputs to the online policy application stage.

[0143] The specific processing procedure is as follows: First, issue vectors, policy vectors, and structured features are generated based on the issue text and policy text.

[0144] Then, model matching scores are calculated for the better and worse strategies respectively.

[0145] Then, the routing model parameters are updated based on the preference ranking loss.

[0146] Then, save the model parameters, training configuration, and policy metadata.

[0147] Finally, the model is periodically retrained or incrementally updated based on newly added evaluation samples or feedback samples.

[0148] Through the above steps, this embodiment completes the training of the preference learning routing model. Its technical advantages are: by using pairwise ranking learning and a weighted loss mechanism, the routing model can effectively learn the matching rules of "which problem is suitable for which strategy" from policy preference samples; the trained model can quickly complete policy selection through a simple forward computation during online inference, without the need for time-consuming multi-candidate generation and evaluation, thus realizing the transformation of offline learning results into online applications.

[0149] Based on any of the above embodiments, a sixth embodiment of this application is proposed, which further includes an extended implementation of the cold start and rollback mechanism.

[0150] In this embodiment, the system needs to have corresponding cold start and rollback mechanisms in abnormal situations such as when the routing model has not been fully trained, user questions cannot be stably encoded, or the policy library is empty, to ensure that the system can still operate normally and generate answers under these abnormal conditions. The cold start and rollback mechanisms described in this embodiment include the following three situations.

[0151] The first scenario: When the routing model is not yet fully trained, the system uses a large language model as a step selector. Based on the user's question, it selects a combination of steps from the set of solution steps to generate a solution outline. The scenarios where the routing model is not yet fully trained include, but are not limited to, the following: the system is not yet deployed offline, there is insufficient training data, the model is being updated or retrained, or the model loading has failed. In these scenarios, the routing model cannot provide reliable policy matching scores, so the system temporarily uses a general-purpose large language model as the step selector.

[0152] The step selector functions differently from the large language model ultimately used to generate the answer. The step selector only selects combinations of steps, rather than directly generating the final answer. Specifically, the system constructs a step selection prompt containing the following: a complete list of the set of solution steps, the user's current question, and explicit instructions. After the step selection prompt is input into the large language model, the model returns a recommended list of steps in a structured format.

[0153] After receiving the step list returned by the large language model, the system needs to perform format validation and cleaning, including: whitelist filtering, which checks whether each returned step is in the preset set of solution steps and filters out invalid steps not in the whitelist; duplicate step removal, which keeps only one if there are duplicate steps in the returned step list; mutually exclusive step handling, which keeps only one of the mutually exclusive step combinations according to preset rules if there are mutually exclusive step combinations in the returned step list; and parsing failure handling, which automatically retryes or uses the default step combination if the content returned by the large language model cannot be correctly parsed into a structured step list. The standardized step list after the above processing is rendered as a solution outline for generating the answer.

[0154] The second scenario: When a user's question cannot be stably encoded or the problem-solving strategy library is empty, the system uses a default fallback combination of steps to generate a problem-solving outline. "User question cannot be stably encoded" means that the text vector encoding model encounters an anomaly when processing the current user's question, resulting in the inability to generate a valid question vector. "The problem-solving strategy library is empty" means that no problem-solving strategies have been built in the system, or all strategies have been marked as unavailable due to anomalies. In the above scenarios, the system cannot perform normal strategy matching, therefore using a preset default fallback combination of steps. This default fallback combination of steps is a pre-configured basic combination of steps applicable to most common question-answering scenarios. The system renders this default fallback combination of steps as a problem-solving outline, ensuring that the system can still provide basic answer services to users even in extreme cases.

[0155] The third scenario: When the unified evaluation model or unified evaluation rule returns an anomaly or the score is unavailable, the system skips the candidate sample or supplements it with the result of manual review. An anomaly refers to an error in the evaluation model when processing candidate answers. An unavailable score means the score returned by the evaluation model exceeds a reasonable range, or the score result cannot be calculated due to missing data in the evaluation dimension. In the above scenario, the system has two processing methods: First, skip the candidate sample, i.e., do not include the candidate strategy and its answer in the preference sample construction process to avoid unreliable scores polluting the training data; second, supplement with the result of manual review, i.e., a human reviewer evaluates the quality of the candidate answer and gives a score, which is then used as the score for the strategy in subsequent preference sample construction. In this embodiment, the system can be configured with both methods simultaneously, prioritizing the use of the manual review result, otherwise automatically skipping the sample.

[0156] In addition, when the scores of candidate strategies are small, the original online strategy, the default robust strategy, or the fusion of the top K scoring strategies can be selected.

[0157] Through the above steps, this embodiment implements the system's cold start and rollback mechanism. Its technical advantages are: even when the routing model is not yet ready or in abnormal situations, the system can still operate normally through the large language model step selector or the default fallback strategy, ensuring the system's availability and robustness; simultaneously, by skipping unreliable samples in abnormal situations, the quality of training data is maintained, avoiding routing model training bias caused by abnormal data.

[0158] Based on any of the above embodiments, this application proposes an eighth embodiment, which further specifies that the training step of the routing model includes an extended implementation of user-personalized strategy recommendation.

[0159] In this embodiment, when the system can obtain user profile features and user historical feedback data, it can upgrade the basic question-policy matching to user-question-policy ternary matching, achieving more granular personalized policy recommendations. This extended implementation is an enhanced embodiment of the present invention; when user historical data is insufficient, the system can revert to the basic question-policy matching mode.

[0160] First, the system acquires user profile features and historical user feedback data. These user profile features refer to quantitative or qualitative characteristics that describe user attributes, preferences, and behavioral patterns, and may include, but are not limited to, the following information: user's knowledge level, user's business stage, distribution of historical user questions, user's industry background or professional information, etc.

[0161] The user history feedback data refers to explicit or implicit feedback information generated by users during their interaction with the system, which may include, but is not limited to: explicit ratings of historical answers by users, whether users adopted the suggestions in the answers, whether users continued to ask follow-up questions, the length of time users stayed on the current answer page, and statistical data on the effectiveness of different strategies for similar user groups on similar questions.

[0162] Then, the system expands the question-policy matching features into user-question-policy ternary matching features. These user-question-policy ternary matching features are feature expressions that add a user dimension to the original features. Specifically, the system encodes user profile features into user vectors, user questions into question vectors, and candidate problem-solving strategies into policy vectors using a text vector encoding model. The ternary matching features include the following components: user vector, question vector, policy vector, the dimension-wise product of user vector and policy vector, the dimension-wise product of question vector and policy vector, the absolute value of the dimension-wise difference between question vector and policy vector, user scalar features, and question-policy scalar features.

[0163] In this embodiment, a preferred concatenation form of the user-question-policy ternary matching feature can be represented as follows:

[0164] Where u represents the user, q represents the question, and s represents the policy. The above formula assumes that the parts of the user vector, question vector, and policy vector that participate in the dimension-wise interaction have been mapped to a unified dimension; if the vector dimensions of different feature sources are different, projection, concatenation, or pooling can be performed first before inputting into the user-question-policy matching model. This enhanced embodiment is not a necessary condition for the basic embodiment; when user historical data is insufficient, the system reverts to the basic question-policy routing model.

[0165] In this extended embodiment, the input to the routing model is expanded from a binary tuple (q,s) to a triple (u,q,s). Specifically, the routing model receives the aforementioned user-question-policy triple matching features and outputs the matching score of the user's selection of each candidate solution strategy for that question. The training data is also expanded from "question-policy preference samples" to "user-question-policy preference samples," meaning that when constructing preference samples, not only are the question, the better strategy, and the worse strategy recorded, but also the user identifier and user characteristics are recorded, enabling the model to learn personalized matching relationships where different users may prefer different strategies.

[0166] When user historical data is insufficient, the system reverts to the question-strategy matching mode. Insufficient user historical data means the system cannot obtain enough user profile features or historical feedback data to support personalized recommendations. Examples include a new user's first visit to the system, a user's historical interaction records being below a preset threshold, or a user having many missing profile features. In the revert mode, the system ignores user features and only performs strategy recommendations based on question-strategy matching features, i.e., using the basic scheme described in the first embodiment. This progressive design ensures the system functions correctly at any stage of user data accumulation, demonstrating the flexibility and compatibility of this invention.

[0167] Through the above steps, this embodiment implements the extended function of personalized strategy recommendation for users. Its technical advantages are: when sufficient user data is accumulated, the system can recommend differentiated problem-solving strategies to different users based on user profiles and historical feedback, thereby further improving the personalization of answers and user satisfaction; simultaneously, by setting a degradation mechanism, basic service capabilities are guaranteed when user data is insufficient, achieving a smooth evolution from general recommendation to personalized recommendation.

[0168] The technical solutions described in the embodiments of this invention transform the original problem-solving framework selection, which relied on human experience or single-step model judgment, into a strategy recommendation problem based on historical answer performance and strategy preference learning. The system can quickly select suitable problem-solving strategies and generate answers online while maintaining the original prompts essentially unchanged. This is achieved through offline evaluation and preference learning to train a routing model, thereby improving the matching degree between the answer strategy and the question, reducing the cost of online multi-candidate evaluation, and accumulating offline evaluation results into an online usable routing model. For systems that can subsequently collect user feedback, this application also provides a path for natural expansion to user-level personalized strategy recommendation.

[0169] The complete process of this embodiment can be referred to Figure 3 As shown. The overall system process may include the following steps: Strategy generation phase: Define standardized problem-solving steps, build a strategy library for combining steps, and provide a renderable problem-solving outline for each strategy.

[0170] Offline evaluation phase: Read historical questions and original hints, replace only the solution outline fragments, and generate candidate answers corresponding to different candidate strategies.

[0171] Preference sample stage: Score candidate answers using a unified evaluation model or rule, and construct pairwise preference samples within the same question where the better strategy is superior to the worse strategy.

[0172] Preference learning training phase: Train the problem-policy routing model based on problem representation, policy representation, interaction features and structured features.

[0173] In the online application phase: candidate strategies are read, scored, and ranked for new problems; target strategy is selected; target solution outline is rendered and hints are injected to generate the final answer.

[0174] Feedback and update phase: When feedback data is available, user feedback, manual quality inspection, or online performance indicators are used for subsequent incremental training or periodic retraining.

[0175] Compared with existing technologies, the advantages of this invention are mainly as follows: the answer strategy can be managed in a structured way, and the step combination is no longer just a fragment of prompt words, but a strategy object with identification, step sequence and rendering result, which can be recorded, evaluated and trained; the strategy selection is transformed from empirical rules to preference learning, and the system transforms the historical answer effect into training data for the strategy selection model through candidate strategy replacement, answer generation, unified scoring and preference sample construction; the online inference cost is low, and the generation and evaluation of multiple candidates mainly occur in the offline training or verification stage. Online, only the matching score between the current question and the candidate strategy needs to be calculated, and the target strategy is rendered as a solution outline; the modification to the existing prompt system is small. The system can only replace the solution outline fragment in the original prompt, without having to rewrite the original system prompt, knowledge base retrieval or answer generation chain; it has progressive personalization capabilities. The basic solution does not rely on the user's historical data. As user profiles and feedback are accumulated in the future, user features can be further introduced to achieve more granular strategy selection.

[0176] It should be noted that alternative implementations of this application can revolve around the same technical framework, namely, "step combination strategy library, candidate outline replacement, answer evaluation, preference learning, and online strategy routing." The source of the strategy library, the method of locating the solution outline, the evaluation method, the routing model structure, the preference learning objective, and the method of using online strategies can all be replaced. For example, strategies can be manually configured or extracted from historical high-quality answers or historical prompts; the solution outline can be located through chapter titles, placeholders, or structured fields; the quality of candidate answers can be provided by a large language model reviewer, a dedicated scoring model, human quality inspection results, or rule-based scoring results; the routing model can employ a multilayer perceptron, a dual-tower matching model, an interactive ranking model, a factorization machine, or a neural collaborative filtering model; and the training objective can employ pairwise, pointwise, or listwise ranking learning.

[0177] Furthermore, to achieve the above objectives, this application also proposes a large language model prompting enhancement device, wherein the smart doorbell is equipped with an ultrasonic sensor and an audio module, such as... Figure 4 As shown, the device includes: The first determining module 10 is used to determine the initial distance corresponding to the current volume of the audio module based on the current scene in response to detecting a target person; The second determining module 20 is used to detect the current position of the target person using an ultrasonic sensor; The distance difference calculation module 30 is used to calculate the distance difference by combining the current position of the target person with the initial distance. The sound pressure level difference calculation module 40 is used to calculate the sound pressure level difference of the audio module based on the distance difference. The compensation module 50 is used to compensate the current volume of the smart doorbell based on the sound pressure level difference of the audio module.

[0178] The large language model suggestion enhancement device provided in this application employs the large language model suggestion enhancement method described in the above embodiments. By treating the combination of problem-solving steps itself as a recommendable object and learning the matching relationship based on historical answer effects, a suggestion strategy recommendation mechanism can achieve fine-grained adaptation to problem differences, providing accurate and more granular strategy selection. Compared with the prior art, the beneficial effects of the large language model suggestion enhancement device provided in this application are the same as those of the large language model suggestion enhancement method described in the above embodiments, and other technical features in the large language model suggestion enhancement device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0179] Furthermore, to achieve the above objectives, this application also proposes a large language model prompt enhancement device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the large language model prompt enhancement method as described above.

[0180] The following is for reference. Figure 5 The diagram illustrates a structural schematic suitable for implementing the large language model prompt enhancement device in the embodiments of this application. The large language model prompt enhancement device in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The large language model prompt enhancement device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0181] like Figure 5As shown, the large language model prompting enhancement device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in read-only memory 1002 or a program loaded from storage device 1003 into random access memory 1004. Random access memory 1004 also stores various programs and data required for the operation of the large language model prompting enhancement device. The processing unit 1001, read-only memory 1002, and random access memory 1004 are interconnected via bus 1005. Input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the large language model prompting enhancement device to communicate wirelessly or wiredly with other devices to exchange data. While the figure shows a large language model prompting enhancement device with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.

[0182] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0183] The large language model suggestion enhancement device provided in this application employs the large language model suggestion enhancement method described in the above embodiments. By treating the combination of problem-solving steps themselves as recommendable objects and learning matching relationships based on historical answer effects, a suggestion strategy recommendation mechanism can achieve fine-grained adaptation to problem differences, providing accurate and more granular strategy selection. Compared with the prior art, the beneficial effects of the large language model suggestion enhancement device provided in this application are the same as those of the large language model suggestion enhancement method provided in the above embodiments, and other technical features in this large language model suggestion enhancement device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0184] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0185] Furthermore, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and which, when executed by a processor, implements the steps of the large language model prompt enhancement method described above.

[0186] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0187] The aforementioned computer-readable storage medium may be included in the large language model prompting enhancement device; or it may exist independently and not be assembled into the large language model prompting enhancement device.

[0188] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by a large language model prompting enhancement device, the large language model prompting enhancement device performs the following actions: receiving the current user question; reading candidate problem-solving strategies from a pre-built problem-solving strategy library based on the current user question; constructing problem-policy matching features between the current user question and each candidate problem-solving strategy, and inputting these features into a trained routing model to obtain a matching score for each candidate problem-solving strategy; selecting a target problem-solving strategy based on the matching score; generating a complete prompt based on the target problem-solving strategy, and inputting this prompt into the large language model to generate the final answer.

[0189] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0190] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0191] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0192] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., computer programs) for executing the aforementioned large language model prompt enhancement method. By using the combination of problem-solving steps themselves as recommendable objects and learning matching relationships based on historical answer effects, a prompt strategy recommendation mechanism can achieve fine-grained adaptation to problem differences and provide accurate, more granular strategy selection. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the large language model prompt enhancement method provided in the above embodiments, and will not be repeated here.

[0193] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the large language model prompt enhancement method described above.

[0194] The computer program product provided in this application uses the combination of problem-solving steps themselves as recommendable objects and learns matching relationships based on historical answer performance to provide a suggestion strategy recommendation mechanism. This mechanism enables fine-grained adaptation to problem differences and provides accurate, more granular strategy selection. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the large language model suggestion enhancement method provided in the above embodiments, and will not be elaborated here.

[0195] The technical solutions proposed in this application, including one or more, have at least the following technical effects: receiving the current user's question; reading candidate problem-solving strategies from a pre-built problem-solving strategy library based on the current user's question; constructing problem-strategy matching features between the current user's question and each candidate problem-solving strategy, and inputting these features into a trained routing model to obtain a matching score for each candidate problem-solving strategy; selecting a target problem-solving strategy based on the matching score; generating a complete hint based on the target problem-solving strategy, and inputting it into a large language model to generate a final answer. The technical solutions of this application can read candidate problem-solving strategies from a problem-solving strategy library based on the current user's question; construct problem-strategy matching features between the current user's question and each candidate problem-solving strategy; perform matching evaluation using a large model to select a target problem-solving strategy, thereby generating a complete hint. By using the combination of problem-solving steps themselves as recommendable objects and learning matching relationships based on historical answer effects, a hint strategy recommendation mechanism can achieve fine-grained adaptation to question differences and provide accurate, more granular strategy selection.

[0196] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A method for enhancing prompts in a large language model, characterized in that, The method includes: Receive the current user's question; Based on the current user question, candidate problem-solving strategies are read from a pre-built problem-solving strategy library; Construct the problem-policy matching features between the current user problem and each of the candidate problem-solving strategies, and input them into the trained routing model to obtain the matching score for each candidate problem-solving strategy; Select the target problem-solving strategy based on the matching score; Based on the target problem-solving strategy, generate complete hints and input them into a large language model to generate the final answer.

2. The method as described in claim 1, characterized in that, The steps for constructing the problem-solving strategy library include: A set of problem-solving steps consisting of several standardized problem-solving steps is maintained in advance, and each standardized problem-solving step includes a step identifier and a step template; A problem-solving strategy library is constructed based on the set of problem-solving steps. The problem-solving strategy library contains several problem-solving strategies. Each problem-solving strategy includes a strategy identifier and a sequence of steps consisting of at least one standardized problem-solving step in a preset order.

3. The method as described in claim 2, characterized in that, The steps in constructing the problem-solving strategy library also include: The sequence of steps is subject to constraint processing, which includes one or more of the following: whitelist filtering, deduplication of duplicate steps, processing of mutually exclusive steps, and standardization of step order.

4. The method as described in claim 2, characterized in that, The training steps for the routing model include: Obtain historical samples, which include the original user question, the original prompt, and the original answer generated based on the original prompt; Based on the historical samples and the problem-solving strategy library, a strategy preference sample for the same problem is formed through candidate strategy replacement, candidate answer generation, and unified evaluation. Based on the policy preference samples, the matching relationship between the learning problem and the solution strategy is learned, and preference learning route training is performed to obtain the trained route model.

5. The method as described in claim 4, characterized in that, Based on the historical samples and combined with the problem-solving strategy library, a strategy preference sample for the same problem is formed through candidate strategy replacement, candidate answer generation, and unified evaluation, including: Locate the solution outline segment in the original prompt; The original prompt is broken down into the pre-prompt content before the solution outline, the original solution outline, and the subsequent content after the solution outline; Select several candidate problem-solving strategies from the problem-solving strategy library; Render the step sequence of each candidate problem-solving strategy into a candidate problem-solving outline; Replace the original solution outline with the candidate solution outline to generate candidate hints corresponding to each candidate solution strategy; The large language model is invoked to generate corresponding candidate answers based on the candidate prompts; The candidate answers and the original answers are scored using a unified evaluation model or unified evaluation rules to obtain the strategy score corresponding to each answer. Based on the strategy scores corresponding to each answer, a strategy preference sample is constructed among multiple answers corresponding to the same original user question.

6. The method as described in claim 5, characterized in that, The process of constructing a strategy preference sample among multiple answers to the same original user question based on the strategy scores corresponding to each answer includes: Compare multiple strategy scores corresponding to the same original user question; When the difference between the score of the better strategy and the score of the worse strategy reaches a preset threshold, a strategy preference sample is constructed. The strategy preference sample includes at least the original user question, the identifier of the better strategy, the identifier of the worse strategy, and the score difference information.

7. The method as described in claim 6, characterized in that, The step of learning the matching relationship between problems and problem-solving strategies based on the policy preference samples, and performing preference learning route training to obtain a trained routing model includes: Construct a problem-policy matching feature, wherein the problem-policy matching feature includes at least a vector representation of the original user problem, a vector representation of the candidate problem-solving strategy, and the interaction feature between the two; The problem-policy matching features are input into the routing model, and the routing model outputs the matching score between the original user problem and the candidate problem-solving strategies. The parameters of the routing model are trained using the policy preference samples as training data and with the goal of achieving a higher matching score for the better policy than for the worse policy.

8. The method as described in claim 7, characterized in that, The constructed problem-policy matching features include at least a vector representation of the original user problem, vector representations of candidate problem-solving strategies, and interaction features between the two, including: The original user question and candidate solution strategies in the strategy preference sample are respectively feature-encoded. The original user question is encoded as a question vector, and the candidate solution strategy is encoded as a strategy vector. In this way, a question-strategy matching feature is constructed. The question-strategy matching feature includes the question vector, the strategy vector, the dimension-wise product of the question vector and the strategy vector, the absolute value of the dimension-wise difference between the question vector and the strategy vector, and structured features.

9. The method as described in claim 5, characterized in that, Render the step sequence of each candidate problem-solving strategy into a candidate problem-solving outline, including: Read the step template corresponding to each standardized problem-solving step, and concatenate them into the problem-solving approach part according to the step sequence of the candidate problem-solving strategies; Read the step principles corresponding to each standardized problem-solving step, and concatenate them into the problem-solving principle part according to the step sequence of the candidate problem-solving strategies; Add global format principles and fixed answer principles, and output candidate solution outlines.

10. The method as described in claim 5, characterized in that, The methods for selecting several candidate problem-solving strategies from the problem-solving strategy library include at least one of the following: random sampling, full enumeration, selecting the top several strategies after deduplication of the original strategies corresponding to the original prompt, recall based on initial similarity, and using the original strategy corresponding to the original prompt as the benchmark strategy.

11. The method as described in claim 5, characterized in that, The method for locating the problem-solving outline fragment in the original prompt includes at least one of the following: locating by chapter title, locating by preset tag, locating by placeholder, locating by structured field, and locating by database field.

12. The method as described in claim 5, characterized in that, The unified evaluation model or unified evaluation rule adopts at least one of the following evaluation methods: evaluation by a large language model reviewer, evaluation by a trained discriminant model, and evaluation by a human rule scorer; the evaluation dimensions of the unified evaluation model or unified evaluation rule include at least one of the following: whether it directly answers the core question, factual accuracy or professional correctness, security compliance, degree of personalization, executability, structural clarity, and degree of matching with the given strategy.

13. The method as described in claim 7, characterized in that, Also includes: When the routing model has not been trained, a large language model is used as a step selector to select a combination of steps from the set of problem-solving steps according to the user's question and generate a problem-solving outline. When a user's problem cannot be coded or the problem-solving strategy library is empty, a solution outline is generated using the default fallback step combination. When the unified evaluation model or unified evaluation rule returns an anomaly or the score is unavailable, skip the candidate sample or supplement it with the results of manual review.

14. The method as described in claim 7, characterized in that, The training steps of the routing model also include: Obtain user profile features and user historical feedback data; The question-policy matching feature is extended to a user-question-policy ternary matching feature, which includes user vector representation, question vector representation, policy vector representation, and interaction features between the vectors. The user-question-strategy ternary matching features are input into the routing model, which outputs the matching score between the user and each candidate solution strategy for the question. When there is insufficient historical data for the user, the system reverts to the question-strategy matching mode.

15. The method as described in claim 1, characterized in that, The selection of the target problem-solving strategy based on the matching score includes at least one of the following: Select the candidate solution strategy with the highest matching score as the target solution strategy; Select the top K candidate solution strategies based on matching scores for fusion, manual review, or online verification; When the difference in matching scores between candidate problem-solving strategies is less than a preset threshold, the original online strategy, the default robust strategy, or the top K candidate problem-solving strategies with the highest scores are selected and fused together, where K is a positive integer.

16. The method as described in claim 1, characterized in that, The process of generating complete hints based on the target problem-solving strategy and inputting them into a large language model to generate the final answer includes: The sequence of steps of the target problem-solving strategy is rendered into a target problem-solving outline; The target problem-solving outline is injected into the preset position of the current hint template to generate a complete hint; The complete prompt is input into the large language model to generate the final answer.

17. A large language model prompting enhancement device, characterized in that, The device includes: The receiving module is used to receive questions from the current user. The reading module is used to read candidate problem-solving strategies from a pre-built problem-solving strategy library based on the current user problem; The matching module is used to construct the problem-policy matching features between the current user problem and each of the candidate problem-solving strategies, and input them into the trained routing model to obtain the matching score of each candidate problem-solving strategy; The selection module is used to select a target problem-solving strategy based on the matching score. The generation module is used to generate complete hints based on the target problem-solving strategy and input them into a large language model to generate the final answer.

18. A large language model prompting enhancement device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the large language model hint enhancement method as described in any one of claims 1 to 16.

19. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the large language model prompt enhancement method as described in any one of claims 1 to 16.

20. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the large language model prompting enhancement method as described in any one of claims 1 to 16.