Cboth quality inspection and model training method and device, storage medium and product
Through the combination of multiple basic inspection models and comprehensive evaluation models, the refinement and global quality inspection of copywriting is achieved, the problem of insufficient quality in the automatic copywriting generation tool is solved, and the detection accuracy and automation level are improved.
Patent Information
- Application Number
- CN202510418479.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-08-05
AI Technical Summary
Existing automatic copywriting generation tools have problems with insufficient quality when generating copywriting, especially in a business environment, which is difficult to meet the requirements of creativity, attractiveness and advertising regulations at the same time, and traditional manual reviews are inefficient and costly.
Multiple basic inspection models are used to detect the characteristics of copywriting in different quality dimensions, and by generating a comprehensive evaluation model with larger input parameters of the inspection prompt word and copywriting feature vector, global multi-angle quality detection is carried out.
It improves the accuracy and robustness of copywriting detection, realizes refined and global quality evaluation of copywriting, and reduces the workload and cost of manual review.
Smart Images

Figure CN120430799A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of this specification relate to the field of document quality inspection technology, and in particular, to a document quality inspection method, a model training method, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] In recent years, with the rapid development of artificial intelligence (AI) technology, automatic copy generation tools have gained widespread application in advertising, brand marketing, and product promotion. Leveraging big data and deep learning algorithms, these tools can efficiently produce large volumes of copy, significantly satisfying the demand for efficient content creation by businesses, individuals, and organizations. However, due to differences in generation model architecture, training data, and algorithmic strategies, automatically generated copy often falls short in certain quality dimensions. For example, in commercial environments, copy must not only be creative and engaging, but also strictly adhere to advertising regulations and avoid inappropriate content to avoid negatively impacting brand image and market effectiveness.
[0003] Although the traditional quality inspection method that relies on manual review can detect problems to a certain extent, it often has limitations such as large workload, low review efficiency, and high cost when faced with massive amounts of copywriting. Summary of the Invention
[0004] In view of this, one or more embodiments of this specification provide a copy quality inspection method, a model training method, an electronic device, a computer-readable storage medium, and a computer program product.
[0005] To achieve the above objectives, one or more embodiments of this specification provide the following technical solutions:
[0006] According to a first aspect of one or more embodiments of this specification, a method for checking the quality of a document is provided, comprising:
[0007] Get the document to be checked;
[0008] Using at least one trained basic inspection model, inspect the quality of the document to be inspected in at least one quality dimension, obtaining a first quality inspection result output by the output layer of each basic inspection model and a document feature vector output by the last hidden layer of each basic inspection model; different basic inspection models correspond to different quality dimensions;
[0009] Generating inspection prompt words based on the document to be inspected, and inputting the inspection prompt words and the document feature vector into a trained comprehensive evaluation model, so that the comprehensive evaluation model can inspect the quality of the document to be inspected in multiple quality dimensions to obtain a second quality inspection result; wherein the number of parameters of the comprehensive evaluation model is greater than the number of parameters of the basic inspection model;
[0010] The first quality inspection result and the second quality inspection result are output.
[0011] According to a second aspect of the embodiments of this specification, a model training method is provided, including:
[0012] Acquire multiple training samples, each training sample including an input document, a basic quality label of the input document in each quality dimension, and a comprehensive quality label of the input document in the multiple quality dimensions;
[0013] Inputting the input document into at least one basic inspection model to be trained, so that each basic inspection model inspects the quality of the input document in a specified quality dimension, obtaining a first quality inspection result output by an output layer of each basic inspection model to be trained and a document feature vector output by a last hidden layer of each basic inspection model; wherein different basic inspection models correspond to different quality dimensions; and
[0014] Inputting the inspection prompt words generated from the input text and the text feature vector into the comprehensive evaluation model to be trained to obtain a second quality inspection result; wherein the number of parameters of the comprehensive evaluation model is greater than the number of parameters of the basic inspection model;
[0015] Training the at least one basic inspection model to be trained and the comprehensive evaluation model with minimizing the error between the first quality inspection result and the basic quality label, and / or minimizing the error between the second quality inspection result and the comprehensive quality label, belonging to the same quality dimension as an optimization goal;
[0016] Among them, at least one trained basic inspection model and a trained comprehensive evaluation model are applied to the copywriting quality inspection method described in the first aspect.
[0017] According to a third aspect of the embodiments of this specification, there is provided an electronic device, including:
[0018] processor;
[0019] a memory for storing processor-executable instructions;
[0020] When the processor executes the executable instructions, it is used to implement the method described in the first aspect or the second aspect.
[0021] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of the method described in the first aspect or the second aspect are implemented.
[0022] According to a fifth aspect of the embodiments of this specification, a computer program product is provided, comprising a computer program, which implements the steps of the method described in the first aspect or the second aspect when executed by a processor.
[0023] The technical solutions provided by the embodiments of this specification may have the following beneficial effects:
[0024] The copy quality detection method provided in the embodiments of this specification, after obtaining the copy to be checked, first uses at least one trained basic inspection model to check the quality of the copy to be checked. Each basic inspection model focuses on detecting a specific quality dimension, making the detection more targeted and refined. Not only the first quality inspection result output by the output layer of each basic inspection model is obtained, but also the copy feature vector output by the last hidden layer of each basic inspection model is obtained. The copy feature vector can more comprehensively represent the inherent characteristics of the copy, providing a rich intermediate representation for subsequent comprehensive evaluation. Next, the prompt word generated by the copy to be checked and the above-mentioned copy feature vector are passed as input to a comprehensive evaluation model with a larger number of parameters to obtain a second quality inspection result output by the comprehensive evaluation model. By integrating the inspection prompt word and the copy feature vector, the comprehensive evaluation model can perform global and multi-angle detection of the copy. Because the number of parameters of the comprehensive evaluation model is greater than that of the basic inspection model, that is, the comprehensive evaluation model has a stronger ability to process complex semantics and contextual information, further improving the accuracy and robustness of detection.
[0025] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a flowchart of a model training method provided by an exemplary embodiment.
[0027] Figure 2 It is a flowchart of another model training method provided by an exemplary embodiment.
[0028] Figure 3 It is a structural block diagram of a comprehensive evaluation model provided by an exemplary embodiment.
[0029] Figure 4 This is a structural block diagram of a target Transformer layer provided by an exemplary embodiment.
[0030] Figure 5 The present invention is a flowchart of a method for checking the quality of a copy provided by an exemplary embodiment.
[0031] Figure 6 This is a flowchart of another copywriting quality inspection method provided by an exemplary embodiment.
[0032] Figure 7 It is a structural diagram of an electronic device provided by an exemplary embodiment. DETAILED DESCRIPTION
[0033] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The implementations described in the following exemplary embodiments are not intended to represent all implementations consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with certain aspects of one or more embodiments of this specification, as detailed in the appended claims.
[0034] It should be noted that in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or fewer steps than those described in this specification. In addition, a single step described in this specification may be broken down into multiple steps for description in other embodiments, and multiple steps described in this specification may be combined into a single step for description in other embodiments.
[0035] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse.
[0036] Here are some explanations of the terms that appear in the embodiments of this specification:
[0037] 1. Transformer: A deep learning model architecture, a model based on the attention mechanism, specifically designed to process sequence data, especially in the field of natural language processing, it has achieved remarkable success.
[0038] 2. Attention: A core component of the Transformer, it is a mechanism for processing sequential data, particularly suitable for natural language processing tasks. The attention mechanism allows the model to consider information about all other elements in the sequence when processing each element in the sequence, thereby capturing long-range dependencies and better understanding context.
[0039] Exemplarily, the implementation of the attention mechanism includes the following steps:
[0040] First, the query, key, and value transformations are involved. For each input position, three vectors are obtained through linear transformation: the query vector (q), the key vector (k), and the value vector (v). These vectors are used to calculate the attention score and generate the output. By calculating the similarity between the query vector and each key vector (usually using the dot product or other similarity function), the attention score of each position with respect to all other positions is obtained. Finally, the attention score is used to weight the sum of all value vectors to generate the final output.
[0041] It can be expressed as the following formula:
[0042] q=XW Q ;
[0043] k=XW K ;
[0044] v=XW V ;
[0045]
[0046] out=attnW o .
[0047] Where X represents the input vector, W Q represents the query matrix learned during model training, W K represents the key matrix learned during model training, W V Represents the value matrix learned during model training, q represents the Query vector, k represents the Key vector, v represents the Value vector, and softmax() is the scaling and normalization function. is the scaling factor (used to scale the dot product result to a moderate range to alleviate the problem of numerical instability), d is the dimension of the Query vector, and k T is the transpose of the Key vector, W o Represents the output weight learned during model training, and out represents the final output.
[0048] 3. Self-attention mechanism: This allows each element in the input sequence to pay attention to all elements in the sequence (including itself) in order to compute its output representation. This process helps capture long-range dependencies in the sequence. The implementation of self-attention usually includes the following steps:
[0049] (1) Linear transformation: For each token in the input sequence, three learnable weight matrices W are used Q 、W V and W K , mapping them to query (Query, Q), key (Key, K) and value (Value, V) vector spaces respectively.
[0050] (2) Calculate attention scores: Use dot product or other similarity functions to calculate the degree of match or correlation between each query and all other keys. The result of this step is a score matrix that represents the strength of association between different elements.
[0051] (3) Softmax normalization: A softmax operation is performed on the attention scores to ensure that the scores of each row add up to 1, resulting in a probability distribution that reflects the importance of each element in the current context.
[0052] (4) Weighted summation: Using the probability distribution obtained in the previous step as the weight, perform weighted summation on the Values to generate the final output representation for each position.
[0053] To increase the expressiveness of the model, the self-attention mechanism typically uses a multi-head approach, executing multiple of the above steps simultaneously, each using a different set of parameters. Finally, the outputs of each head are concatenated and passed through an additional linear layer to obtain the final output.
[0054] 4. Cross-Attention: This mechanism performs attention calculations between two different input sequences. Specifically, when processing one sequence (such as the target sequence), it relies on another sequence (such as the source sequence) to generate a better representation. In cross-attention, one sequence is the key and value, and the other is the query.
[0055] Assume there are two input sequences: (1) Sequence A (Query sequence): used to generate the Query vector (q); (2) Sequence B (Key-Value sequence): used to generate the Key vector (k) and the Value vector (v).
[0056] First calculate the Query vector (q), Key vector (k) and Value vector (v): q = X A WQ ; k=X B W K ; v = X B W V ;X A is the representation of sequence A, X B is the representation of sequence B, W Q represents the query matrix learned during model training, W K represents the key matrix learned during model training, W V Represents the value matrix learned during model training, q represents the Query vector, k represents the Key vector, and v represents the Value vector.
[0057] The attention score is then calculated using the following formula: Finally, the value vectors are weighted and summed by the attention scores to obtain the enhanced representation of sequence A in the context of sequence B.
[0058] Based on the problems in the related art, the embodiments of this specification provide a model training method and a copy quality inspection method.
[0059] In some embodiments, see Figure 1 as well as Figure 2 The embodiments of this specification provide a model training method that can be performed by electronic devices, including but not limited to physical servers, server clusters, cloud servers, smart phones / mobile phones, tablet computers, personal digital assistants (PDAs), laptop computers, and desktop computers. The training method includes:
[0060] In S101 , a plurality of training samples are obtained, each of which includes an input document, basic quality labels of the input document in each quality dimension, and comprehensive quality labels of the input document in multiple quality dimensions.
[0061] In this step, we collect a large number of training samples to provide authentic and comprehensive supervisory signals for subsequent model training, ensuring that the model can fully learn and capture the characteristics of the copywriting across multiple quality dimensions, such as format, grammar, and content legality. Diverse and high-quality training samples effectively improve the model's generalization capabilities, enabling it to maintain high detection accuracy across different styles and types of copywriting.
[0062] For example, the quality dimensions include but are not limited to at least one of the following: grammatical correctness, format compliance, content eligibility, keyword checking, contextual coherence, and emotional tendency. Among them, (1) grammatical correctness refers to whether the copy follows the grammatical rules of the target language, including tense usage, subject-verb agreement, sentence structure, pronoun reference, subjunctive mood, and other grammatical correctness. Grammatical errors can make sentences unclear or difficult to understand, and even affect the professionalism of the text. (2) Format compliance refers to whether the text meets the predetermined format requirements, which is usually particularly important in formal documents or publications, including the uniformity and standardization of paragraph structure, title hierarchy, citation specifications, font size, line spacing, etc. (3) Content eligibility refers to whether the text meets the subject requirements and the content is sufficient, accurate, and does not contain misleading or erroneous information. This dimension ensures the authenticity, validity, and applicability of the text content. (4) Keyword checking mainly focuses on whether relevant keywords are effectively used in the text, which is especially important for search engine optimization articles, marketing copywriting, or academic writing. Reasonable keyword use helps the text be better discovered by target readers or search engines, or better reflect the marketing theme. (5) The contextual coherence dimension focuses on the logical structure and coherence of the text, whether the various parts of the text can be smoothly connected, whether the information is presented in a reasonable order, and whether there are no sudden transitions or logical confusion. (6) The emotional tendency dimension focuses on the emotions or emotional colors conveyed in the text. Especially in situations where objectivity and neutrality are required, such as news reporting and academic writing, the emotional tendency dimension helps ensure that the text is free of bias and excessive emotional color, and remains neutral and fair. These six quality dimensions cover multiple checkpoints in the copywriting process and help ensure the professionalism, logic, readability and applicability of the copy.
[0063] Those skilled in the art will appreciate that, in different application scenarios, the inspection of certain quality dimensions may be further increased or decreased as needed, and this embodiment does not impose any limitation on this.
[0064] Among them, for the inspection of individual quality dimensions, in addition to the input copy, other input content may be required. Therefore, the training samples can also include other input content in addition to the input copy. For example, for the keyword inspection dimension, other input content includes the keywords to be checked, so as to check whether these keywords are contained in the input copy.
[0065] Exemplarily, the basic quality labels of each quality dimension can be binary classification labels, such as {"qualified" and "unqualified"} or {"positive" and "negative"}, etc.; it can also be multi-category labels, such as {"excellent", "good", "medium", "poor"}, {"high", "medium", "low"}, {"positive", "neutral", "negative"} or numerical scores within a preset value range, such as {"1", "2", "3", "4", "5"}, etc.; it can also be a text description label, such as the basic quality label corresponding to the emotional tendency dimension is "This article is full of positive emotions and emphasizes how scientific and technological progress improves the quality of life"; or it can be other forms of expression, which are not limited in this embodiment.
[0066] Exemplarily, the above-mentioned comprehensive quality label may include at least one of the following: a binary classification label, a multi-classification label, a numerical score within a preset value range, and a text description label, etc., but is not limited thereto.
[0067] In one example, suppose a positive sample has the following: ① The input copy is "With the continuous development of society, many people have begun to ignore the simple happiness in life. We are busy with work and various tasks every day, but forget to enjoy and cherish the time spent with family and friends. After this pressure accumulates, our hearts often feel empty." ② Other input content, such as the keywords to be checked, include "simple happiness", "pressure accumulation", "time spent with family", etc.
[0068] ① The basic quality label for the grammatical correctness dimension is "Pass"; ② The basic quality label for the format compliance dimension is "Pass"; ③ The basic quality label for the content conformity dimension is "Pass"; ④ The basic quality label for the keyword check dimension is "Pass"; ⑤ The basic quality label for the contextual coherence dimension is "Pass"; ⑥ The basic quality label for the emotional tendency dimension is "Positive"; ⑦ The overall quality label is "The input copy passes the overall assessment. The copy performs well in all quality dimensions. The content is thoughtful and the emotions conveyed are positive. It is suitable for lifestyle articles or emotional blogs."
[0069] In another example, suppose there is a negative sample. ① The input copy is "People are always under a lot of pressure, but these things have no effect on the body. It doesn't matter if you work more. It's like this anyway. People always want to rest. In fact, work is life, and it doesn't matter if you are in poor health." ② Other input content, such as the keywords to be checked include "simple happiness" and "pressure".
[0070] ① The basic quality label for the grammatical correctness dimension is "unqualified"; ② The basic quality label for the format compliance dimension is "qualified"; ③ The basic quality label for the content conformity dimension is "unqualified"; ④ The basic quality label for the keyword check dimension is "unqualified"; ⑤ The basic quality label for the contextual coherence dimension is "unqualified"; ⑥ The basic quality label for the emotional tendency dimension is "negative"; ⑦ The overall quality label is "The overall evaluation of this input copy is unqualified. This copy has obvious problems, is grammatically incoherent, conveys incorrect health concepts, and has a negative emotional tendency, which may lead to misleading and unhealthy thinking."
[0071] In S102, the input copy is input into at least one basic inspection model to be trained, so that each basic inspection model checks the quality of the input copy in a specified quality dimension, and obtains the first quality inspection result output by the output layer of each basic inspection model to be trained and the copy feature vector output by the last hidden layer of each basic inspection model; wherein different basic inspection models correspond to different quality dimensions.
[0072] Exemplarily, the basic checking model includes at least one of the following: a first basic checking model for checking the grammatical correctness of a document, a second basic checking model for checking the format compliance of a document, a third basic checking model for checking the content eligibility of a document, a fourth basic checking model for checking whether a document contains keywords, a fifth basic checking model for checking the contextual coherence of a document, and a sixth basic checking model for checking the emotional tendency of a document; but the present invention is not limited thereto. Each training sample further includes keywords to be checked corresponding to the input document, and the input of the fourth basic checking model to be trained includes the input document and the keywords to be checked.
[0073] For example, see Figure 2 Each basic inspection model includes an input layer, at least one hidden layer, and an output layer. The hidden layer can be a Transformer layer, but is not limited thereto.
[0074] In this step, the input document is passed to each basic inspection model to be trained. Each basic inspection model focuses on detecting a specific quality dimension. During the detection process, the basic inspection model not only outputs the preliminary evaluation results of the corresponding quality dimension (the first quality inspection result), but also extracts the deep feature vector of the document through the last hidden layer. In this process, specialized detection enables the characteristics of each quality dimension to be carefully characterized, and the document feature vector provides a rich information basis for the subsequent comprehensive evaluation, thereby achieving an effective combination of local details and overall features, and effectively controlling the subsequent comprehensive evaluation model to better complete the document quality evaluation.
[0075] For example, if each basic inspection model has preset input rules for input data, before inputting the input document into each basic inspection model, the input document can be processed based on the input rules corresponding to each basic inspection model to obtain a processed input document that meets the requirements.
[0076] For example, suppose the input rule is a character limit requirement, such as limiting the minimum length of the input copy to 50 characters and the maximum length to 1000 characters. If the length of the input copy exceeds the maximum length limit, the input copy may need to be processed in segments.
[0077] For example, let's assume the input rule requires the input data format, such as requiring the input document to be submitted in a specific format, such as .txt or .csv, rather than .docx or .pdf. If the input document comes from a spreadsheet or database, you may need to convert it to a format acceptable to the model, such as .csv or .txt.
[0078] In S103, the inspection prompt words and the text feature vector generated by the input text are input into the comprehensive evaluation model to be trained to obtain a second quality inspection result; wherein the parameter quantity of the comprehensive evaluation model is greater than the parameter quantity of the basic inspection model.
[0079] In this step, the electronic device generates a check prompt based on the input text. These prompts, along with the text feature vector extracted by the basic model, are then fed into a comprehensive evaluation model with a larger set of parameters and greater capabilities. This comprehensive evaluation model utilizes a rich set of parameters and a complex structure to perform a comprehensive, cross-dimensional quality assessment of the text, generating a second quality check result. This model leverages the local information extracted during the basic inspection phase and, through comprehensive analysis, produces a more refined and comprehensive evaluation result, providing a more reliable basis for subsequent decision-making.
[0080] In one possible implementation, the check prompt can include at least one check example, consisting of a sample text and the quality check results for that sample text. By incorporating check examples, the comprehensive evaluation model can leverage existing concrete references when evaluating input text in the training sample, enabling more accurate and rapid analysis. This not only improves the quality and consistency of text checks but also provides clear improvement directions, thereby promoting optimized copywriting.
[0081] Exemplarily, a prompt word template including at least one inspection example may be preset, and then the input text in each training sample may be embedded into the input template to obtain an inspection prompt word including the input text and at least one inspection example.
[0082] For example, consider the example copy: "Our product is an advanced smartphone with an exceptionally long battery life and excellent camera capabilities. It also features fast charging and a powerful processor, making it suitable for a variety of use cases." Quality inspection results include: ① Clarity: The copy clearly conveys the product's key features, using concise and easy-to-understand language, meeting the basic requirements of advertising copy. ② Appeal: By mentioning keywords such as "extra-long battery life" and "excellent camera capabilities," it is able to attract the interest of target consumers. ③ Grammar: The copy contains no grammatical errors, and its sentence structure is fluent and in line with standards. ④ Information Completeness: The copy provides comprehensive information on several key features of the smartphone. Providing inspection examples allows the comprehensive evaluation model to learn which elements of the copy are effective and which are suboptimal. For example, in the example copy above, the comprehensive evaluation model identifies advantages such as concise language, clear information, and clear structure. By comparing these examples, the comprehensive evaluation model can continuously improve its evaluation capabilities of input copy.
[0083] In another possible implementation, the inspection prompt also includes multiple quality inspection subtasks constructed based on thought chain technology and with a preset execution order, instructing the comprehensive evaluation model to execute each quality inspection subtask in sequence according to the preset execution order; different quality inspection subtasks target different quality dimensions of the input document. In this embodiment, the preset order ensures that each quality indicator is gradually and completely tested, avoiding the omission of key issues due to a disordered sequence. The step-by-step execution allows the model to focus on each subtask, reducing interference factors, thereby improving the evaluation accuracy of each dimension. The step-by-step results of each subtask can be fed back separately, helping users understand and identify problems in the document, facilitating subsequent optimization.
[0084] Exemplarily, a prompt word template including the above-mentioned multiple quality inspection subtasks with a preset execution order can be pre-set, and then the input text in each training sample can be embedded into the input template to obtain inspection prompt words including the input text and the above-mentioned multiple quality inspection subtasks with a preset execution order.
[0085] For example, consider the following quality check subtasks: ① Format Check, which instructs the comprehensive evaluation model to check whether the overall format and layout of the document meet predetermined standards; ② Grammar Check, which guides the comprehensive evaluation model to analyze the grammatical structure of the document to detect typos or grammatical errors; ③ Logical Coherence, which instructs the comprehensive evaluation model to assess the logical and hierarchical structure of the document; and ④ Content Compliance, which instructs the comprehensive evaluation model to review the document for inappropriate or illegal information. By presetting this execution order, the comprehensive evaluation model will complete each quality check subtask sequentially, based on format, grammar, logic, and compliance. This allows the comprehensive evaluation model to conduct in-depth analysis of each dimension of the document, improving the accuracy of the evaluation.
[0086] For example, considering that each basic checking model (such as grammar checking, sentiment analysis, etc.) has its own specialized feature extraction method, the generated text feature vectors may be in different feature spaces. The distribution and scale of these text feature vectors may be inconsistent, resulting in them being unable to be directly and effectively fused when input into the comprehensive evaluation model. Therefore, please refer to Figure 2 Before inputting the text feature vectors corresponding to each basic inspection model into the comprehensive inspection model, the electronic device may further utilize the linear transformation layer corresponding to each basic inspection model to perform a linear transformation on the text feature vectors corresponding to each basic inspection model, so that the transformed text feature vectors are aligned with the vector space indicated by the comprehensive evaluation model. Through linear transformation (e.g., through a linear transformation layer), the text feature vectors of each basic inspection model can be mapped to a unified vector space, ensuring that their feature representations are compatible in the comprehensive model and can be used together for subsequent comprehensive evaluation.
[0087] After obtaining the inspection prompt words and the above-mentioned transformed text feature vector, the electronic device can input the inspection prompt words and the above-mentioned transformed text feature vector into the comprehensive evaluation model to be trained. Among them, the comprehensive evaluation model can be a pre-trained neural network model, such as a large language model (LLM), which is based on deep learning technology, especially an artificial intelligence model trained with a large corpus, designed to understand and generate text similar to human language, and has strong natural language understanding and generation capabilities. The goal of LLM is to achieve a variety of applications through natural language processing capabilities, such as text generation, translation, summarization, question and answer, and dialogue systems, thereby helping to improve the efficiency and automation of human-computer interaction. But it is not limited to this.
[0088] In this embodiment, the feature vector of the text output by the last hidden layer of each basic inspection model is processed and used as the input of the comprehensive evaluation model, which can improve the comprehensive judgment ability of the comprehensive evaluation model. The hidden layer output of the basic inspection model contains the deep semantic, syntactic and contextual information extracted by the basic inspection model during the detection process. This information is far more detailed and comprehensive than the single evaluation result output at the end, and can provide more valuable features for the comprehensive evaluation model, so that the comprehensive evaluation model can better integrate the features of each quality dimension, thereby making a more accurate and detailed assessment of the overall quality of the text. In addition, by inheriting the feature expressions that have been learned in the basic inspection model, the comprehensive evaluation model can reduce the burden of learning text features from scratch, thereby improving the overall training efficiency and convergence speed.
[0089] In one possible implementation, the comprehensive evaluation model includes an input processing layer that converts the inspection prompt words into embedding vectors and concatenates these embedding vectors with all transformed text feature vectors to produce a concatenated result. The embedding vectors and the transformed text feature vectors reside in the same vector space, allowing subsequent processing layers of the comprehensive evaluation model to perform further processing based on this concatenated result. In this embodiment, the input processing layer effectively integrates the inspection prompt words and the transformed text feature vectors.
[0090] In another possible implementation, in order to further enhance the control ability of the transformed text feature vector on the comprehensive evaluation model, the transformed text feature vector can be reintroduced into the subsequent processing layer of the comprehensive evaluation model. Figure 3 The comprehensive evaluation model includes an input processing layer and multiple Transformer layers. The processing logic of the input processing layer can be found in the above description and will not be repeated here. At least one target Transformer layer ( Figure 3The last Transformer layer is taken as an example in the figure) and includes a self-attention structure and a cross-attention structure. If the target Transformer layer is the first layer among multiple Transformer layers, the input of the self-attention structure in the target Transformer layer is the splicing result of the output of the input processing layer; if the target Transformer layer is not the first layer, the input of the self-attention structure in the target Transformer layer is the output of the previous Transformer layer; the input of the cross-attention structure in the target Transformer layer includes the output of the self-attention structure and the transformed text feature vector, the output of the self-attention structure is used to calculate the query vector in the cross-attention structure, and the transformed text feature vector is used to calculate the key vector and value vector in the cross-attention structure. It can be understood that this embodiment does not impose any restrictions on the position and number of the target Transformer layer, and can be specifically set according to the actual application scenario.
[0091] In this embodiment, the copy feature vector is reintroduced in the subsequent processing layer of the comprehensive evaluation model, so that the deep semantics and contextual information extracted by the original basic inspection model can continue to participate in the subsequent feature fusion and information transfer. Through the cross-attention structure, the query vector generated by the self-attention module is matched with the key and value vectors calculated by the copy feature vector. The comprehensive evaluation model can dynamically capture and fuse the global context and basic features to obtain a richer copy representation. The cross-attention mechanism enables the copy feature vector to directly affect the attention distribution in the subsequent layers, thereby more finely regulating the flow of information between the layers. This mechanism helps the comprehensive evaluation model better focus on information of key quality dimensions and improve the accuracy and robustness of the comprehensive evaluation.
[0092] For example, see Figure 4 , provides a schematic diagram of the target Transformer layer structure. The target Transformer layer includes a self-attention structure, a normalization layer, a cross-attention structure, a fusion layer, and a feedforward neural network.
[0093] The self-attention structure is used to perform calculations based on the output of the previous processing layer (such as the input processing layer or the previous Transformer layer). The specific calculation process can be found in the above description and will not be repeated here.
[0094] The normalization layer is used to normalize the output of the self-attention structure.
[0095] The input of the cross-attention structure includes the output of the normalization layer and the transformed copy feature vector. The output of the normalization layer is used to calculate the query vector in the cross-attention structure, and the transformed copy feature vector is used to calculate the key vector and value vector in the cross-attention structure. For the specific calculation process of the cross-attention structure, please refer to the above description and will not be repeated here.
[0096] The fusion layer is used to fuse the output of the self-attention structure and the output of the cross-attention structure; for example, the fusion can be performed based on the bitwise addition method, and the fusion result can be further normalized.
[0097] The feedforward neural network is used to process the output of the fusion layer.
[0098] Of course, in addition to the input processing layer and multiple Transformer layers, the comprehensive evaluation model to be trained can also include other structures, such as the LM head (Language Model Head) structure connected to the last Transformer layer. The LM head structure can convert the output of the last Transformer structure into a probability distribution for predicting the next word.
[0099] In S104, at least one basic inspection model and comprehensive evaluation model to be trained are trained with the optimization goal of minimizing the error between the first quality inspection result and the basic quality label belonging to the same quality dimension, and / or minimizing the error between the second quality inspection result and the comprehensive quality label.
[0100] Finally, during the joint training phase, the optimization objectives are to minimize errors in two directions: first, minimizing the error between the first quality inspection results output by each basic inspection model and the corresponding basic quality label; second, minimizing the error between the second quality inspection results output by the comprehensive evaluation model and the comprehensive quality label. This joint optimization not only improves the detection capabilities of each basic inspection model in its respective field, but also enables the comprehensive evaluation model to better integrate information from various dimensions, thereby coordinating the prediction results between the models. This significantly improves overall detection accuracy and robustness, ensuring that the final output of the document quality assessment results is more accurate and consistent, and can adapt to various complex scenarios in real-world applications.
[0101] The above-mentioned model training method uses a joint optimization strategy to achieve accurate detection of various quality dimensions of copywriting and in-depth assessment of overall quality, effectively reducing the workload of manual quality inspection and improving the automation and intelligence level of copywriting review.
[0102] Exemplarily, the electronic device can calculate a first loss value based on the error between the first quality inspection result and the basic quality label belonging to the same quality dimension, and can use loss functions such as mean square error and cross entropy loss to perform loss calculation, thereby quantifying the prediction deviation of the basic inspection model on a single quality dimension; and calculate a second loss value based on the error between the second quality inspection result and the comprehensive quality label, and the second loss value reflects the accuracy of the overall quality evaluation performed by the comprehensive evaluation model; finally, based on at least one of the at least one first loss value and the second loss value, adjust the parameters of at least one basic inspection model to be trained and the parameters of the comprehensive evaluation model.
[0103] Backpropagation is performed based on the error in at least one direction (the first loss value and / or the second loss value), feeding the error information back to each part of the network. As iterations proceed, each basic inspection model and comprehensive evaluation model gradually learn how to better utilize the contextual information contained in the input document, thereby continuously reducing losses. A continued decrease in loss values indicates that the error between the model's detection results and the true labels in various quality dimensions is gradually decreasing, indicating that the model's predictive ability and generalization performance are continuously improving.
[0104] Of course, the linear transformation layer corresponding to each basic inspection model can also be adjusted based on at least one of the at least one first loss value and the second loss value, which helps to more finely map and fuse the copy feature vectors extracted from the basic model, thereby optimizing the subsequent processing effect of the comprehensive evaluation model.
[0105] Through dual loss feedback, the model not only makes accurate predictions on a single quality dimension, but also comprehensively evaluates the overall quality of the copy, thereby achieving multi-level and multi-angle quality inspection.
[0106] It can be understood that this embodiment does not impose any restrictions on the aggregation method of at least one first loss value and the second loss value, and can be specifically set according to the actual application scenario. For example, all the first loss values and the second loss values can be weightedly fused to obtain the final loss value, or other aggregation methods can be used.
[0107] It is understandable that in order to improve training efficiency and training results, each basic inspection model and comprehensive evaluation model can be trained separately first, so that each model can fully learn the characteristics and preliminary detection capabilities of its own field in a relatively independent environment. This helps each model converge quickly and reduces the interference caused by parameter randomness in the initial stage. After each model is pre-trained to a relatively optimal state, it can be jointly optimized based on the above-mentioned model training method. The overall error can be distributed to each model through backpropagation, so that the fusion effect of the features extracted by the basic model and the comprehensive evaluation model is better, thereby further improving the overall detection accuracy and robustness.
[0108] In some embodiments, after training is completed, the trained basic model and the trained comprehensive training model can be deployed to electronic devices that perform the copywriting quality inspection method, including but not limited to physical servers, server clusters, cloud servers, smart phones / mobile phones, tablet computers, personal digital assistants (PDAs), laptop computers, and desktop computers. Figure 5 , the copywriting quality inspection method includes:
[0109] In S501, a document to be checked is obtained.
[0110] It is understandable that this embodiment does not impose any limitation on the source of the document to be checked. For example, the document may be automatically generated by a document automatic generation tool in the related art, or may be generated by other means.
[0111] In S502, at least one trained basic inspection model is used to inspect the quality of the document to be inspected in at least one quality dimension, and the first quality inspection result output by the output layer of each basic inspection model and the document feature vector output by the last hidden layer of each basic inspection model are obtained; wherein different basic inspection models correspond to different quality dimensions.
[0112] In this step, the documents to be checked are fed into multiple pre-trained basic checking models, each focused on a specific quality dimension (e.g., formatting, grammar, contextual coherence, content compliance, etc.). By setting up corresponding basic checking models for different quality dimensions, the inspection becomes more targeted and refined.
[0113] This embodiment not only obtains the first quality inspection result output by the output layer of each basic inspection model, but also obtains the copy feature vector output by the last hidden layer of each basic inspection model. The copy feature vector may contain deep semantics, context or specific dimension information, etc., which can more comprehensively represent the intrinsic characteristics of the copy and provide rich intermediate representation for subsequent comprehensive evaluation.
[0114] For example, the quality dimension includes at least one of the following: grammatical correctness, format compliance, content eligibility, keyword checking, contextual coherence, and sentiment. For details about the quality dimensions, please refer to the above description and will not be repeated here.
[0115] Exemplarily, the basic checking model includes at least one of the following: a first basic checking model for checking the grammatical correctness of the copy, a second basic checking model for checking the format compliance of the copy, a third basic checking model for checking the content eligibility of the copy, a fourth basic checking model for checking whether the copy contains keywords, a fifth basic checking model for checking the contextual coherence of the copy, and a sixth basic checking model for checking the emotional tendency of the copy; wherein the input of the fourth basic model includes the copy to be checked and the keywords to be checked. For the specific content of the basic checking model, please refer to the above description and will not be repeated here.
[0116] In S503, inspection prompt words are generated based on the document to be inspected, and the inspection prompt words and the document feature vector are input into the trained comprehensive evaluation model, so that the comprehensive evaluation model can inspect the quality of the document to be inspected in multiple quality dimensions to obtain a second quality inspection result; wherein, the parameter amount of the comprehensive evaluation model is greater than the parameter amount of the basic inspection model.
[0117] In this step, guiding inspection prompts are first generated based on the document to be inspected. Next, the inspection prompts, along with the document feature vectors obtained from each basic inspection model, are passed as input to a comprehensive evaluation model with a larger number of parameters. The comprehensive evaluation model utilizes its powerful feature fusion capabilities to comprehensively evaluate the document's performance across multiple quality dimensions, thereby outputting a second quality inspection result. By integrating inspection prompts and document feature vectors, the comprehensive evaluation model is able to perform a global, multi-faceted inspection of the document. Because the comprehensive evaluation model has more parameters than the basic inspection model, it is more capable of processing complex semantics and contextual information, further improving the accuracy and robustness of detection.
[0118] In one possible implementation, the check prompt can include at least one check example, consisting of a sample document and the quality check results for that document. By incorporating check examples, the comprehensive evaluation model can leverage existing concrete references when evaluating the document under review, enabling more accurate and rapid analysis. This not only improves the quality and consistency of document reviews but also provides clear improvement directions, thereby promoting optimized copywriting.
[0119] For example, a prompt word template containing at least one inspection example can be pre-set, and the input text from each training sample can be embedded into this input template to obtain an inspection prompt word containing the input text and at least one inspection example. In this embodiment, the input processing layer effectively integrates the inspection prompt word and the transformed text feature vector.
[0120] In another possible implementation, the inspection prompt also includes multiple quality inspection subtasks constructed based on thought chain technology and with a preset execution order, instructing the comprehensive evaluation model to execute each quality inspection subtask in sequence according to the preset execution order; different quality inspection subtasks target different quality dimensions of the document to be inspected. In this embodiment, the preset order ensures that each quality indicator is gradually and completely tested, avoiding the omission of key issues due to a disordered sequence. The step-by-step execution allows the model to focus on each subtask, reducing interference factors, thereby improving the assessment accuracy of each dimension. The step-by-step results of each subtask can be fed back separately, helping users understand and identify problems in the document, facilitating subsequent optimization.
[0121] Exemplarily, a prompt word template including the above-mentioned multiple quality inspection subtasks with a preset execution order can be pre-set, and then the input text in each training sample can be embedded into the input template to obtain inspection prompt words including the input text and the above-mentioned multiple quality inspection subtasks with a preset execution order.
[0122] Exemplarily, the comprehensive evaluation model includes an input processing layer; the input processing layer is used to convert the inspection prompt words into an embedding vector, and splice the embedding vector with the copy feature vector to obtain a splicing result.
[0123] Considering that each basic checking model (such as grammar checking, sentiment analysis, etc.) has its own specialized feature extraction method, the generated feature vectors may be in different feature spaces. Therefore, please refer to Figure 6 The electronic device can use the linear transformation layer corresponding to each basic inspection model to linearly transform the text feature vector corresponding to each basic inspection model, so that the transformed text feature vector is aligned with the vector space indicated by the comprehensive evaluation model. Through linear transformation, the text feature vectors of each basic inspection model can be mapped to a unified vector space, ensuring that their feature representations are compatible in the comprehensive model and can be used together for subsequent comprehensive evaluation.
[0124] That is to say, after converting the inspection prompt word into an embedding vector, the input processing layer in the comprehensive evaluation model concatenates the embedding vector with the transformed copy feature vector to obtain a concatenation result; wherein the transformed copy feature vector and the embedding vector are in the same vector space.
[0125] In another possible implementation, in order to further enhance the control ability of the transformed text feature vector on the comprehensive evaluation model, the transformed text feature vector can be reintroduced into the subsequent processing layer of the comprehensive evaluation model. Figure 3, the comprehensive evaluation model includes an input processing layer and multiple Transformer layers. At least one target Transformer layer among the multiple Transformer layers includes a self-attention structure and a cross-attention structure. If the target Transformer layer is the first layer among the multiple Transformer layers, the input of the self-attention structure in the target Transformer layer is the splicing result of the input processing layer output; if the target Transformer layer is not the first layer, the input of the self-attention structure in the target Transformer layer is the output of the previous Transformer layer; the input of the cross-attention structure in the target Transformer layer includes the output of the self-attention structure and the converted copy feature vector, the output of the self-attention structure is used to calculate the query vector in the cross-attention structure, and the converted copy feature vector is used to calculate the key vector and value vector in the cross-attention structure. In this embodiment, the copy feature vector is reintroduced in the subsequent processing layer of the comprehensive evaluation model, so that the deep semantics and contextual information extracted by the original basic inspection model can continue to participate in subsequent feature fusion and information transmission.
[0126] For the specific content of the target Transformer layer, please refer to the above description and will not be repeated here.
[0127] In S504 , the first quality inspection result and the second quality inspection result are output.
[0128] In this step, the first quality check result reflects the preliminary performance of each basic check model in its respective quality dimension. The second quality check result is the overall quality judgment after the comprehensive evaluation model integrates information from all dimensions. Outputting these two types of information simultaneously provides local and overall test results, allowing users to intuitively understand the performance of the copy in various aspects. This multi-level test result provides clear improvement directions for copy optimization, manual intervention, and further automated processing.
[0129] In some embodiments, if the copy to be checked is generated based on a copy automatic generation tool, the first quality check result, the second quality check result and the copy to be checked can be re-input into the copy automatic generation tool to instruct the copy automatic generation tool to optimize the copy to be checked with reference to the first quality check result and the second quality check result.
[0130] In some embodiments, after training is completed, if the resources of certain electronic devices are limited, only the basic inspection model can be deployed in these electronic devices, and the quality assessment of the document to be inspected can also be completed using only the basic inspection model.
[0131] The various technical features in the above embodiments can be combined arbitrarily as long as there is no conflict or contradiction between the combinations of features. However, due to space limitations, they are not described one by one. Therefore, the arbitrary combination of the various technical features in the above embodiments also falls within the scope of disclosure of this specification.
[0132] In some embodiments, an embodiment of this specification further provides an electronic device, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor implements any of the above methods by running the executable instructions.
[0133] Figure 7 This is a schematic structural diagram of a device provided by an exemplary embodiment. Figure 7 At the hardware level, the device includes a processor 702, an internal bus 704, a network interface 706, a memory 708, and a non-volatile memory 710. Of course, it may also include hardware required for other functions. One or more embodiments of this specification can be implemented based on software, such as the processor 702 reading the corresponding computer program from the non-volatile memory 710 into the memory 708 and then running it. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0134] In some embodiments, the document quality inspection device can be applied to Figure 7 The device shown in the figure is used to implement the technical solution of this specification. The document quality inspection device may include:
[0135] The document acquisition module is used to obtain the document to be checked;
[0136] An inspection module is configured to inspect the quality of the document to be inspected in at least one quality dimension using at least one trained basic inspection model, and obtain a first quality inspection result output by the output layer of each basic inspection model and a document feature vector output by the last hidden layer of each basic inspection model; different basic inspection models correspond to different quality dimensions;
[0137] The inspection module is further configured to generate inspection prompt words based on the document to be inspected, and input the inspection prompt words and the document feature vector into a trained comprehensive evaluation model, so that the comprehensive evaluation model can inspect the quality of the document to be inspected in multiple quality dimensions to obtain a second quality inspection result; wherein the number of parameters of the comprehensive evaluation model is greater than the number of parameters of the basic inspection model;
[0138] An output module is used to output the first quality inspection result and the second quality inspection result.
[0139] Exemplarily, the comprehensive evaluation model includes an input processing layer; the input processing layer is used to convert the inspection prompt words into an embedding vector, and splice the embedding vector with the text feature vector to obtain a splicing result.
[0140] Exemplarily, the inspection module is further used to use the linear transformation layer corresponding to each of the basic inspection models to perform a linear transformation on the copy feature vector corresponding to each of the basic inspection models, so that the transformed copy feature vector and the embedding vector are aligned to the same vector space; and input the inspection prompt words and the transformed copy feature vector into the trained comprehensive evaluation model.
[0141] Exemplarily, the comprehensive evaluation model includes an input processing layer and multiple Transformer layers;
[0142] At least one target Transformer layer among the multiple Transformer layers includes a self-attention structure and a cross-attention structure; if the target Transformer layer is the first layer among the multiple Transformer layers, the input of the self-attention structure in the target Transformer layer is the splicing result output by the input processing layer; if the target Transformer layer is not the first layer, the input of the self-attention structure in the target Transformer layer is the output of the previous Transformer layer; the input of the cross-attention structure in the target Transformer layer includes the output of the self-attention structure and the text feature vector, the output of the self-attention structure is used to calculate the query vector in the cross-attention structure, and the text feature vector is used to calculate the key vector and value vector in the cross-attention structure.
[0143] Exemplarily, the inspection prompt further includes at least one inspection example, wherein the inspection example includes an example document and a quality inspection result for the example document, and the inspection example is used to provide a reference when the comprehensive evaluation model inspects the document to be inspected.
[0144] Exemplarily, the inspection prompt words also include multiple quality inspection subtasks constructed based on thought chain technology and with a preset execution order, so as to instruct the comprehensive evaluation model to execute each quality inspection subtask in sequence according to the preset execution order; wherein, different quality inspection subtasks are targeted at different quality dimensions of the document to be inspected.
[0145] Exemplarily, the quality dimension includes at least one of the following: a grammatical correctness dimension, a format compliance dimension, a content qualification dimension, a keyword checking dimension, a contextual coherence dimension, and a sentiment tendency dimension.
[0146] Exemplarily, the basic checking model includes at least one of the following: a first basic checking model for checking the grammatical correctness of the copy, a second basic checking model for checking the format compliance of the copy, a third basic checking model for checking the content eligibility of the copy, a fourth basic checking model for checking whether the copy contains keywords, a fifth basic checking model for checking the contextual coherence of the copy, and a sixth basic checking model for checking the emotional tendency of the copy; wherein the input of the fourth basic model includes the copy to be checked and the keywords to be checked.
[0147] In some embodiments, the model training device can be applied to Figure 7 The device shown in the figure is used to implement the technical solution of this specification. The model training device may include:
[0148] A sample acquisition module is used to acquire multiple training samples, each training sample including an input document, a basic quality label of the input document in each quality dimension, and a comprehensive quality label of the input document in multiple quality dimensions;
[0149] a training module, configured to input the input document into at least one basic inspection model to be trained, so that each basic inspection model inspects the quality of the input document in a specified quality dimension, and obtain a first quality inspection result output by the output layer of each basic inspection model to be trained and a document feature vector output by the last hidden layer of each basic inspection model; wherein different basic inspection models correspond to different quality dimensions; and
[0150] The training module is further configured to input the inspection prompt words generated from the input text and the text feature vector into a comprehensive evaluation model to be trained to obtain a second quality inspection result; wherein the number of parameters of the comprehensive evaluation model is greater than the number of parameters of the basic inspection model;
[0151] The training module is also used to train the at least one basic inspection model to be trained and the comprehensive evaluation model with the optimization goal of minimizing the error between the first quality inspection result and the basic quality label belonging to the same quality dimension, and / or minimizing the error between the second quality inspection result and the comprehensive quality label; wherein, the at least one basic inspection model to be trained and the comprehensive evaluation model to be trained are applied to the above-mentioned copy quality inspection device.
[0152] Exemplarily, the training module is further configured to utilize a linear transformation layer corresponding to each of the basic inspection models to perform a linear transformation on the text feature vectors corresponding to each of the basic inspection models, so that the transformed text feature vectors are aligned with the vector space indicated by the comprehensive evaluation model. The comprehensive evaluation model includes an input processing layer; the input processing layer is configured to convert the inspection prompt words into an embedding vector and concatenate the embedding vector with the transformed text feature vector to obtain a concatenated result.
[0153] Exemplarily, the comprehensive evaluation model includes an input processing layer and multiple Transformer layers; at least one target Transformer layer among the multiple Transformer layers includes a self-attention structure and a cross-attention structure; if the target Transformer layer is the first layer among the multiple Transformer layers, then the input of the self-attention structure in the target Transformer layer is the splicing result output by the input processing layer; if the target Transformer layer is not the first layer, then the input of the self-attention structure in the target Transformer layer is the output of the previous Transformer layer; the input of the cross-attention structure in the target Transformer layer includes the output of the self-attention structure and the text feature vector, the output of the self-attention structure is used to calculate the query vector in the cross-attention structure, and the text feature vector is used to calculate the key vector and value vector in the cross-attention structure.
[0154] Exemplarily, the training module is specifically configured to calculate a first loss value based on the error between the first quality inspection result and the basic quality label belonging to the same quality dimension; calculate a second loss value based on the error between the second quality inspection result and the comprehensive quality label; and adjust the parameters of the at least one basic inspection model to be trained and the parameters of the comprehensive evaluation model based on at least one of the first loss value and / or the second loss value. The implementation process of the functions and effects of each module in the above-mentioned apparatus is detailed in the implementation process of the corresponding steps in the above-mentioned method and will not be repeated here.
[0155] Based on the same concept as the above method, this specification also provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor implements the steps of the method described in any of the above embodiments by running the executable instructions.
[0156] Based on the same concept as the above method, this specification also provides a computer-readable storage medium on which computer instructions are stored. When the instructions are executed by a processor, the steps of the method described in any of the above embodiments are implemented.
[0157] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0158] Based on the same concept as the above method, this specification also provides a computer program product, including a computer program / instruction, which implements the steps of the method described in any of the above embodiments when executed by a processor.
[0159] The above description is merely a preferred embodiment of one or more embodiments of this specification and is not intended to limit one or more embodiments of this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of this specification shall be included in the scope of protection of one or more embodiments of this specification.
Claims
1. A method for checking the quality of a copywriting, comprising: Get the document to be checked; Using at least one trained basic inspection model, inspect the quality of the document to be inspected in at least one quality dimension, obtaining a first quality inspection result output by the output layer of each basic inspection model and a document feature vector output by the last hidden layer of each basic inspection model; different basic inspection models correspond to different quality dimensions; Generating inspection prompt words based on the document to be inspected, and inputting the inspection prompt words and the document feature vector into a trained comprehensive evaluation model, so that the comprehensive evaluation model can inspect the quality of the document to be inspected in multiple quality dimensions to obtain a second quality inspection result; wherein the number of parameters of the comprehensive evaluation model is greater than the number of parameters of the basic inspection model; The first quality inspection result and the second quality inspection result are output.
2. The method according to claim 1, wherein the comprehensive assessment model comprises an input processing layer; The input processing layer is used to convert the inspection prompt word into an embedding vector, and splice the embedding vector with the text feature vector to obtain a splicing result.
3. The method according to claim 2, before inputting the inspection prompt words and the copywriting feature vector into the trained comprehensive evaluation model, further comprising: Using a linear transformation layer corresponding to each of the basic inspection models, linearly transform the text feature vectors corresponding to each of the basic inspection models so that the transformed text feature vectors and the embedding vector are aligned in the same vector space; The step of inputting the inspection prompt words and the text feature vector into the trained comprehensive evaluation model includes: The inspection prompt words and the transformed text feature vector are input into the trained comprehensive evaluation model.
4. The method according to claim 1, wherein the comprehensive evaluation model comprises an input processing layer and a plurality of Transformer layers; At least one target Transformer layer among the multiple Transformer layers includes a self-attention structure and a cross-attention structure; If the target Transformer layer is the first layer among the multiple Transformer layers, the input of the self-attention structure in the target Transformer layer is the concatenation result of the outputs of the input processing layer; If the target Transformer layer is not the first layer, the input of the self-attention structure in the target Transformer layer is the output of the previous Transformer layer; The input of the cross-attention structure in the target Transformer layer includes the output of the self-attention structure and the copy feature vector. The output of the self-attention structure is used to calculate the query vector in the cross-attention structure, and the copy feature vector is used to calculate the key vector and value vector in the cross-attention structure.
5. The method according to claim 1, wherein the inspection prompt further comprises at least one inspection example, wherein the inspection example comprises an example document and a quality inspection result for the example document, and the inspection example is used to provide a reference when the comprehensive evaluation model inspects the document to be inspected; and / or, The inspection prompt words also include a plurality of quality inspection subtasks constructed based on the thought chain technology and having a preset execution order, so as to instruct the comprehensive evaluation model to execute each quality inspection subtask in sequence according to the preset execution order; wherein, Different quality inspection subtasks are targeted at different quality dimensions of the document to be inspected.
6. The method according to claim 1, wherein the quality dimension comprises at least one of the following: a grammatical correctness dimension, a format compliance dimension, a content eligibility dimension, a keyword checking dimension, a contextual coherence dimension, and a sentiment tendency dimension; and / or The basic checking model includes at least one of the following: a first basic checking model for checking the grammatical correctness of the copy, a second basic checking model for checking the format compliance of the copy, a third basic checking model for checking the content eligibility of the copy, a fourth basic checking model for checking whether the copy contains keywords, a fifth basic checking model for checking the contextual coherence of the copy, and a sixth basic checking model for checking the emotional tendency of the copy; in, The input of the fourth basic model includes the text to be checked and the keywords to be checked.
7. A model training method comprising: Acquire multiple training samples, each training sample including an input document, a basic quality label of the input document in each quality dimension, and a comprehensive quality label of the input document in the multiple quality dimensions; Inputting the input document into at least one basic inspection model to be trained, so that each basic inspection model inspects the quality of the input document in a specified quality dimension, obtaining a first quality inspection result output by an output layer of each basic inspection model to be trained and a document feature vector output by a last hidden layer of each basic inspection model; wherein different basic inspection models correspond to different quality dimensions; and Inputting the inspection prompt words generated from the input text and the text feature vector into the comprehensive evaluation model to be trained to obtain a second quality inspection result; wherein the number of parameters of the comprehensive evaluation model is greater than the number of parameters of the basic inspection model; Training the at least one basic inspection model to be trained and the comprehensive evaluation model with minimizing the error between the first quality inspection result and the basic quality label, and / or minimizing the error between the second quality inspection result and the comprehensive quality label, belonging to the same quality dimension as an optimization goal; Among them, at least one trained basic inspection model and a trained comprehensive evaluation model are applied to the copy quality inspection method described in any one of claims 1 to 6.
8. The method according to claim 7, before inputting the inspection prompt words generated from the input text and the text feature vector into the comprehensive evaluation model to be trained, further comprising: Using a linear transformation layer corresponding to each of the basic inspection models, linearly transform the text feature vectors corresponding to each of the basic inspection models so that the transformed text feature vectors are aligned with the vector space indicated by the comprehensive evaluation model; Among them, the comprehensive evaluation model includes an input processing layer; the input processing layer is used to convert the inspection prompt word into an embedding vector, and splice the embedding vector with the transformed text feature vector to obtain a splicing result.
9. The method according to claim 7, wherein the comprehensive evaluation model comprises an input processing layer and a plurality of Transformer layers; At least one target Transformer layer among the multiple Transformer layers includes a self-attention structure and a cross-attention structure; If the target Transformer layer is the first layer among the multiple Transformer layers, the input of the self-attention structure in the target Transformer layer is the splicing result output by the input processing layer; If the target Transformer layer is not the first layer, the input of the self-attention structure in the target Transformer layer is the output of the previous Transformer layer; The input of the cross-attention structure in the target Transformer layer includes the output of the self-attention structure and the copy feature vector. The output of the self-attention structure is used to calculate the query vector in the cross-attention structure, and the copy feature vector is used to calculate the key vector and value vector in the cross-attention structure.
10. The method according to claim 7, wherein the training of the at least one to-be-trained basic inspection model and the comprehensive evaluation model with minimizing the error between the first quality inspection result and the basic quality label and / or minimizing the error between the second quality inspection result and the comprehensive quality label belonging to the same quality dimension as an optimization goal comprises: Calculating a first loss value based on an error between the first quality inspection result and the basic quality label belonging to the same quality dimension; calculating a second loss value based on an error between the second quality check result and the comprehensive quality label; Based on at least one of the first loss value and / or the second loss value, the parameters of the at least one basic inspection model to be trained and the parameters of the comprehensive evaluation model are adjusted.
11. The method according to claim 7, wherein the quality dimension comprises at least one of the following: a grammatical correctness dimension, a format compliance dimension, a content qualification dimension, a keyword checking dimension, a contextual coherence dimension, and a sentiment tendency dimension; and / or The basic checking model includes at least one of the following: a first basic checking model for checking the grammatical correctness of the copy, a second basic checking model for checking the format compliance of the copy, a third basic checking model for checking the content eligibility of the copy, a fourth basic checking model for checking whether the copy contains keywords, a fifth basic checking model for checking the contextual coherence of the copy, and a sixth basic checking model for checking the emotional tendency of the copy; in, The input of the fourth basic model includes the input text and keywords to be checked.
12. An electronic device comprising: processor; A memory for storing processor-executable instructions; wherein the processor implements the steps of the method according to any one of claims 1 to 11 by running the executable instructions.
13. A computer-readable storage medium having computer instructions stored thereon, wherein when the instructions are executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
14. A computer program product comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11.