Prompt word optimization method and system and electronic equipment
By comparing and analyzing the annotation results of language models with different capabilities, the prompt words are automatically updated, solving the problem that prompt word design relies on expert experience. This achieves efficient and autonomous prompt word optimization, improving the performance and stability of the production model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING ZHONGKE JINDEZHU INTELLIGENT TECH CO LTD
- Filing Date
- 2025-12-16
- Publication Date
- 2026-05-01
AI Technical Summary
In existing technologies, the design of prompt words relies on expert experience, which is inefficient and difficult to scale, limiting the performance improvement of production models and making them overly dependent on manual debugging.
By using first-language models and second-language models with different capabilities to annotate training data, the annotation results are automatically compared and analyzed with the real labels. Based on the annotation correctness results, optimization strategies are triggered to update the basic prompt words until the preset termination conditions are met, thereby achieving autonomous and continuous improvement of prompt words.
It significantly reduces reliance on manual debugging, enables autonomous and continuous improvement of prompt words, enhances the performance of the production model on specific tasks, approaches the performance of stronger models, and reduces costs.
Smart Images

Figure CN121960732A_ABST
Abstract
Description
Prompt word optimization methods, systems, and electronic devices Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a prompt word optimization method and system, and electronic device. Background Technology
[0002] With the rapid development of large language model technology, data annotation using it has become an important alternative to traditional manual annotation. This method can significantly reduce annotation costs and improve efficiency. However, the performance of large language models in handling such tasks is highly dependent on the quality of input prompts. As key instructions guiding the model to understand task requirements and constraining the output format, the design of prompts usually requires deep domain knowledge and a lot of trial and error adjustments, heavily relying on expert experience, resulting in inefficiency, high costs, and difficulty in scaling and reproducibility.
[0003] Therefore, how to continuously and purposefully optimize the prompts of the production model so that the performance of the production model can be significantly improved while controlling inference costs and reducing reliance on manual debugging is an urgent problem to be solved. Summary of the Invention
[0004] This application provides a method, system, and electronic device for optimizing prompt words. Its main objective is to address how to continuously and purposefully optimize the prompt words of a production model, thereby significantly improving the model's performance while controlling inference costs and reducing reliance on manual debugging.
[0005] According to a first aspect of this application, a prompt word optimization method is provided, comprising: providing acquired basic prompt words to a first language model and a second language model, wherein the first language model and the second language model have different model capabilities; using the first language model and the second language model, based on their respective corresponding basic prompt words, respectively annotating the same set of training data to obtain a first annotation result corresponding to the first language model and a second annotation result corresponding to the second language model; comparing and analyzing the first annotation result and the second annotation result with the real labels corresponding to the training data to obtain the annotation correctness results of the first language model and the second language model respectively; triggering a corresponding prompt word optimization strategy according to different combinations of annotation correctness results, updating the basic prompt words corresponding to the first language model and / or the second language model respectively; until a preset termination condition is met, obtaining the target prompt word optimized by the second language model.
[0006] According to a second aspect of this application, a prompt word optimization system is provided, comprising: a model initialization and scheduling module, used to provide acquired basic prompt words to a first language model and a second language model respectively, wherein the first language model and the second language model have different model capabilities; an automated annotation and result comparison module, used to use the first language model and the second language model to annotate the same set of training data based on their respective corresponding basic prompt words, to obtain a first annotation result corresponding to the first language model and a second annotation result corresponding to the second language model; the automated annotation and result comparison module is further used to compare and analyze the first annotation result and the second annotation result with the real labels corresponding to the training data to obtain the annotation correctness results of the first language model and the second language model respectively; a summary and reflection and prompt word optimization module, used to trigger corresponding prompt word optimization strategies according to different combinations of annotation correctness results, and update the basic prompt words corresponding to the first language model and / or the second language model respectively; and an iteration control and output module, used to obtain the target prompt word optimized by the second language model until a preset termination condition is met.
[0007] According to a third aspect of this application, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method of the first aspect described above.
[0008] According to a fourth aspect of this application, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause a computer to perform the method of the first aspect described above.
[0009] According to a fifth aspect of this application, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method as described in the first aspect above.
[0010] The prompt word optimization method, system, and electronic equipment provided in this application utilize collaborative annotation and result comparison of different capability models to intelligently identify the root causes of performance differences. Based on this, optimization strategies are triggered in a targeted manner, accurately extracting and transferring the reasoning capabilities of strong models that may emerge during the inference process to the prompt words of weaker models. This significantly reduces reliance on manual debugging, enables autonomous and continuous improvement of prompt words, and ultimately allows production models to achieve performance close to that of stronger models on specific tasks using optimized prompt words, thereby significantly improving model performance while controlling costs.
[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0012] The accompanying drawings are provided for a better understanding of this solution and do not constitute a limitation of this application. Specifically: Figure 1 is a flowchart illustrating a prompt word optimization method provided in an embodiment of this application; Figure 2 is a flowchart illustrating a prompt word self-optimization method based on bilingual model comparison and reflection provided in an embodiment of this application; Figure 3 is a structural diagram of a prompt word optimization system provided in an embodiment of this application; and Figure 4 is a schematic block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0013] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of this application, including various details to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0014] This application relates to the field of artificial intelligence technology, and in particular to prompt word engineering optimization technology in natural language processing, specifically a prompt word optimization method.
[0015] The prompt word optimization method in this application constructs an automated, iterative optimization framework. It aims to systematically compare and analyze the performance differences of language models with different capabilities when handling the same task, and dynamically adjust their guidance instructions accordingly, ultimately distilling high-performance target prompt words for a specific model. This method is at least applicable to reducing reliance on human expert experience and achieving efficient knowledge transfer from strong to weak models.
[0016] The following description, with reference to the accompanying drawings, describes a prompt word optimization method, system, and electronic device according to embodiments of this application.
[0017] Figure 1 is a flowchart illustrating a prompt word optimization method provided in an embodiment of this application.
[0018] As shown in Figure 1, the method includes the following steps: Step 101, the acquired basic prompt words are provided to the first language model and the second language model respectively, wherein the first language model and the second language model have different model capabilities.
[0019] In the embodiments of this application, the basic prompt words refer to natural language instruction text initially defined by business personnel or the system to guide the large language model to complete a specific task (such as intent classification, entity recognition, etc.). The basic prompt words contain basic guidance information such as task description and output format requirements, but their initial state is usually not finely optimized for specific models and data.
[0020] Subsequently, the basic prompts are simultaneously provided to two large language models: the first language model and the second language model. These two models are designed to have different capabilities. Model capability is a comprehensive evaluation metric that encompasses differences in performance across multiple dimensions, including semantic understanding, logical reasoning, knowledge breadth, task generalization, and computational efficiency. Typically, the first language model is selected as the more powerful and accurate model, such as general-purpose models like GPT-4 or Qwen3-Max with larger parameter sets and more extensive training data. The second language model, on the other hand, is selected for its advantages in cost, inference speed, or deployment ease, but may have slightly weaker capabilities, such as models like DeepSeek-R1 or DeepSeek-V3 with smaller parameter sets, models suitable for deployment, or versions optimized for specific hardware.
[0021] Step 102: Using the first language model and the second language model, based on their respective basic prompt words, the same set of training data is labeled to obtain the first labeling result corresponding to the first language model and the second labeling result corresponding to the second language model.
[0022] In the embodiments of this application, training data refers to a dataset containing a large number of samples. Each sample typically consists of a piece of natural language text to be processed (e.g., a user query) and its corresponding ground truth label (i.e., the correct classification or annotation result of the text). Annotation processing refers to the process by which a language model analyzes and understands the input text based on the guidance of its currently held prompt words, and outputs a predicted category or structural information.
[0023] After this step, the first language model processes the entire training dataset, generating a series of predicted outputs. The set of these outputs constitutes the first annotation result. Similarly, the second language model performs the same processing, generating its corresponding second annotation result. The first and second annotation results represent the understanding and execution performance of the two models on the same task under the guidance of the current prompt word.
[0024] Step 103: Compare and analyze the first and second annotation results with the real labels corresponding to the training data to obtain the annotation correctness results of the first and second language models respectively.
[0025] In the embodiments of this application, the first and second annotation results are compared one by one with the pre-existing true labels in the training data, which serve as the standard answers. The true labels are high-quality annotations that have been manually verified or are recognized as accurate, and are the gold standard for evaluating the accuracy of the model output.
[0026] An automated comparison program determines whether the first language model's predictions for each data sample in the training data are correct, thus obtaining the first language model's annotation correctness result on the entire training data. Similarly, the system also determines whether the second language model's predictions are correct, obtaining its corresponding annotation correctness result. The annotation correctness result is a structured set of judgment information that clarifies whether each model's annotation for each specific sample is correct or incorrect, thus clearly revealing the performance differences between the two language models on specific task instances and their respective weaknesses.
[0027] Step 104: Based on different combinations of annotation correctness results, trigger the corresponding prompt word optimization strategy to update the basic prompt words corresponding to the first language model and / or the second language model.
[0028] In the embodiments of this application, different combination scenarios refer to multiple combinations of correct / incorrect states of two language models, such as one correct and the other incorrect, or both correct or both incorrect. Each combination scenario reflects a specific type of knowledge gap or optimization opportunity. The prompt word optimization strategy is a predefined or dynamically generated rule or natural language instruction used to modify and enhance the prompt word content. For example, when the first language model is correctly labeled while the second language model is incorrectly labeled, the optimization strategy may focus on refining the successful reasoning logic of the strong model; when both are incorrect, the strategy may aim to clarify the task definition or supplement constraints. The system selects and executes the corresponding prompt word optimization strategy based on the different combination scenarios currently encountered, updating and refining the prompt words currently held by the first language model and / or the second language model. This is a dynamic, targeted adjustment process, rather than an indiscriminate global modification.
[0029] Step 105 continues until the preset termination condition is met, yielding the target prompt word for the second language model optimization.
[0030] In the embodiments of this application, steps 102 to 104 constitute a complete iterative optimization loop. This loop continues until a preset termination condition is met. The preset termination condition is a pre-defined process stopping standard, the purpose of which is to achieve a balance between optimization effect and computational cost. Common conditions include, but are not limited to: the second language model's annotation accuracy on the training data reaches or exceeds a certain threshold; all training samples in the training data are correctly annotated by the second language model once; or the maximum number of iterations is reached. When the loop terminates, the final output of the process is a target prompt word specifically optimized for the second language model. The target prompt word is a high-quality prompt word that has undergone multiple iterations and incorporates key guiding information extracted from comparative analysis. It enables the second language model to perform the target task more accurately and stably, and its performance is significantly improved compared to using the initial basic prompt word.
[0031] This application enables efficient and automated prompt word targeting optimization, significantly reducing the reliance on human experience and repeated trial and error in traditional prompt word engineering. By constructing an automated closed loop of annotation-comparison-analysis-update, this application can intelligently diagnose the capability differences between models and transfer the inference advantages of strong models to weak models in the form of incremental prompt words. Thus, without modifying the parameters of the production model, it effectively improves the annotation performance and stability of the production model on specific tasks, achieving a good balance between cost and effectiveness.
[0032] In one possible implementation of this application embodiment, when updating the basic prompt words corresponding to the first language model and / or the second language model, the following methods can be used, but are not limited to: in response to the annotation correctness result indicating that both the first language model and the second language model have annotation errors, based on the real labels, first optimization information is generated to correct the first annotation error item corresponding to the first language model and the second annotation error item corresponding to the second language model; the first optimization information is synchronously updated to the basic prompt words corresponding to the first language model and the second language model.
[0033] In the embodiments of this application, corresponding prompt word optimization strategies are triggered based on different combinations of annotation correctness results, demonstrating dynamic analysis and decision-making capabilities. Specifically, when the annotation correctness results indicate that both the first language model and the second language model have annotation errors, this situation means that for a specific training data sample, neither the more capable first language model nor the second language model (the optimization target) has a valid cognitive and reasoning framework that fails to produce correct conclusions under the guidance of existing prompt words. This reveals a fundamental ambiguity or gap in the current task definition, knowledge boundaries, or guidance logic, and is an important signal that the prompt words need to be substantially strengthened and clarified.
[0034] Once in this context, the core task of optimization is to generate guiding information with universal corrective significance—the first optimization information. The true labels serve as the evaluation benchmark and optimization guide. The first and second labeled error items refer to the specific, erroneous predictions produced by the first and second language models for incorrect samples in the training data, respectively. Generating the first optimization information is a deep causal analysis and inductive process. The system (usually using a general reflective language model, i.e., a pre-defined reflective model) compares and analyzes the gap between erroneous predictions and correct true labels, deeply reflecting on the potential reasons for the failures of both the first and second language models. For example, the reasons might lie in the vague description of classification boundaries in the basic prompts, the lack of key feature definitions, the failure to cover specific linguistic phenomena or contexts, or the lack of necessary constraints to prevent ambiguous reasoning. The first optimization information is the condensation of these reflective conclusions; it offers clear suggestions in natural language on how to modify or supplement the prompts to guide the model to correct judgments. These suggestions are general, aiming to fundamentally remedy the deficiencies in the guiding logic, rather than merely adjusting the characteristics of a particular model.
[0035] After generating the first optimization information, an update operation will be performed, which will synchronously update the first optimization information to the corresponding basic prompt words in both the first and second language models. Synchronous updating means that the generalized optimization suggestions obtained through reflection, i.e., the first optimization information, will be simultaneously and uniformly added to or integrated into the prompt word versions currently used by both language models. The logical basis for this operation is that since the discovered problem is a fundamental guidance defect causing both language models to malfunction, correcting this defect should logically take effect on both simultaneously.
[0036] This application generates targeted first-stage optimization information for specific scenarios where both the first and second language models have annotation errors, and simultaneously updates the prompt words in both models. This accurately identifies and compensates for common defects in the basic prompt words, avoiding resource waste and inefficiency caused by indiscriminate optimization. Simultaneously, the synchronous update method ensures the stability and effectiveness of the dual-model comparison system, continuously enhancing the training value of the first language model and providing a more reliable reference for optimization in subsequent combination scenarios, thus promoting a closed-loop process for the entire prompt word optimization. Ultimately, this strategy helps the second language model quickly overcome common errors, continuously improve the accuracy and stability of annotation, and gradually narrow the performance gap with the first language model while controlling deployment costs, providing high-quality prompt word support for large-scale data annotation and online inference services.
[0037] In one possible implementation of this application embodiment, when generating first optimization information for correcting the first labeling error item corresponding to the first language model and the second labeling error item corresponding to the second language model, it can be implemented in the following ways, but not limited to: driving a preset reflection model, performing data annotation on the first labeling error item and the second labeling error item based on real labels, and obtaining the first optimization information for correctly annotating the training data.
[0038] In the embodiments of this application, the pre-defined reflection model is a specially configured instance of a large language model with strong analytical and inductive capabilities. Its core function is not to directly perform target task annotation, but to conduct root cause analysis and strategy extraction for errors that have occurred. It can be a dedicated model independent of the first language model and the second language model, or it can be taken over by the first language model under specific reflection instructions. This pre-defined reflection model is pre-defined as the analysis unit of the entire optimization system, responsible for learning from error cases and generating improvement solutions.
[0039] The input to the pre-defined reflective model is explicit: the true labels serving as the benchmark for the correct answer, and the first and second labeled error items generated by the first language model and the second language model, respectively. The first and second labeled error items specifically represent the failure outputs of the two models on incorrect samples, providing direct material for analyzing error patterns. The task driven by the pre-defined reflective model is to annotate the first and second labeled error items based on the true labels. This annotation does not refer to labeling the original text, but rather a higher-level analytical process. Essentially, it requires the pre-defined reflective model to examine, compare, and diagnose the two incorrect predictions (i.e., the first and second labeled error items) using the true labels as the standard, analyzing the reasons for their deviation from the correct path, and comprehensively inferring the common defects or missing information in the current prompts that led to their shared failure.
[0040] Through the above in-depth analysis, the pre-defined reflective model ultimately obtains the first optimization information for correctly labeling training data. Specifically, the pre-defined reflective model generates one or more structured natural language descriptions, which constitute the first optimization information. The content of this first optimization information directly addresses how to correct the prompt words so that the model can make correct judgments on current (and similar) erroneous samples. For example, it may explicitly point out the ambiguity of a certain category definition in the basic prompt words and propose a more precise definition, summarize the key discriminative features that have been ignored, suggest adding specific constraints or reasoning steps, or provide counterexamples or explanations that can clarify ambiguities.
[0041] The purpose of the first optimization information is clearly defined for correctly labeling training data: it is not an afterthought for a single error, but rather a refined set of rules or knowledge fragments with generalizable guiding significance, designed to guide the language model to achieve correct labeling when processing similar data in the future.
[0042] This application, by driving a pre-defined reflective model to generate first-order optimization information, overcomes the limitations of human experience. It performs objective and comprehensive error diagnosis based on the characteristics and logic of the data itself, avoiding the subjectivity and bias that may exist in manual analysis. Simultaneously, it can quickly uncover the underlying causes of errors, making the generated first-order optimization information more targeted and accurately compensating for deficiencies in basic prompt words. This provides high-quality content support for the subsequent synchronous updates of basic prompt words in both the first and second language models. This process requires no manual intervention and is fully automated. It not only improves the efficiency of first-order optimization information generation but also ensures the consistency and reliability of optimization suggestions, laying the foundation for a closed-loop iterative process for the entire prompt word optimization workflow. Ultimately, this helps the second language model rapidly improve its annotation performance, gradually approaching the annotation level of the first language model while controlling costs.
[0043] In one possible implementation of this application embodiment, when updating the basic prompt words corresponding to the first language model and / or the second language model respectively, it can also be implemented in the following ways, but not limited to: in response to the annotation correctness result indicating that the first language model has no annotation errors and the second language model has annotation errors, based on the reasoning process of the first language model, generating second optimization information for correcting the second annotation error item corresponding to the second language model; updating the second optimization information to the basic prompt words corresponding to the second language model.
[0044] In the embodiments of this application, when the first language model has no labeling errors but the second language model does, the absence of labeling errors means that the first language model has successfully made a judgment on specific training data that is completely consistent with the true label based on its current prompt word, demonstrating its powerful understanding and reasoning ability. Conversely, the presence of labeling errors indicates that the second language model's output deviates from the correct answer when faced with the exact same task and guidance information. This stark contrast in performance clearly identifies a definite window of opportunity for optimization: a certain successful insight or reasoning path possessed by the first language model has not yet been mastered by the second language model through the current prompt word. This is precisely the precise moment when instruction-level knowledge transfer needs to occur.
[0045] At this point, the core objective of optimization is to extract experience from successful examples. Specifically, this requires generating second optimization information based on the reasoning process of the first language model to correct the second annotation errors in the second language model. The reasoning process is a chain of implicit or explicit analysis, association, and logical inference processes performed internally by the first language model after receiving training data and the current prompt word. In some large language model interactions, this process can be made explicit by requiring the model to output the thought chain. The key to generating second optimization information lies in deeply analyzing and summarizing this successful reasoning process, extracting the key steps that lead to correct judgments, the subtle semantic features relied upon, and the specific knowledge or logical rules used. For example, the first language model may have noticed the implicit intent of a particular word in the context, or used multi-step reasoning to eliminate ambiguity. Subsequently, the system (usually executed by the first language model itself or a pre-defined reflective model) transforms this extracted key insight into a clear, understandable, task-oriented guiding text description. This description is the second optimization information, which directly addresses how to correct specific second annotation errors generated by the second language model, aiming to supplement the second language model with some missing key judgment criteria.
[0046] After generating accurate second optimization information, a targeted update operation is performed, that is, updating the second optimization information into the corresponding basic prompt words of the second language model. This is a targeted, incremental knowledge injection process. Unlike synchronous updates in situations where both sides are wrong, the update here is unidirectional and targeted, affecting only the prompt words of the second language model. The second optimization information is integrated into the current version of prompt words held by the second language model in the form of appending, fusing, or reconstructing, possibly as supplementary explanations, new constraints, enhanced classification rules, or examples. The essence of this operation is to encode the essential knowledge distilled from the successful reasoning of the strong model (first language model) into the input instructions of the weak model (second language model). In this way, when the second language model faces the same or similar problems again in subsequent iterations, its prompt words already contain the previously missing key guidance, thus potentially reproducing the successful reasoning path of the strong model, correcting the second labeling errors, and improving its overall labeling ability.
[0047] This application achieves precise and automated optimization of prompt words by targeting specific scenarios where the first language model is correct and the second language model is incorrect, and then transforming the advantages of the first language model into second optimization information. This optimization method can effectively transfer knowledge from a strong model to a weak model without human intervention, significantly reducing reliance on expert experience and avoiding the inefficiency waste caused by indiscriminate optimization. Simultaneously, the targeted updates of the second optimization information are only applied to the basic prompt words of the second language model, ensuring the inference independence of the first language model as a training model while allowing the second language model to quickly compensate for its shortcomings and gradually improve annotation accuracy. Ultimately, through continuous iterative optimization, the basic prompt words of the second language model will gradually accumulate key inference guidance adapted to specific annotation tasks, enabling it to continuously approach the annotation performance of the first language model while maintaining deployment cost advantages, providing high-quality and highly adaptable prompt word support for large-scale data annotation and online inference services.
[0048] In one possible implementation of this application embodiment, when generating second optimization information for correcting the second annotation error item corresponding to the second language model, it can be implemented in the following ways, but not limited to: driving the first language model or a preset reflection model, comparing and analyzing the first annotation result and the second annotation result to obtain model reasoning information in which the second annotation error item is correctly annotated in the first language model; and using the model reasoning information in the form of a natural language description as a supplementary explanation or constraint to constitute the second optimization information.
[0049] In the embodiments of this application, when it is identified that the first language model is correctly labeled while the second language model is incorrectly labeled, a refined knowledge extraction and encoding process is initiated. The goal is to generate second optimized information that can accurately compensate for the shortcomings of the second language model. This generation process is not a simple error message, but a deep, comparative reasoning and analysis process. Specifically, it drives the first language model or a pre-defined reflective model to compare and analyze the first and second labeling results. The driven object can be the first language model itself that successfully generated the first labeling result; or it can be an independent pre-defined reflective model dedicated to analysis and induction. Regardless of the method, the task is to juxtapose and deeply compare the first labeling result (correct result) and the second labeling result (incorrect result including the second labeling error item).
[0050] The purpose of comparative analysis is to reveal the differences in the thought processes behind the two annotation results. The focus of the analysis is to understand why the two language models arrive at different conclusions under the same basic prompts and input data. This analysis delves into the internal decision-making logic of the first language model, aiming to obtain the model reasoning information that correctly annotated the second incorrect item in the first language model. This model reasoning information delves into how the correct answer is derived. It systematically extracts the key judgment criteria, logical chains, text features, and interference factors excluded by the first language model when arriving at the correct first annotation result. For example, this model reasoning information might explicitly indicate that the first language model correctly identified the non-literal meaning of a phrase in a specific context, or that it categorized the user query into a more precise subcategory through multi-step reasoning. This model reasoning information is essentially an explicit summary of the implicit knowledge possessed by the first language model but currently lacking in the second language model for this specific task segment.
[0051] After obtaining highly structured model reasoning information, the next step is to transform it into cue word components that can be directly utilized by the second language model. This is achieved by using natural language descriptions of the model reasoning information as supplementary explanations or constraints to constitute second optimization information. Using natural language ensures the readability and integrability of the information, allowing it to be seamlessly integrated into the existing cue word context. Using supplementary explanations or constraints clarifies the specific way and functional positioning of its integration into the cue words. Supplementary explanations aim to add new background knowledge or refine the explanation, such as adding a note on how to understand a specific statement; constraints aim to limit or guide the model's reasoning direction, such as adding a rule requiring a certain factor to be considered in a specific situation. In this way, the original, implicit successful model reasoning information in the first language model is externalized and encoded into a clear, guiding text—the second optimization information.
[0052] The second optimization information directly addresses how to correct the second labeled error. Its content is a straightforward description of the correct reasoning path, enabling the second language model to directly obtain and apply this key insight distilled from the strong model by reading the updated prompts in subsequent iterations, thereby achieving targeted improvement in capabilities.
[0053] The second optimization information generated in this application not only fully retains the core reasoning insights of the first language model but also fully adapts to the understanding and execution capabilities of the second language model, accurately pinpointing the root cause of second-labeling errors. After updating the basic prompts of the second language model with this second optimization information, it effectively guides the second language model to learn the correct reasoning logic of the first language model, compensating for its own reasoning shortcomings, thereby achieving targeted optimization of prompts and continuously improving the annotation performance of the second language model.
[0054] In one possible implementation of this application embodiment, when updating the basic prompt words corresponding to the first language model and / or the second language model respectively, it can also be implemented in the following ways, but not limited to: in response to the annotation correctness result indicating that the second language model has no annotation error and the first language model has an annotation error, the current prompt word content corresponding to the second language model is updated to the first language model, wherein the current prompt word is the basic prompt word or the updated prompt word.
[0055] In the embodiments of this application, when the second language model has no annotation errors while the first language model has annotation errors, it means that for a specific training data sample, the second language model, which is the target being optimized, has successfully completed the correct annotation, while the first language model, which is usually used as a capability reference, has produced incorrect outputs. This situation, which contradicts the conventional assumption (i.e., the stronger model performs better), reveals an important piece of information: in the current iterative state, the prompt words held by the second language model may have evolved into more adaptive and advantageous guidance logic in certain specific scenarios or for certain specific data patterns. This advantage does not stem from the model's inherent superior capabilities, but rather from its prompt words being more effectively shaped or containing more precise guidance information in this localized problem.
[0056] Once the system responds and enters this scenario, the triggered prompt word optimization strategy exhibits a clear unidirectional synchronization characteristic. The core operation of this strategy is to update the current prompt word content corresponding to the second language model to the first language model. Firstly, the current prompt word is a dynamic concept; it refers to the complete prompt word text currently being used by the second language model to drive its annotation of the training data at this point in the optimization process. The initial state of this current prompt word is the basic prompt word, i.e., the original instruction provided by the business side at the start of the process. However, as the optimization loop progresses, it is continuously replaced by updated prompt words. These updated prompt words are new versions generated in previous iterations by executing optimization strategies under scenarios such as Scenario 1 (where both the first and second language models have annotation errors) or Scenario 2 (where the first language model has no annotation errors but the second language model does) (e.g., incorporating inference insights or general correction suggestions from the first language model).
[0057] Performing an update operation—that is, completely overwriting or replacing the prompts currently held by the first language model with the current prompts from the second language model—has multiple underlying logics and direct benefits. From the perspective of knowledge flow, this achieves reverse sharing of optimization results. Although the first language model is usually assumed to be the more capable one, in the context of specific tasks during continuous iteration, the prompts from the second language model may also achieve unique and effective optimizations in solving certain difficult problems. By synchronizing these advantageous prompts with the first language model, it is equivalent to the first language model also learning the strengths of the second language model in specific aspects, thereby enriching the first language model's own guidance capability library. This helps the first language model avoid making the same mistakes in subsequent iterations, improving its analytical quality and reliability as a practice model or reflective model, and potentially generating higher-quality optimization information to assist the second language model in further optimization.
[0058] This application's strategy for updating prompts in the first language model demonstrates flexibility and bidirectional learning potential. It doesn't rigidly adhere to a single path of strong model guiding weak model, but instead constructs a dynamic, bidirectional knowledge exchange channel. When the current prompt content of the second language model proves to be more advantageous locally, it can keenly capture this signal and immediately update the advantageous prompt, allowing the entire collaborative optimization system to continuously absorb all positive evolutionary results, regardless of which model initially generated them. This ensures that the optimization process doesn't get stuck in local optima due to initial model capability assumptions, but rather continuously integrates all the essence of the prompt evolution processes from both models, working together towards more efficient target prompts, ultimately systematically improving the annotation performance of the second language model.
[0059] In one possible implementation of this application embodiment, the process of obtaining the target prompt word optimized by the second language model can be implemented in the following ways, but is not limited to: after each update of the basic prompt word, the training data is re-annotated by the first language model and the second language model using their respective updated prompt words to obtain a first re-annotation result corresponding to the first language model and a second re-annotation result corresponding to the second language model; the first re-annotation result and the second re-annotation result are compared and analyzed with the real labels to obtain the re-annotation correctness results of the first language model and the second language model respectively; in response to the re-annotation correctness result indicating that neither the first language model nor the second language model has any annotation errors, the next training data is processed; if the re-annotation correctness result indicates that the first language model and / or the second language model has annotation errors, the corresponding prompt word optimization strategy is triggered based on different combinations of re-annotation correctness results; until the second language model has no annotation errors on the training data, the target prompt word optimized by the second language model is obtained.
[0060] In the embodiments of this application, a rigorous, closed-loop iterative optimization cycle is constructed. This cycle not only drives the continuous improvement of prompt words but also embeds a strict quality verification and process control mechanism to ensure that the final target prompt words have high reliability and task adaptability. Specifically, this is reflected in the refined management of the cycle process. After each update of the basic prompt words or their evolved versions according to the optimization strategy for a specific scenario, the process does not immediately switch to processing new training data samples or terminate the process. Instead, a round of verification iteration is immediately initiated to evaluate the actual effect of the update and provide a basis for the next step of decision-making.
[0061] The specific verification and iteration steps are as follows: After each update of the basic prompt words, the first and second language models are driven to re-annotate the same training data using their newly acquired updated prompt words. The updated prompt words refer to the latest version of the guidance instructions held by the language models after the optimization strategy modification. The purpose of this re-annotation of the training data is to verify whether the newly incorporated optimization information (such as the first or second optimization information) effectively solves the previously identified problems. After this processing, the first re-annotation result for the first language model and the second re-annotation result for the second language model are obtained. These two re-annotation results represent the latest solution of the language models to the same problem after absorbing new knowledge, and are direct evidence for evaluating the effectiveness of this update.
[0062] After obtaining the re-labeling results, a rigorous quality check is performed again, comparing the first and second re-labeling results with the ground truth labels. This process is identical to the comparison analysis after the initial labeling, but the analysis focuses on the updated output. This analysis yields the re-labeling correctness results for both the first and second language models. The re-labeling correctness result is a state assessment, explicitly indicating whether the labels for that specific training data sample have been corrected after the current round of optimization.
[0063] Next, the next step in the process is determined based on this latest status assessment. If the relabeling correctness result indicates that neither the first nor the second language model has any labeling errors, this means the optimization update was thorough and successful, and both language models have mastered the knowledge required to correctly label the sample. At this point, the next training data set will be processed, meaning the optimization loop for the current training data sample has been successfully closed, and the process can proceed to the next sample in the training dataset to be optimized.
[0064] However, if the relabeling accuracy results indicate that the first language model and / or the second language model contain labeling errors, it means that the update may be insufficient, inaccurate, or have introduced new ambiguities, failing to completely resolve the original problem. In this case, instead of proceeding hastily, corresponding prompt word optimization strategies will be triggered based on different combinations of relabeling accuracy results. This effectively initiates a new, more in-depth optimization and verification sub-loop within the current sample. Based on the latest error combination (e.g., it may change from both being incorrect to only the second language model being incorrect, or vice versa), the corresponding optimization strategy will be invoked again to generate more accurate optimization information and update the prompt words. Then, relabeling and verification will be performed again until the errors for that sample are completely eliminated.
[0065] The entire update-relabeling-validation-decision process described above is continuously performed on each sample in the training data. Ultimately, the loop terminates at a clear and high-quality goal: until the second language model has no labeling errors on the training data. This means that after possible multiple iterations, the prompt words of the second language model have been optimized to the point where they can guide it to correctly process all samples in the entire training dataset. When this condition is met, the loop terminates, outputting the refined prompt words held by the second language model at this point—the optimized target prompt words. This ensures that the final target prompt words are not based on optimization in a single round or with partial data, but rather are high-quality outputs with high generalization ability, rigorously tested with the full training data.
[0066] This application ensures the effectiveness and thoroughness of prompt word optimization by constructing a closed-loop mechanism of update-verification-iteration, avoiding problems such as insufficient or ineffective optimization. Each round of re-annotation and comparative analysis provides clear feedback for subsequent optimizations, enabling the optimization strategy to accurately target the model's inference weaknesses and continuously improve the guidance quality of prompt words. Simultaneously, using the absence of labeling errors on all training data by the second language model as the termination condition ensures the reliability and applicability of the target prompt words. This allows for stable guidance of the second language model to output accurate annotation results in subsequent large-scale data annotation or online inference services, fully leveraging the annotation performance of the production model while controlling deployment costs.
[0067] In one possible implementation of this application embodiment, the preset termination condition includes at least: the second language model has no labeling errors in the training data, or the labeling accuracy of the second language model on the training data reaches a preset accuracy threshold; the training data is natural language text data to be classified into intent or recognized as an entity.
[0068] In the embodiments of this application, setting clear and reasonable process termination criteria is crucial in automated iterative processes, directly affecting the balance between optimization efficiency and final output quality. Preset termination conditions are designed to establish a clear stopping boundary between achieving sufficient optimization results and avoiding unnecessary computational overhead. These preset termination conditions are specified into at least two quantifiable scenarios, providing a flexible and clear basis for termination judgment.
[0069] First, the most stringent and idealized termination condition is that the second language model has no labeling errors in the training data. This means that after several rounds of labeling, comparison, reflection, and updating, the prompt words optimized specifically for the second language model have evolved to the point where they can guide the language model to make judgments that are completely consistent with the true labels for every sample in the entire training dataset. Reaching this condition signifies that the optimization process has achieved perfect adaptation on the training dataset, and the produced target prompt words can cover and correctly handle all known data patterns and edge cases.
[0070] Secondly, considering that pursuing absolute zero error in practical applications may lead to excessively high iteration costs or overfitting to noisy data, a more flexible and economical termination condition is also set: the second language model's annotation accuracy on the training data reaches a preset accuracy threshold. Annotation accuracy is a statistical metric, referring to the percentage of samples whose output matches the true labels when the second language model annotates the entire training dataset under the current prompt word. The preset accuracy threshold is a specific numerical target defined in advance by business requirements or performance goals, such as 95% or 98%. When the current annotation accuracy of the second language model reaches or exceeds this preset accuracy threshold, the optimization goal is considered achieved. This condition allows the process to terminate early when a satisfactory performance level is reached, achieving a better balance between effectiveness and efficiency, and avoiding disproportionate costs incurred for pursuing a few percentage points of improvement.
[0071] On the other hand, the scope of training data was further defined. In specific application scenarios, training data specifically refers to natural language text data to be used for intent classification or entity recognition. The intent classification task aims to determine the intended purpose or intent category behind a user input (such as a query or instruction), for example: classifying "What will the weather be like tomorrow XX?" as a weather query. The entity recognition task aims to identify and extract entity fragments of predefined categories from text, for example: identifying "tomorrow afternoon" (time entity), "XX" (location entity), and "high-speed rail ticket" (ticketing entity) from "booking a high-speed rail ticket to XX tomorrow afternoon". Natural language text data is a collection of such statements, which are free in form and diverse in expression, and each sample is associated with a definite intent category label or entity annotation sequence as a true label.
[0072] This application provides a clear termination standard and precise training medium for the prompt word optimization process by explicitly defining the specific content of the preset termination conditions and the type of training data. The dual setting of preset termination conditions satisfies the stringent requirements of high-accuracy scenarios while adapting to the efficiency requirements of conventional scenarios, significantly improving the flexibility and applicability of the method. Meanwhile, the clear definition of the training data ensures the targeting of the optimization process, enabling the target prompt words to accurately adapt to the core requirements of intent classification or entity recognition tasks. Together, these factors guarantee the standardization and efficiency of the prompt word optimization process, avoiding meaningless iteration and ensuring that the final output target prompt words have stable annotation performance. This allows for efficient guidance of second language models to complete data annotation tasks in real-world business scenarios, fully leveraging the practical value of the production model while controlling deployment costs.
[0073] In one possible implementation of this application embodiment, to facilitate understanding of the implementation process of the prompt word optimization method in this application, this application also provides an example for illustration: As shown in Figure 2, Figure 2 is a flowchart illustrating a prompt word self-optimization method based on bilingual model comparison and reflection provided in this application, which includes: 1) Model selection: Selecting two large language models (LLMs) with different capabilities (i.e., the first language model and the second language model). The powerful LLM-1 (first language model) used as a practice partner can be a general-purpose large model such as GPT-4 or Qwen3-Max, which has strong semantic understanding and reasoning capabilities; the LLM-2 (second language model) used for online production inference can be a model suitable for deployment such as DeepSeek-R1 or DeepSeek-V3, to balance performance and cost.
[0074] 2) Concatenation of prompt words: Prompt word initialization: The basic prompt words provided by the business side are used as the initial prompt words for LLM-1 and LLM-2 respectively.
[0075] 3) Model labeling: For each topic in the training data (i.e. a piece of text to be labeled), LLM-1 and LLM-2 are driven to perform independent labeling (intent classification) using the current prompt word.
[0076] 4) Result comparison: Based on the real labels pre-set for the question, determine whether the labeling results of the two models are correct.
[0077] 5) Summary and Reflection: Dynamic Update of Prompts and Reflection: Based on the combination of LLM-1 and LLM-2 labeling results, different reflection scenarios are entered, and corresponding optimization strategies are adopted: Scenario 1: LLM-1 labels correctly, LLM-2 labels incorrectly. This indicates that LLM-2 failed to grasp a certain key reasoning path or insight possessed by LLM-1. Then, LLM-1 itself (or another dedicated LLM reflector) is used to compare and analyze the labeling results of the two models, summarizing the key reasoning insight that LLM-1 used to make the correct judgment (e.g., using a specific thought chain or noticing certain subtle semantic features). Subsequently, this insight is updated into the prompts of LLM-2 in the form of a natural language description as supplementary explanation or constraint. After the update, LLM-2 will re-label the question, and this cycle continues until the labeling is correct, ensuring effective knowledge transfer.
[0078] Scenario 2: Both LLM-1 and LLM-2 are mislabeled. This indicates that the current task or question may exceed the existing knowledge or guidance capabilities of the two models' prompts. The system will use LLM to reflect on the reasons for the errors and summarize optimization suggestions on how to correctly label the prompts (e.g., clarifying classification boundaries, providing counterexamples or few-sample hints). These suggestions will be updated simultaneously in the prompts of both LLM-1 and LLM-2. Subsequently, the models will relabel, looping until LLM-2 is correctly labeled, thus achieving iterative optimization of the prompts.
[0079] Scenario 3: LLM-1 is incorrectly labeled, while LLM-2 is correctly labeled. This situation may indicate that LLM-2's prompts are more advantageous in certain specific scenarios. In this case, the system will update the current prompt content of LLM-2 to LLM-1, and then directly process the next question to achieve complementary advantages of the prompts.
[0080] 6) Loop Termination Decision: The process terminates when all questions in the training data have been processed and LLM-2 can correctly label all questions (or reach the preset accuracy threshold); otherwise, it continues.
[0081] The system outputs the final optimized, high-quality prompt words specifically for LLM-2, which can be used for subsequent large-scale data annotation or online inference services.
[0082] Figure 3 is a schematic diagram of the structure of a prompt word optimization system provided in an embodiment of this application.
[0083] As shown in Figure 3, the system includes: a model initialization and scheduling module, used to provide the acquired basic prompt words to the first language model and the second language model respectively, wherein the first language model and the second language model have different model capabilities; an automated annotation and result comparison module, used to use the first language model and the second language model to annotate the same set of training data based on their respective basic prompt words, to obtain the first annotation result corresponding to the first language model and the second annotation result corresponding to the second language model; the automated annotation and result comparison module is also used to compare and analyze the first annotation result and the second annotation result with the real labels corresponding to the training data to obtain the annotation correctness results of the first language model and the second language model respectively; a summary and reflection and prompt word optimization module, used to trigger the corresponding prompt word optimization strategy according to different combinations of annotation correctness results, and update the basic prompt words corresponding to the first language model and / or the second language model respectively; and an iteration control and output module, used to obtain the target prompt word optimized by the second language model until the preset termination condition is met.
[0084] In the embodiments of this application, the functions of each module are as follows: Model initialization and scheduling module: Input: basic prompt words provided by the business party, training dataset to be labeled (containing real labels), and application programming interface (API) configuration parameters of LLM-1 and LLM-2.
[0085] Output: Initialized LLM-1 and LLM-2 instances and their corresponding initial prompt word configurations.
[0086] Function: This module is responsible for loading and configuring two large language models with different capabilities, as well as managing the model's API calls and initially injecting prompt words, laying the foundation for subsequent comparisons.
[0087] Automated labeling and result comparison module: Input: a single question text (i.e., the natural language statement to be labeled), the current prompt words of LLM-1 and LLM-2, and the actual label of the question.
[0088] Output: The labeling results generated by LLM-1 and LLM-2 respectively, and the comparison and judgment between the two results and the real labels (correct or incorrect).
[0089] Function: This module uses two models to independently identify or classify the same topic and automatically judges the correctness of the labeling based on the real labels, thus automating the labeling process.
[0090] Summary and Reflection and Prompt Optimization Module: Input: Labeling results of LLM-1 and LLM-2, comparison and judgment results, and current prompt words.
[0091] Output: Optimization suggestions (i.e., "insights" or strategies) generated for different scenarios, and updated LLM-1 and / or LLM-2 prompts.
[0092] Function: This is the core module of the invention. Based on three specific contrast scenarios, it invokes the LLM (usually LLM-1 or a dedicated reflector) to perform self-reflection.
[0093] Iteration control and output module: Input: the entire training dataset, a preset accuracy threshold or loop termination condition.
[0094] Output: The final optimized, high-quality prompt words specifically for LLM-2.
[0095] Function: To control the entire iterative process of "labeling-comparison-reflection-update". It is responsible for traversing all questions in the training data, monitoring the labeling accuracy of LLM-2, and determining whether the termination condition has been met (e.g., all questions are correct or a threshold has been reached). Once the condition is met, the loop terminates and the final optimized hint is output for subsequent online inference services, ensuring automation and a closed-loop process.
[0096] In summary, the embodiments of this application can achieve at least the following technical effects: 1. This application utilizes collaborative annotation and result comparison of different capability models to intelligently identify the root causes of performance differences, and accordingly triggers optimization strategies to accurately extract and transfer the reasoning capabilities of strong models that may appear during the reasoning process to the prompt words of weak models. This significantly reduces the reliance on manual debugging, realizes the autonomous and continuous improvement of prompt words, and ultimately enables the production model to achieve performance close to that of stronger models on specific tasks through optimized prompt words, thereby significantly improving model performance while controlling costs.
[0097] 2. This application constructs an automated closed-loop system of labeling, comparison, reflection, and updating, which can autonomously diagnose the reasons for performance differences between different models (first language model and second language model) on specific tasks, and accurately transfer the reasoning insights of the strong model (first language model) to the prompt words of the weak model (second language model). This reduces the reliance on manual debugging of prompt words based on expert experience, significantly reduces optimization costs, and achieves continuous self-improvement of prompt words.
[0098] 3. This application significantly improves the annotation performance of the production model while controlling costs through dual-model collaboration and knowledge distillation: This design enables the lower-cost and easier-to-deploy production model to absorb the reasoning ability of the strong model, and achieve or approach the performance of the stronger model in classification tasks such as intent recognition. It realizes the effective transfer of knowledge from the strong model to the weak model, solves the problem of poor prompt word effect caused by the difference in ability of different models, and thus achieves an excellent balance between cost and performance.
[0099] 4. The optimization effect of this application is more significant and stable for specific tasks (such as intent tagging): Iterative optimization for specific tasks and data enables the final prompt words to more accurately capture the needs and data characteristics of the task, thereby directly improving the tagging accuracy and stability of the production model in specific scenarios.
[0100] It should be noted that the foregoing explanation of the method embodiments also applies to the system in the embodiments of this application, and the principle is the same. Therefore, the embodiments of this application are not limited thereto.
[0101] According to embodiments of this application, this application also provides an electronic device, a readable storage medium, and a computer program product.
[0102] Figure 4 illustrates a schematic block diagram of an example electronic device 400 that can be used to implement embodiments of this application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the application described and / or claimed herein.
[0103] As shown in Figure 4, device 400 includes a computing unit 401, which can perform various appropriate actions and processes based on a computer program stored in ROM (Read-Only Memory) 402 or a computer program loaded from storage unit 408 into RAM (Random Access Memory) 403. RAM 403 can also store various programs and data required for the operation of device 400. The computing unit 401, ROM 402, and RAM 403 are interconnected via bus 404. I / O (Input / Output) interface 405 is also connected to bus 404.
[0104] Multiple components in device 400 are connected to I / O interface 405, including: input unit 406, such as keyboard, mouse, etc.; output unit 407, such as various types of monitors, speakers, etc.; storage unit 408, such as disk, optical disk, etc.; and communication unit 409, such as network card, modem, wireless transceiver, etc. Communication unit 409 allows device 400 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0105] The computing unit 401 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, CPUs (Central Processing Units), GPUs (Graphics Processing Units), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSPs (Digital Signal Processors), and any suitable processor, controller, microcontroller, etc. The computing unit 401 performs the various methods and processes described above, such as the prompt word optimization method. For example, in some embodiments, the prompt word optimization method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on device 400 via ROM 402 and / or communication unit 409. When the computer program is loaded into RAM 403 and executed by the computing unit 401, one or more steps of the methods described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to perform the aforementioned prompt word optimization method by any other suitable means (e.g., by means of firmware).
[0106] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application-Specific Standard Products), SOCs (System-on-Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0107] The program code used to implement the methods of this application may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0108] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0109] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0110] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include LANs (Local Area Networks), WANs (Wide Area Networks), the Internet, and blockchain networks.
[0111] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service system that addresses the shortcomings of traditional physical hosts and VPS (Virtual Private Server) services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0112] It's important to note that artificial intelligence (AI) is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. AI software technologies primarily include computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graph technologies.
[0113] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this application can be achieved, and this is not limited herein.
[0114] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for optimizing prompt words, characterized in that, include: The acquired basic prompt words are provided to a first language model and a second language model, respectively, wherein the first language model and the second language model have different model capabilities. Using the first language model and the second language model, based on their respective basic prompt words, the same set of training data is labeled, resulting in a first labeling result for the first language model and a second labeling result for the second language model. The first labeling result and the second labeling result are compared and analyzed with the real labels corresponding to the training data to obtain the labeling correctness results for each of the first language model and the second language model. Based on different combinations of the labeling correctness results, a corresponding prompt word optimization strategy is triggered to update the basic prompt words corresponding to the first language model and / or the second language model, until a preset termination condition is met, resulting in the target prompt word optimized by the second language model.
2. The prompt word optimization method according to claim 1, characterized in that, The step of triggering corresponding prompt word optimization strategies based on different combinations of the annotation correctness results and updating the basic prompt words corresponding to the first language model and / or the second language model includes: in response to the annotation correctness results indicating that both the first language model and the second language model have annotation errors, generating first optimization information based on the real labels to correct the first annotation error item corresponding to the first language model and the second annotation error item corresponding to the second language model; and synchronously updating the first optimization information to the basic prompt words corresponding to the first language model and the second language model.
3. The prompt word optimization method according to claim 1, characterized in that, The step of generating first optimization information based on the real labels to correct the first labeling error item corresponding to the first language model and the second labeling error item corresponding to the second language model includes: driving a preset reflection model to perform data annotation on the first labeling error item and the second labeling error item based on the real labels to obtain the first optimization information for correctly annotating the training data.
4. The prompt word optimization method according to claim 1, characterized in that, The step of triggering corresponding prompt word optimization strategies based on different combinations of the annotation correctness results and updating the basic prompt words corresponding to the first language model and / or the second language model includes: in response to the annotation correctness results indicating that the first language model has no annotation errors and the second language model has annotation errors, generating second optimization information based on the reasoning process of the first language model to correct the second annotation error item corresponding to the second language model; and updating the second optimization information to the basic prompt words corresponding to the second language model.
5. The prompt word optimization method according to claim 4, characterized in that, The reasoning process based on the first language model, which generates second optimization information for correcting the second annotation error item corresponding to the second language model, includes: driving the first language model or a preset reflection model to compare and analyze the first annotation result and the second annotation result to obtain model reasoning information in which the second annotation error item is correctly annotated in the first language model; and using the model reasoning information in the form of a natural language description as supplementary explanation or constraint to constitute the second optimization information.
6. The prompt word optimization method according to claim 1, characterized in that, The step of triggering a corresponding prompt word optimization strategy based on different combinations of the annotation correctness results and updating the basic prompt words corresponding to the first language model and / or the second language model respectively includes: in response to the annotation correctness results indicating that the second language model has no annotation errors and the first language model has annotation errors, updating the current prompt word content corresponding to the second language model to the first language model, wherein the current prompt word is the basic prompt word or the updated prompt word.
7. The prompt word optimization method according to claim 1, characterized in that, The process of obtaining the target prompt word optimized by the second language model until a preset termination condition is met includes: after each update of the basic prompt word, re-annotating the training data using the first language model and the second language model with their respective updated prompt words to obtain a first re-annotation result for the first language model and a second re-annotation result for the second language model; comparing the first re-annotation result and the second re-annotation result with the real labels to obtain the re-annotation correctness result for each of the first and second language models; in response to the re-annotation correctness result indicating that neither the first language model nor the second language model has any annotation errors, processing the next piece of training data; if the re-annotation correctness result indicates that the first language model and / or the second language model has annotation errors, triggering the corresponding prompt word optimization strategy based on different combinations of the re-annotation correctness result; until the second language model has no annotation errors on the training data, obtaining the target prompt word optimized by the second language model.
8. The prompt word optimization method according to claim 1, characterized in that, The preset termination conditions include at least: the second language model has no labeling errors in the training data, or the labeling accuracy of the second language model in the training data reaches a preset accuracy threshold; the training data is natural language text data to be classified into intent or recognized as an entity.
9. A prompt word optimization system, characterized in that, include: The model initialization and scheduling module is used to provide the acquired basic prompt words to the first language model and the second language model respectively, wherein the first language model and the second language model have different model capabilities; the automated annotation and result comparison module is used to use the first language model and the second language model to annotate the same set of training data based on their respective basic prompt words, to obtain the first annotation result corresponding to the first language model and the second annotation result corresponding to the second language model; the automated annotation and result comparison module is also used to compare and analyze the first annotation result and the second annotation result with the real labels corresponding to the training data to obtain the annotation correctness result of the first language model and the second language model respectively; the summary and reflection and prompt word optimization module is used to trigger the corresponding prompt word optimization strategy according to different combinations of the annotation correctness results, and update the basic prompt words corresponding to the first language model and / or the second language model respectively; the iteration control and output module is used to obtain the target prompt word optimized by the second language model until a preset termination condition is met.
10. An electronic device, characterized in that, include: At least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.