Text optimization method, computer equipment, storage medium and program product
By selecting suitable models and multi-model evaluation, the optimization prompt words are generated for iterative optimization, which solves the problem of limited effects of large language models in text optimization, and achieves higher quality text optimization.
Patent Information
- Application Number
- CN202510559952.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-08-01
AI Technical Summary
During the text optimization process of existing large language models, due to the limitations of model capabilities and optimization prompt words, the text optimization effect is poor.
By analyzing the characteristics of the target text, selecting the first model and multiple second models that are good at this type of text, generating evaluation prompt words, and using the evaluation results of multiple models to generate optimization prompt words for iterative optimization.
The quality and effect of text optimization are improved, the advantages of different models are fully utilized, the blind spots of a single model are made up for, and the reliability and optimization effect of quality evaluation are improved.
Smart Images

Figure CN120409695A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical fields of artificial intelligence and text processing, and particularly to a text optimization method, a computer device, a storage medium, and a program product. Background Art
[0002] With the rapid development of artificial intelligence technology, large language models (LLMs) have made remarkable progress in the field of text generation and can be used to optimize text.
[0003] To optimize text using a large language model, the user needs to input the text and optimization prompts. The large language model understands the context and performs re-creation based on the text and the requirements of the optimization prompts to achieve text optimization. The effect of this text optimization is limited by the capabilities of the large language model itself and the optimization prompts. If the large language model is not good at processing this type of text or the optimization prompt information is insufficient, it will restrict the effect of text optimization. Summary of the Invention
[0004] To solve the existing technical problems, the present application provides a text optimization method, a computer device, a storage medium, and a program product that can improve the optimization effect and enhance the text quality.
[0005] In a first aspect, a text optimization method is provided, and the method includes:
[0006] Obtain a target text to be optimized;
[0007] Parse the target text to determine text features;
[0008] Determine a first model for optimizing the target text and at least two second models for evaluating the target text from M candidate large language models according to the text features;
[0009] Generate an evaluation prompt according to the target text, each evaluation index and weight of text quality evaluation;
[0010] Input the evaluation prompt into each of the second models to obtain the evaluation results of each of the second models on the target text; the evaluation results include at least one of the quality score, essence, and modification suggestions of the target text;
[0011] Generate an optimization prompt according to the target text and the evaluation results of each of the second models on the target text, and input the optimization prompt into the first model for iterative optimization to obtain the optimization result of the target text.
[0012] In a second aspect, a computer device is provided, including a processor and a memory connected to the processor. A computer program executable by the processor is stored on the memory. When the computer program is executed by the processor, the steps of the text optimization method described in the above embodiments are implemented.
[0013] In a third aspect, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the steps of the text optimization method described in the above embodiments are implemented.
[0014] In a fifth aspect, a computer-readable storage medium is provided. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the steps of the text optimization method described in the above embodiments are implemented.
[0015] For the text optimization method provided in the above embodiments, for a target text, a large language model good at this type of text can be matched according to text features, a first model for optimizing the text is determined, and multiple second models for evaluating the text are determined. This method can give full play to the differential advantages of different large language models in different types of texts and improve the quality of text optimization. According to the target text and the evaluation weights of each evaluation index, an evaluation prompt word is generated; the evaluation prompt word is input into each second model, and the evaluation results of each second model on the target text are obtained; the evaluation results include quality scores, the essence and modification suggestions of the target text. The number of second models is at least two, which can make full use of the advantages of different target models, make up for the blind spots of a single model, and improve the reliability of quality evaluation. This method can automatically generate informative optimization prompt words by using the essence and modification suggestions of the second model evaluation, so that the model can be guided to optimize the target text according to positive and negative examples, and the target text can be optimized according to the essence and modification suggestions, improving the text optimization effect.
[0016] The computer device, computer program product, and computer-readable storage medium provided in the above embodiments belong to the same concept as the corresponding text optimization method embodiments, and thus have the same technical effects as the corresponding text optimization method embodiments, which will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a structural block diagram of a text generation system in an embodiment.
[0018] Figure 2 It is a structural block diagram of a text generation server in an embodiment.
[0019] Figure 3 It is a flowchart of a text optimization method in an embodiment.
[0020] Figure 4 It is a flowchart of a text optimization method in an embodiment.
[0021] Figure 5 It is a flowchart of the steps for sorting M candidate large language models in an embodiment. Detailed implementation manners
[0022] The technical solution of the present invention will be further elaborated in detail below in conjunction with the accompanying drawings of the specification and specific embodiments.
[0023] In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the drawings. The described embodiments should not be regarded as limitations of the present application. All other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present application.
[0024] In the following description, the expression "some embodiments" is involved, which describes a subset of all possible embodiments. It should be noted that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.
[0025] In the following description, the terms "first, second, third" only distinguish similar objects, and do not represent a specific order for the objects. It can be understood that "first, second, third" can be interchanged with a specific order or sequence when allowed, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0026] The present application provides a text generation system, as Figure 1 shown, including a text generation server 100, a plurality of large language models 200 accessed by the text generation server 100, and a terminal 300. The terminal 300 can send a text optimization request to the text generation server 100 based on the HTTP / HTTPS protocol through an application (APP) or a web interface. The text generation server 100 parses the target text to determine the text features; determines a first model for optimizing the target text and at least two second models for evaluating the target text from M candidate large language models according to the text features, generates an evaluation prompt word according to the target text, each evaluation index and weight of the text quality evaluation, inputs the evaluation prompt word into each second model to obtain the evaluation result of each second model on the target text; the evaluation result includes the quality score, essence and modification suggestions of the target text; the text server generates an optimization prompt word according to the target text and the evaluation results of each second model on the target text, inputs the optimization prompt word into the first model for iterative optimization to obtain the optimization result of the target text, and feeds back the text optimization result to the terminal 300.
[0027] As Figure 2As shown, the system architecture of the text generation server includes:
[0028] The user interface layer is used to receive the text generation tasks from the terminal and preprocess the text generation tasks. The user interface layer may include an input processing unit and a preprocessing unit. Among them, the input processing unit is responsible for receiving the text generation tasks from the terminal. The text generation tasks support multi-modal input forms such as text and speech, and support JSON / XML structured data stream input and unstructured natural language input. The preprocessing unit performs data cleaning and format standardization (for example, speech-to-text uses an end-to-end ASR model for noise reduction and frame splitting), and outputs a UTF-8 format text stream with unified encoding. An input cache queue is deployed in this layer, and a double-buffer mechanism is adopted to ensure the throughput in high-concurrency scenarios.
[0029] The intelligent scheduling layer is used to parse the text generation tasks and schedule the text generation tasks to determine N target models that can respond to the text generation tasks. Among them, the intelligent scheduling layer includes an intent understanding module and a dynamic scheduling center. The intent understanding module is used to parse the text generation tasks and determine the text features of the text generation tasks. The dynamic scheduling center is a real-time decision-making engine and resource allocator, which is used to determine N target models that match the text features from M candidate large language models
[0030] The model operation layer is used to deploy and access M candidate large language models. In one embodiment, the model operation layer can deploy differentiated large models such as GPT-4, Claude-3.7, Deepseek-R1, Qwen-Max, etc. Each model has an independent computing container and shares the underlying acceleration resources; the parallel computing unit supports multi-model synchronous generation, and adopts a task segmentation strategy based on tensor parallelism.
[0031] The quality monitoring layer is used to evaluate the generated texts of the N target models and determine the optimal text from the N generated texts as the generation result of the text generation task. In one embodiment, the quality monitoring layer may include a cross-evaluation module, an update module, and a feedback closed-loop module. Among them, the cross-evaluation module is used to implement an inter-model mutual evaluation mechanism; the update module executes a priority dynamic adjustment algorithm to dynamically adjust the model call priority according to the real-time evaluation results; the feedback closed-loop module stores the evaluation results using a MySQL cluster and establishes a model performance map for model optimization.
[0032] As Figure 3 shown, the present application provides a text optimization method, including:
[0033] Step 302, obtain the target text to be optimized.
[0034] The target text to be optimized can be a text input by the user or a text initially generated by any large language model using the text optimization system of the present application.
[0035] Step 304: Parse the target text to determine text features.
[0036] In one embodiment, the text features can represent at least one or more of text type, content type, theme type, and style label.
[0037] In one embodiment, by parsing the target text, multi-level text features can be determined. For example, the multi-level text features at least include at least two of text type, content type, theme type, and style label.
[0038] Step 306: Determine a first model for optimizing the target text and at least two second models for evaluating the target text from M candidate large language models according to the text features.
[0039] Different large language models are good at processing different text types. In this embodiment, according to the text features, the most matching model is selected from M candidate large language models as the first model for optimizing the target text, and relatively matching models are used as the second models for evaluating the target text. The number of second models is at least two.
[0040] In one embodiment, the ability features can be set for each of the M large language models connected in advance. The ability features can be at least one or more of text type, content type, theme type, and style label. The target models with the top N matching degrees with the text features can be determined from M candidate large language models according to the matching degree between the ability features of the large language models and the text features. The model with the highest matching degree among the N target models is used as the first model, and the models with the 2nd to Nth highest matching degrees among the N target models are used as the second models.
[0041] In this embodiment, a large language model good at this type of text can be matched according to the text features for evaluating and optimizing the target text. This method can give full play to the differential advantages of different large language models in different types of texts and improve the quality of text optimization.
[0042] Step 308: Generate an evaluation prompt word according to the target text, as well as each evaluation index and weight of text quality evaluation.
[0043] In one embodiment, the evaluation metrics and their weights for text quality are preset. In one embodiment, for text features, the evaluation metrics and weights for evaluating text quality are determined, so that the evaluation metrics for the text quality of different text features can be different, and the corresponding evaluation metrics are used for evaluation according to different text features, which is beneficial to improving the reliability of the text.
[0044] The evaluation prompt word is the model prompt word used by the input model to instruct the model to evaluate the quality of the generated text. This evaluation prompt word is generated according to the generated text, as well as each evaluation metric and weight, and can guide the model to evaluate the quality of the generated text from the specified evaluation metrics and their weights for the generated text.
[0045] In one example, the prompt word can be: Please score the text "****" in combination with the following evaluation metrics and the weights of the evaluation metrics, find the essence in the text, and put forward suggestions for modifying the text. The evaluation metrics and evaluation weights are: semantic coherence (0.15), domain professionalism (0.15), innovation (0.35), logical integrity (0.25), and format standardization (0.1).
[0046] Step 310, input the evaluation prompt word into each of the second models to obtain the evaluation results of each second model on the target text; the evaluation results include quality scores, essence, and modification suggestions.
[0047] Input the evaluation prompt word of the target text into each second model. The number of second models is at least two. Each second model scores according to the evaluation prompt word and outputs the score of the target text, the essence in the text, and modification suggestions. Thus, the target text can be evaluated by multiple second models, making full use of the advantages of different target models, making up for the blind spots of a single model, and improving the reliability of quality evaluation.
[0048] Step 312, generate an optimization prompt word according to the target text and the evaluation results of each second model on the target text, and input the optimization prompt word into the first model for iterative optimization to obtain the optimized result of the target text.
[0049] In one example, the first model determined for optimizing the target text is model A, and the at least two second models for evaluating the target text are model B and model C respectively. Then the evaluation results include the essence and modification suggestions in the target text identified by model B, and the essence and modification suggestions in the target text identified by model C.
[0050] The optimized prompt can be: For a piece of text "****", where the essence lies in "……(beyond what Model B considers as the essence)", "……(beyond what Model C considers as the essence)", and the modification suggestions are "……(modification suggestions considered by Model B)", "……(modification suggestions considered by Model C)". Please optimize this text by combining the essence beyond and the modification suggestions.
[0051] The optimized prompt is the model prompt used by the input model to instruct the first model to optimize the target text according to the essence and modification suggestions considered by the second model. Based on the target text, as well as the essence and modification suggestions considered by the second model, this optimized prompt can guide the model to optimize the generated text according to the essence and modification suggestions for the target text.
[0052] The above text optimization method can match a large language model proficient in this type of text according to the text features for the target text, determine the first model for optimizing the text, and multiple second models for evaluating the text. This method can give full play to the differential advantages of different large language models in different types of texts and improve the quality of text optimization. Generate an evaluation prompt according to the target text and the evaluation weights of each evaluation index; input the evaluation prompt into each second model to obtain the evaluation results of each second model for the target text; the evaluation results include quality scores, the essence and modification suggestions of the target text. There are at least two second models, which can make full use of the advantages of different target models, make up for the blind spots of a single model, and improve the reliability of quality evaluation. This method can automatically generate an optimized prompt rich in information using the essence and modification suggestions evaluated by the second model, so as to guide the model to optimize the target text according to the positive and negative examples, according to the essence and modification suggestions, and improve the text optimization effect.
[0053] In one embodiment, generating an optimized prompt according to the target text and the evaluation results of each second model for the target text, and inputting the optimized prompt into the first model for iterative optimization to obtain the optimized result of the target text, includes:
[0054] In the case where the quality score of the target text does not meet the conditions, generate an optimized prompt according to the target text, the modification suggestions and essence evaluated by each second model for the target text; the optimized prompt is used to prompt the first model to optimize the target text according to the modification suggestions and essence evaluated by each second model for the target text;
[0055] Input the optimized prompt into the first model to obtain the optimized text for this iteration;
[0056] In the case where the number of optimization iterations does not meet the conditions, update the current optimized text to the target text, and return the step of generating an evaluation prompt word according to the target text, as well as each evaluation index and weight of the text quality evaluation, until the score of the current optimized text meets the requirements or the number of iterations meets the requirements, then end the iterative optimization, and use the current optimized text as the optimization result of the target text.
[0057] Specifically, as Figure 4 shown, the text optimization method includes:
[0058] Step 402, obtain the target text to be optimized.
[0059] Step 404, parse the target text to determine the text features.
[0060] Step 406, determine a first model for optimizing the target text and at least two second models for evaluating the target text from M candidate large language models according to the text features.
[0061] Step 408, generate an evaluation prompt word according to the target text, as well as each evaluation index and weight of the text quality evaluation.
[0062] Step 410, input the evaluation prompt word into each of the second models to obtain the evaluation results of each of the second models on the target text; the evaluation results include the quality score, essence, and modification suggestions of the target text.
[0063] Step 412, determine whether the quality score of the target text meets the conditions. If not, execute step 414; if so, directly output the evaluation result.
[0064] Step 414, generate an optimization prompt word according to the target text, the modification suggestions and essence of each second model evaluating the target text; the optimization prompt word is used to prompt the first model to optimize the target text according to the modification suggestions and essence of each second model evaluating the target text.
[0065] Step 416, input the optimization prompt word into the first model to obtain the current optimized text.
[0066] Step 418, determine whether the current optimization iteration number meets the conditions. If not, execute step 420, update the current optimized text to the target text, and after step 420, return to step 408 until the score of the current optimized text meets the requirements or the number of iterations meets the requirements, then execute step 422, end the iterative optimization, and use the current optimized text as the optimization result of the target text.
[0067] In this embodiment, through the iterative optimization process of repeating optimization - evaluation - generation of optimization prompts and the iteration end condition, the optimization prompts can be continuously improved and enriched according to the evaluation results of the second model, and the text optimization effect can be continuously improved.
[0068] In one embodiment, the first model for optimizing the target text and at least two second models for evaluating the target text are determined from M candidate large language models according to the text features; the ability features of the M candidate large language models are obtained; and according to the matching degree between the ability features of each large language model and the text features, the first model for optimizing the target text and at least two second models for evaluating the target text are determined from the M candidate large language models.
[0069] Specifically, the ability characteristics of each large language model are pre - analyzed, and ability characteristics are set for each large language model according to its ability. In one embodiment, according to the matching degree between the ability characteristics of the candidate large language models and the text features, the M candidate large language models are sorted, and the first model for optimizing the target text and at least two second models for evaluating the target text are determined from the M candidate large language models. Where 1 ≤ N < M.
[0070] Specifically, the candidate large language models are the models accessed by this system. This system can deploy M currently popular large language models and determine N target models that match the text features from the candidate large language models. The number of N can be set according to actual business requirements, for example, N = 3 is set.
[0071] In this embodiment, considering that different large language models are good at processing different types of texts, by determining the first model for optimizing the target text and at least two second models for evaluating the target text according to the matching degree between the ability characteristics of the large language models and the text features, the differential advantages of different large language models in different text tasks can be fully utilized, and the text optimization effect can be improved.
[0072] Specifically, the step of determining the first model for optimizing the target text and at least two second models for evaluating the target text from the M candidate large language models according to the matching degree between the ability characteristics of each large language model and the text features includes: sorting the M candidate large language models from the aspects of historical performance, resource consumption, and the matching degree between the ability characteristics of each large language model and the text features; taking the model ranked first among the M candidate large language models as the first model, and taking the models ranked 2nd to Nth as the second models.
[0073] In this embodiment, a first model for optimizing the target text and at least two second models for evaluating the target text are determined based on historical performance, the similarity between text features and model capability features, and resource consumption. In this embodiment, in addition to considering the matching degree between the capability features of the large language model and the text features, the historical performance and resource consumption of each large language model are also considered.
[0074] In one embodiment, the weights of historical performance, the matching degree between the task and the model, and resource consumption can be preset respectively. Scores are given to each candidate large language model respectively from historical performance, the similarity between task features and model capability features, and resource consumption. According to the weights and the scores of each dimension, the total scores of each candidate large language model are calculated, and the first model for optimizing the target text and at least two second models for evaluating the target text are determined according to the total score ranking.
[0075] Among them, historical performance refers to whether the large language model has performed this type of text generation task in the recent period, and performances such as being adopted as the first model or the second model. In actual operation, a time decay window can be established, with recent task performances having higher weights, and at the same time, a longest traceback period is set to prevent data from becoming outdated.
[0076] Among them, resource consumption refers to the computing time, cost, and hardware resource consumption of the large language model. When the quality is comparable, a lightweight model is preferably selected.
[0077] Among them, the matching degree with text features refers to the matching degree between the capabilities of the large language model and the text features. The capability characteristics of each large language model are analyzed in advance, and capability features are set for each large language model according to the capabilities of each large language. In one embodiment, the matching degree with text features is determined according to the matching degree between the capability features of the candidate large language model and the text features.
[0078] In this embodiment, based on dimensions such as historical performance, resource consumption, and the matching degree with text features, the first model for optimizing the target text and at least two second models for evaluating the target text can be dynamically matched from multiple large language models, so as to achieve the optimal allocation of model resources.
[0079] In one embodiment, M candidate large language models are ranked from historical performance, resource consumption, and the matching degree between the capability features of each large language model and the text features, as Figure 5 shown, including:
[0080] Step 502, according to the historical performance of M candidate large language models, determine the historical performance scores of each candidate large language model.
[0081] Among them, historical performance refers to whether the large language model has performed this type of text generation task in a recent period of time, and performances such as being adopted as the optimal text. In actual operation, the scoring method of historical performance can establish a time decay window, and the recent task performance has a higher weight. For example, the score of a large language model with the above historical performance within one day is 10 points, and the score of a large language model with the above historical performance within one week is 5 points. According to the historical performance of M candidate large language models and the scoring method, determine the historical performance scores of each candidate large language model.
[0082] Step 504: Determine the matching scores of each candidate large language model according to the matching degree between the ability characteristics of each candidate large language model and the text characteristics.
[0083] Specifically, pre-analyze the ability characteristics of each large language model, and set ability characteristics for each large language model according to the ability of each large language. In one embodiment, according to the matching degree between the ability characteristics of the candidate large language model and the text characteristics, determine the matching degree with the text characteristics. Among them, the matching degree is directly proportional to the matching score, and the higher the matching degree, the higher the matching score. For example, if the matching degree is 100%, the matching score can be 100 points.
[0084] Step 506: Determine the energy consumption scores of each candidate large language model according to the resource energy consumption of each candidate large language model.
[0085] Resource energy consumption refers to the computing time, cost, and hardware resource consumption of the large language model. Among them, the resource energy consumption of each candidate large language model can be determined in advance according to the computing time, cost, and hardware resource consumption of the large language model. It can also be updated regularly according to the computing time, cost, and hardware resources within a period of time to ensure the timeliness of the resource energy consumption evaluation.
[0086] Step 508: Perform a weighted summation process on the historical performance scores, matching scores, and energy consumption scores of each candidate large language model according to the evaluation weights to obtain the scores of each candidate large language model.
[0087] Specifically, according to the weights of historical performance, resource energy consumption, and the matching degree with text characteristics, perform a weighted summation process on the historical performance scores, matching scores, and energy consumption scores of each candidate large language model respectively to obtain the scores of each candidate large language model.
[0088] In one embodiment, the formula for calculating the score of the candidate large language model is:
[0089] PriorityScore(t)_m = α * S(t)_hist + β * C(t)_eval + γ * D(t)_domain
[0090] Where: m is the model identifier, m ∈ {1, 2, …, M}, t is the serial number of the time period, α is the evaluation weight of historical performance, β is the evaluation weight of the matching degree with text features, γ is the evaluation weight of resource energy consumption, and α + β + γ = 1; S(t)_hist is the historical performance score, C(t)_evl is the matching score, and D(t)_domain is the energy consumption score;
[0091] Among them, S(t) hist = (∑(k = 1 to k)^λ(t - k) * R(k)_m / ∑(k = 1 to k)λ^(t - k), where λ is the time decay factor, λ ∈ (0, 1), and R(k)_m is the score of the model in the k-th period.
[0092] Step 510, sort the M candidate large language models according to their scores.
[0093] Specifically, sort each candidate large language model according to the scores of the M candidate large language models, and select the top N target models with the highest scores from the M candidate large language models. N can be flexibly set according to requirements. In one embodiment, N is 3, so the top three large language models with the highest scores are selected from the M candidate large language models. The model ranked first is used as the first model, and the models ranked second and third are used as the second model.
[0094] In this embodiment, a model priority algorithm that fuses the time decay factor, domain adaptability, and resource energy consumption is developed to achieve the balanced optimization of historical performance, real-time capabilities, and resource energy consumption, and to achieve the optimal allocation of model resources.
[0095] In one embodiment, parsing the target text to determine text features includes: parsing the text to determine the text category; and determining text features according to the text category.
[0096] In one embodiment, the text generation server parses the text to determine the text category and determines text features according to the text category. Among them, the text features may include at least one or more of text type, content type, theme type, and style label.
[0097] In one embodiment, by parsing the text, multi-level text categories can be determined, and based on the multi-level text categories, text features can be obtained. Among them, the multi-level text category is a structured and extensible classification framework, which decomposes complex tasks into sub-classifications with clear boundaries and relevance through hierarchical relationships. Among them, the hierarchical depth of the multi-level text category can be defined according to the actual task, which is not limited here. In one embodiment, the multi-level text category may include first-level (major categories), second-level (sub-categories), third-level (styles)-fourth-level (plot settings). For example, the multi-level text category includes at least two of text type, content type, theme type, and style label. For example, taking a science fiction short story with the theme of quantum time travel as an example, it can be determined that its multi-level task categories include: literary creation, short story, science fiction, Liu Cixin style, time paradox plot.
[0098] In this embodiment, by classifying the text, text features are determined.
[0099] In one embodiment, according to the text features, each evaluation index and weight of text quality evaluation are determined.
[0100] Some existing methods for evaluating the quality of text generation usually adopt general indicators (such as BLEU, ROUGE, etc.), which are difficult to accurately evaluate according to the unique requirements of specific tasks, thus reducing the reliability of the generated text.
[0101] In this embodiment, for the text generation task, the evaluation index and weight for evaluating the text generation quality of this text generation task are determined, so that the evaluation indexes for the text generation quality of different text generation tasks can be different, and the corresponding evaluation indexes are used for evaluation for different text generation tasks, which is beneficial to improving the reliability of the text.
[0102] In one embodiment, the evaluation indexes include at least two of semantic coherence, domain professionalism, innovation, logical integrity, and format standardization.
[0103] In one embodiment, the target text is classified according to the text features, and for different types of target texts, the evaluation indexes of their text quality are different. For example, classifying the target text according to the text features may include literary creation, contract generation, paper generation, report generation, business copywriting generation, travel guide generation. For texts such as literary creation, evaluation can be focused on semantic coherence and innovation, and higher weights can be set for these two indexes. For the two types of texts, papers and reports, evaluation can be focused on domain professionalism and logical integrity, and higher weights can be set for these two indexes.
[0104] In a specific implementation manner, a mapping table of quality evaluation indicators corresponding to different types of texts can be established. By looking up the table, the quality evaluation indicators and their weights corresponding to this type of text can be determined.
[0105] For different text features, determine the evaluation indicators and weights for evaluating text quality, so as to evaluate different types of texts using their corresponding evaluation indicators, which is beneficial to improving the reliability of text evaluation, and then provide a reliable evaluation for target text optimization, and improve the accuracy and richness of optimization prompts.
[0106] The text optimization method of the present application has the following technical effects:
[0107] 1. It can automatically generate information-rich optimization prompts by using the essence of model evaluation and modification suggestions, so that the model can be guided to optimize the target text according to positive and negative examples, and the target text can be optimized according to the essence and modification suggestions, improving the text optimization effect.
[0108] 2. By repeating the iterative optimization process of optimization - evaluation - generating optimization prompts and the iteration end condition, the optimization prompts can be continuously improved and enriched according to the evaluation results of the second model, and the text optimization effect can be continuously improved.
[0109] 3. For different text features, determine the evaluation indicators and weights for evaluating text quality, so as to evaluate different types of texts using their corresponding evaluation indicators, which is beneficial to improving the reliability of text evaluation, and then provide a reliable evaluation for target text optimization, and improve the accuracy and richness of optimization prompts.
[0110] 4. Develop a model priority algorithm that fuses time decay factor, domain adaptability, and resource energy consumption to achieve balanced optimization of historical performance, real-time capabilities, and resource energy consumption, and achieve optimal allocation of model resources.
[0111] On the other hand, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements each process of the above text optimization method embodiment and can achieve the same technical effects. To avoid repetition, it will not be elaborated here. Among them, the computer-readable storage medium is, for example, a read-only memory (Read-Only Memor, abbreviated as ROM), a random access memory (Random Access Memory, abbreviated as RAM), a magnetic disk, or an optical disc, etc.
[0112] On the other hand, an embodiment of the present application further provides a computer device, which includes a processor and a memory connected to the processor. A computer program executable by the processor is stored on the memory. When the computer program is executed by the processor, it implements each process of the embodiment of the text optimization method and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0113] On the other hand, an embodiment of the present application further provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements each process of the embodiment of the text optimization method and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0114] It should be noted that in this document, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the element.
[0115] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disc) and includes several instructions for causing a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0116] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present application, and all of them should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A text optimization method, characterized in that, The method includes: Obtain the target text to be optimized; Parse the target text to determine the text features; Determine a first model for optimizing the target text and at least two second models for evaluating the target text from M candidate large language models according to the text features; Generate an evaluation prompt word according to the target text, each evaluation index and weight of text quality evaluation; Input the evaluation prompt word into each of the second models to obtain the evaluation results of each of the second models on the target text; the evaluation results include the quality score, essence and modification suggestions of the target text; Generate an optimization prompt word according to the target text and the evaluation results of each of the second models on the target text, and input the optimization prompt word into the first model for iterative optimization to obtain the optimization result of the target text.
2. The method according to claim 1, wherein Generating an optimization prompt word according to the target text and the evaluation results of each of the second models on the target text, and inputting the optimization prompt word into the first model for iterative optimization to obtain the optimization result of the target text, including: In the case where the quality score of the target text does not meet the conditions, generate an optimization prompt word according to the target text, the modification suggestions and essence of each of the second models evaluating the target text; the optimization prompt word is used to prompt the first model to optimize the target text according to the modification suggestions and essence of each of the second models evaluating the target text; Input the optimization prompt word into the first model to obtain the optimized text for this time; In the case where the number of optimization iterations does not meet the conditions, update the optimized text for this time to the target text, and return to the step of generating an evaluation prompt word according to the target text and each evaluation index and weight of text quality evaluation, until the score of the optimized text for this time meets the requirements or the number of iterations meets the requirements, then end the iterative optimization, and use the optimized text for this time as the optimization result of the target text.
3. The method according to claim 1, wherein Determine a first model for optimizing the target text and at least two second models for evaluating the target text from M candidate large language models according to the text features; Obtain the ability features of M candidate large language models; Determine a first model for optimizing the target text and at least two second models for evaluating the target text from M candidate large language models according to the matching degree between the ability features of each large language model and the text features.
4. The method according to claim 3, wherein Determining a first model for optimizing the target text and at least two second models for evaluating the target text from M candidate large language models according to the matching degree between the ability features of each large language model and the text features, including: Sort M candidate large language models according to historical performance, resource consumption and the matching degree between the ability features of each large language model and the text features; Use the model ranked first among the M candidate large language models as the first model, and use the models ranked 2nd to Nth as the second models.
5. The method according to claim 4, characterized in that Sort the M candidate large language models according to their historical performance, resource consumption, and the matching degree between the ability characteristics of each large language model and the text characteristics, including: Determine the historical performance scores of each candidate large language model according to the historical performance of the M candidate large language models; Determine the matching scores of each candidate large language model according to the matching degree between the ability characteristics of each candidate large language model and the text characteristics; Determine the energy consumption scores of each candidate large language model according to the resource consumption of each candidate large language model; Perform weighted summation processing on the historical performance scores, matching scores, and energy consumption scores of each candidate large language model according to the evaluation weights to obtain the scores of each candidate large language model; Sort the M candidate large language models according to the scores of the candidate large language models.
6. The method according to claim 1, wherein Parsing the target text to determine text characteristics includes: Parse the text to determine the text category; Determine text characteristics according to the text category.
7. The method according to claim 1, wherein The method further includes: determining each evaluation index and weight of text quality evaluation according to the text characteristics.
8. A computer device, characterized in that, It includes a processor and a memory connected to the processor, and a computer program executable by the processor is stored on the memory. When the computer program is executed by the processor, the steps of the text optimization method according to any one of claims 1 to 7 are implemented.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, the steps of the text processing method based on multi-dimensional evaluation according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium. When the computer program is executed by the processor, the steps of the text optimization method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Cboth modification method and device, terminal and storage medium
CN120781806A