Unsupervised power text grading rewriting method and system
By employing an unsupervised comparative learning mechanism and guided by continuous prompt vector groups, this method addresses the limitations of existing power text rewriting methods in terms of coverage and cost, achieving efficient and personalized power text rewriting and enhancing user experience and dissemination effectiveness.
Patent Information
- Application Number
- CN202511059991.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-30
- Publication Date
- 2025-10-31
AI Technical Summary
Existing methods for rewriting electrical text rely on manually written differentiated script templates or multi-turn prompts and interactions using large language models. These methods suffer from limited coverage, high manual maintenance costs, and large computational overhead, making them unsuitable for large-scale, high-efficiency, and multi-type text rewriting scenarios.
An unsupervised contrastive learning mechanism is adopted, and the information reconstruction and style transfer rewards are constructed by the output probability of a large language model. The text rewriting model is trained to realize personalized style rewriting of power knowledge texts. The continuous prompt vector group guides the generation model to closely match the characteristics of the target group in terms of language style and complexity.
It significantly improves the adaptability and practicality of the rewriting system in unlabeled scenarios, reduces data dependence and labor costs, and the generated text not only retains the core semantics of the original text but also better matches the expression preferences of the target users, enhancing the comprehensibility and dissemination effect of power-related texts among various user groups.
Smart Images

Figure CN120874776A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, specifically to an unsupervised hierarchical rewriting method and system for electrical data. Background Technology
[0002] The statements in this section provide only background information related to the present invention and do not necessarily constitute prior art.
[0003] With the deepening application of artificial intelligence technology in the field of power marketing, functions such as intelligent text classification, power knowledge Q&A, and automatic work order generation are gradually becoming automated and intelligent, helping power companies achieve digital transformation. In tasks such as power knowledge dissemination and safety promotion, the text content of power brochures serves as the core carrier of human-computer interaction, and its expression varies significantly in terms of acceptance and comprehension among different age groups (such as children, youth, and the elderly). Therefore, generating personalized Q&A texts with appropriate style and semantic equivalence for different user groups has become an important technical requirement for improving service accuracy and user experience.
[0004] Existing methods for rewriting power-related texts mainly rely on manually writing differentiated script templates or using Large Language Models (LLMs) for multi-turn prompt interaction generation. The former suffers from limited coverage and high manual maintenance costs; the latter faces challenges such as complex prompt word design, high computational overhead, and insufficient generation stability, making it difficult to adapt to large-scale, high-efficiency, and multi-type text rewriting scenarios, thus hindering the promotion and implementation of hierarchical text generation technology in actual power business scenarios. Summary of the Invention
[0005] To address the aforementioned issues, this invention proposes an unsupervised hierarchical rewriting method and system for power-related texts. By introducing an unsupervised contrastive learning mechanism and training the text rewriting model based on the output probability of a large language model to construct information reconstruction and style transfer rewards, personalized style rewriting of power-related knowledge texts can be achieved.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: One or more embodiments provide an unsupervised hierarchical rewriting method for electrical data, comprising the following steps: Obtain the original text of the power knowledge points to be rewritten and the target user group identification information; Based on the target user group identification information, select the corresponding continuous prompt vector group; The original text of electricity knowledge points and the continuous prompt vector group are input into the trained text rewriting model to obtain rewritten text that meets the style requirements of the target audience. During the training of the text rewriting model, the information reconstruction reward and style transfer reward are calculated by estimating the output probability of the large language model. These rewards are combined with the contrast reward to form the total reward. Unsupervised contrastive learning is then performed to fine-tune the model parameters of the text rewriting model, resulting in the trained text rewriting model.
[0007] One or more embodiments provide an unsupervised hierarchical rewriting system for electrical text, comprising: The acquisition module is configured to acquire the original text of the power knowledge points to be rewritten and the target user group identification information. The cue vector construction module is configured to select a continuous cue vector group corresponding to the target user group based on the target user group identification information; The rewriting module is configured to input the original power knowledge point text and the continuous prompt vector group into the trained text rewriting model to obtain rewritten text that meets the style requirements of the target audience. During the training of the text rewriting model, the information reconstruction reward and style transfer reward are calculated by estimating the output probability of the large language model. These rewards are combined with the contrast reward to form the total reward. Unsupervised contrastive learning is then performed to fine-tune the model parameters of the text rewriting model, resulting in the trained text rewriting model.
[0008] One or more embodiments provide an electronic device including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the above-described unsupervised power text hierarchical rewriting method.
[0009] One or more embodiments provide a computer-readable storage medium having a computer program / instructions stored thereon, which, when executed by a processor, implement the steps of the above-described unsupervised power text hierarchical rewriting method.
[0010] One or more embodiments provide a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the above-described unsupervised power text hierarchical rewriting method.
[0011] Compared with the prior art, the beneficial effects of the present invention are as follows: The unsupervised hierarchical rewriting method for power text of this invention significantly improves the adaptability and practicality of the rewriting system in unlabeled scenarios. Compared with traditional methods, it does not require the construction of templates or the design of prompts, nor does it require the collection of user behavior data or feedback matrices. The training process can be driven solely by the original knowledge points, effectively reducing data dependence and labor costs. Simultaneously, it incorporates multiple reward mechanisms, introducing a large language model to estimate the output probability of the generated text, and constructing information reconstruction rewards (measuring the semantic consistency between the generated text and the original text) and style conversion rewards (measuring whether the style of the generated text conforms to the characteristics of the target user). In particular, the reward calculation method based on output probability ensures that the generated text retains the core semantics of the original text while better aligning with the expression preferences of the target user, thereby enhancing the comprehensibility and dissemination effect of power text among various user groups.
[0012] The advantages of the present invention, as well as its additional advantages, will be described in detail in the following specific embodiments. Attached Figure Description
[0013] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute a limitation thereof.
[0014] Figure 1 This is a flowchart illustrating the unsupervised hierarchical rewriting method for power text according to Embodiment 1 of the present invention. Figure 2 This is a flowchart of the unsupervised power text hierarchical rewriting method according to Embodiment 1 of the present invention; Detailed Implementation The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0015] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0016] It should be noted that the terminology used herein is for describing particular embodiments only and is not intended to limit the exemplary embodiments of the present invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof. It should be noted that, without conflict, the various embodiments and features within those embodiments can be combined with each other. The embodiments will now be described in detail with reference to the accompanying drawings.
[0017] Example 1 In one or more of the technical solutions disclosed in the embodiments, such as Figures 1 to 2 As shown, an unsupervised hierarchical rewriting method for power text includes the following steps: Step 1: Obtain the original text of the power knowledge points to be rewritten and the target user group identification information; Step 2: Select the corresponding continuous prompt vector group for the target user group based on the target user group identification information; Step 3: Input the original power knowledge point text and the continuous prompt vector group into the trained text rewriting model to obtain the rewritten text that meets the style requirements of the target audience; During the training of the text rewriting model, the information reconstruction reward and style transfer reward are calculated by estimating the output probability of the large language model. These are combined with the contrast reward to form the total reward for unsupervised contrastive learning. The model parameters of the text rewriting model are then tuned to obtain the trained text rewriting model. This implementation first addresses the multi-level and multi-style text rewriting needs in the power industry by proposing a hierarchical text generation mechanism based on an unsupervised training strategy. The system first receives the original power knowledge point text and its corresponding target user group identifier. Based on this identifier, it retrieves a pre-constructed set of continuous prompt vectors. These prompt vectors guide the generation model to better align with the target group's characteristics in terms of language style and complexity. The rewriting process relies on a trained text rewriting model. The model input is the concatenation of the original text and the prompt vector set, and the output is the style-adapted rewritten text. During model training, a large language model is introduced to estimate the output probability of the generated text. Information reconstruction rewards (measuring the semantic consistency between the generated and original texts) and style conversion rewards (measuring whether the style of the generated text matches the target user's characteristics) are constructed separately. These are then combined with a contrast reward mechanism (helping the model distinguish between different style outputs) to form an overall reward function, guiding the model to perform unsupervised optimization and thus avoiding reliance on task-related labeled data.
[0018] This unsupervised hierarchical rewriting method for power-related text significantly improves the adaptability and practicality of the rewriting system in unlabeled scenarios. Compared with traditional methods, it eliminates the need for template construction or prompt word design, user behavior data collection, or feedback matrices. The training process can be driven solely by existing knowledge points, effectively reducing data dependence and labor costs. Furthermore, it incorporates multiple reward mechanisms, introducing a large language model to estimate the output probability of the generated text. Information reconstruction rewards (measuring the semantic consistency between the generated and original texts) and style conversion rewards (measuring whether the style of the generated text matches the target user's characteristics) are constructed. In particular, the reward calculation method based on output probability ensures that the generated text retains the core semantics of the original while better aligning with the target user's expression preferences, thereby enhancing the comprehensibility and dissemination effect of power-related texts across various user groups.
[0019] In step 1, the original text of the power knowledge points to be rewritten is obtained as the original knowledge points, which will be used to generate promotional statements or Q&A content that are suitable for different groups of people in the future. In step 1, the target user group identification information is received to determine the target user group type. The user group includes, but is not limited to, children, youth, and the elderly.
[0020] Based on the target user group identification information, select a continuous set of prompt vectors corresponding to the target group, for example: Used to generate child-style text; Used to generate youth-style text; Used to generate text with an older style.
[0021] Furthermore, the method for constructing a continuous suggestion vector group specifically involves: combining each vector in the vector group... All are initialized to the average of all word vectors: ; in, This represents the vectors for all words.
[0022] Because the model adds positional encoding to each input vector during training, it optimizes in different directions during training based on the position of consecutive cue vectors, ensuring the effectiveness of each vector.
[0023] The original knowledge point text and the selected hint vector group are used as joint inputs and fed into the trained text rewriting model.
[0024] In some embodiments, the text rewriting model may employ Qwen2.5-7B-Instruct-1M, which includes multiple stacked Transformers, each Transformer including a multi-head self-attention mechanism layer and a feedforward network; In step 3, the original power knowledge point text and the continuous prompt vector group are input into the trained text rewriting model to rewrite the power knowledge point text. The continuous prompt vector group is embedded into the input sequence or structure of each layer of the text rewriting model. Style control cannot be fixed from the beginning. If only hints are added to the input layer, the information will gradually become diluted as the layers deepen. Injecting hints into each layer can maintain a consistent style control and achieve a more stable style transcription effect. One feasible implementation involves adding a continuous cue vector group to the input sequence of each Transformer multi-head self-attention layer. The token obtained after word segmentation of the original power knowledge point text is concatenated with the continuous cue vector group to form a new token, which is then input into each Transformer multi-head self-attention layer. Specifically; The tokens (markers) after word segmentation of the original electricity knowledge text are represented as a matrix as follows: ; A continuous set of prompt vectors is represented as: ; The concatenated input is: ; The model can recognize these continuous cue vectors in each Transformer layer as part of the attention calculation, thus allowing the model to be continuously guided by style cues during the generation process.
[0025] Another feasible implementation is to not directly use the continuous cue vectors as tokens, but instead construct style bias terms through function mapping and add them to the Query or Key of each Transformer's multi-head self-attention layer: ; ; in, It is a learnable mapping function; It is the original Query matrix, the query vector in the attention mechanism, used to calculate the attention score; This is the updated Query matrix; It is the original key matrix, the key vector in the attention mechanism; This is the updated Key matrix; This implementation does not change the token sequence length, and the continuous cue vector can guide the direction of attention; Assuming multi-layer Layered construction (number of layers set to...) ), Enter text Traditional models rely on the last latent vector. Predict the next word: ; ; To require the model to generate rewritten text that meets the requirements, the input text is... The prompts in traditional models are often designed to be too long, sometimes requiring multiple rounds of interaction to complete the objective. This is because the prompts are often discrete words, limiting their ability to guide large models. This embodiment designs a continuous prompt vector embedding, which adds a prompt learning vector to each layer, thus improving the guidance capability of large models. Providing guidance can reduce input length, improve efficiency, and ensure rewriting quality. Specifically: ; ; Unlike the original large model, a vector was added to each layer. For each level of the classification—children, youth, and the elderly—the vector group They are different, denoted as This ensures that each set of vectors guides the model to be rewritten in one class.
[0026] This embodiment achieves multi-level, deep integration control over model behavior by embedding continuous cue vector groups into the attention input or structure of each layer of the model, thereby achieving a more stable, accurate, and efficient style rewriting effect.
[0027] Furthermore, the training process of the text rewriting model includes the following steps: Step S1: Obtain the original power knowledge point text, and rewrite some of the knowledge point text according to the set rewriting level. Use these rewritten texts as pseudo-labels for the original power knowledge point text to construct a hierarchical pseudo-label dataset. The original electricity knowledge point texts include question-and-answer texts or promotional knowledge points collected from electricity marketing operations. These knowledge points form an original dataset D containing n knowledge point texts. This represents the text of the i-th knowledge point: ; For each knowledge point We manually designed prompt words for large language models for different groups (children, youth, and the elderly) and rewrote some of the knowledge points in the original text data. Specifically, marketing professionals manually rewrote several knowledge points in a hierarchical manner. The rewritten text of these knowledge points is as follows: , ; The aforementioned manually rewritten knowledge points will be used to guide the reward design of the model; The manually designed text is rewritten with prompts based on a three-tiered classification system for children, youth, and the elderly. These prompts generate graded knowledge points as pseudo-tags, denoted as (…). (3) Manually designed rewriting prompts for three levels: children, youth, and the elderly, to generate graded pseudo-label text for training assistance; The rewritten content is recorded as follows: , that is, the "pseudo-label" version of the i-th knowledge point, which is the target text used when training the text rewriting model; The rating level indicates the corresponding rating category label. For example, the rating level is: Child = 0, Youth = 1, Senior = 2. Step S2: Select the corresponding continuous prompt vector group for the target user group based on the target user group identification information; Step S3: Input the original power knowledge point text and the corresponding continuous prompt vector group from the hierarchical pseudo-label dataset into the text rewriting model to obtain the rewritten text corresponding to the style requirements of the target audience. The knowledge points after hierarchical rewriting by the text rewriting model are denoted as follows: ; Step S4: Based on the obtained rewritten text, input it into the large language model to calculate the reconstruction reward and style transfer reward, and obtain the optimization target value; Optional, information reconstruction reward The method for determining this can be as follows: ; in, This represents the original knowledge point, i.e., the input of the i-th sample (the sample before hierarchical rewriting). This represents the knowledge points after the hierarchical rewriting of the model. Optionally, the large language model can be either the Deepseek large model or the GPT model; Specifically, it can be Input into the Deepseek large model, and generate it by calculating it one by one. The probability of each word =1,2,3...T, This represents the j-th word in the input of the i-th sample; the probabilities of the three words with the lowest probabilities are multiplied together, and the logarithm is taken as the result. The value; As the primary reward benchmark, in When the level of information retention exceeds the set reward benchmark, If positive, then negative; First reward benchmark The calculation method is as follows: based on the original knowledge points Generate multiple Take multiple The average value.
[0028] Specifically, the style transfer reward is given as the original knowledge points. The knowledge points after the model is rewritten in a hierarchical manner are: The examples needed for context learning, i.e., the pseudo-labels in the dataset, are : ; It uses context learning to allow the Deepseek model to determine whether the hierarchical text before and after its rewriting meets the rewriting requirements. Specifically, given manually rewritten hierarchical text as a reference, the Deepseek model inputs both texts before and after its rewriting, assesses the rewriting similarity, and obtains the probability that the Deepseek model outputs the word "yes," which serves as a metric for determining whether the rewriting meets the requirements. Similarly, It represents the probability that the Deepseek large model outputs the word "no". As the second reward benchmark, in When the degree of style rewriting exceeds the baseline, If positive, then negative; Specifically, the pseudo-labels obtained by manual rewriting in the hierarchical pseudo-label dataset, i.e., the hierarchical text before and after manual rewriting, are used as references. They are compared with the hierarchical text before and after rewriting in the current model, and simultaneously input into the Deepseek large model to judge the rewriting similarity. If the similarity is higher than the set value, the Deepseek large model outputs "yes" and gives a probability value. Second reward benchmark The calculation method is as follows: based on the original knowledge points Generate multiple Take multiple The average value.
[0029] In terms of training, an unsupervised reward training mechanism is designed to train the text hierarchical rewriting model and improve its performance. This embodiment utilizes the Deepseek model to design information reconstruction rewards and style transfer rewards, ensuring that the rewritten text retains its original meaning while maintaining a reasonable style. The optimization objective is as follows: ; ; in, To optimize the objective, respectively for the first Information reconstruction rewards and style conversion rewards for each knowledge point.
[0030] Step S5: Compare the rewards obtained from the current training. If the reconstruction reward and style transfer reward are greater than 0, and the set interval number of rounds is greater than the historical values of the reconstruction reward and style transfer reward, give a positive reward. Otherwise, give a negative reward and proceed to the next round of iteration training until the iteration deadline is met to obtain the trained text rewriting model. To further improve the performance of the text hierarchical rewriting model, this embodiment employs a comparative reward approach, encouraging the model to generate better results with each training iteration. Specifically, during training, every 1000 training iterations, the model's performance on the current knowledge points is recorded. Hierarchical rewriting of text In calculation and At that time, Including the calculation of the average (multiple) and The calculation of average values (i.e., the performance of model rewriting and style rewriting must not only exceed the current average value but also exceed the historical value) is required to receive a positive reward. The optimization objective is further improved as follows: ; in, Let be the highest reward value recorded for the i-th sample during training, and let be the sum of the information reconstruction reward and the style transfer reward.
[0031] To illustrate the effectiveness of this embodiment, a simulation experiment was conducted, comparing the rewritten text obtained by different methods: The original text reads: "Overload protection devices in power systems can automatically cut off the power supply when the current exceeds a safe threshold, preventing equipment damage and fire risks." Rewrite the rating as "children"; The rewritten text that failed to pass the comparison reward test reads: "If there is too much electricity, the machine will automatically shut down, so that things won't break or catch fire." The revised reward text reads: "There's a protective little helper that automatically shuts off the power if there's too much electricity, so the appliances won't break down or catch fire!" As can be seen, without the introduction of contrast rewards, when the sum of the information reconstruction reward and the style transfer reward is positive (sometimes even negative), the reinforcement learning objective will encourage this type of generation, thus generating text that is not quite in line with the requirements. However, with the introduction of contrast rewards, the reinforcement learning objective will require the generation of more suitable text, otherwise it will give a negative reward in a timely manner, requiring the model to generate other content, thereby improving the model performance.
[0032] Example 2 Based on Embodiment 1, this embodiment provides an unsupervised hierarchical rewriting system for electrical data, including: The acquisition module is configured to acquire the original text of the power knowledge points to be rewritten and the target user group identification information. The cue vector construction module is configured to select a continuous cue vector group corresponding to the target user group based on the target user group identification information; The rewriting module is configured to input the original power knowledge point text and the continuous prompt vector group into the trained text rewriting model to obtain rewritten text that meets the style requirements of the target audience. During the training of the text rewriting model, the information reconstruction reward and style transfer reward are calculated by estimating the output probability of the large language model. These rewards are combined with the contrast reward to form the total reward. Unsupervised contrastive learning is then performed to fine-tune the model parameters of the text rewriting model, resulting in the trained text rewriting model.
[0033] It should be noted that each module in this embodiment corresponds one-to-one with each step in embodiment 1, and their specific implementation process is the same, so it will not be repeated here.
[0034] Example 3 Based on Embodiment 1, this embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the steps of the unsupervised power text hierarchical rewriting method described in Embodiment 1.
[0035] Example 4 Based on Embodiment 1, this embodiment provides a computer-readable storage medium storing a computer program / instruction thereon, which, when executed by a processor, implements the steps of the unsupervised power text hierarchical rewriting method described in Embodiment 1.
[0036] Example 5 Based on Embodiment 1, this embodiment provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the unsupervised power text hierarchical rewriting method described in Embodiment 1.
[0037] The electronic devices proposed in this disclosure can be mobile terminals and non-mobile terminals. Non-mobile terminals include desktop computers, and mobile terminals include smartphones (such as Android phones, iOS phones, etc.), smart glasses, smartwatches, smart bracelets, tablets, laptops, personal digital assistants, and other mobile internet devices capable of wireless communication.
[0038] It should be understood that in this disclosure, the processor can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.
[0039] The memory may include read-only memory and random access memory, and provides instructions and data to the processor. A portion of the memory may also include non-volatile random access memory. For example, the memory may also store information about the device type.
[0040] In implementation, each step of the above method can be completed by integrated logic circuits in the processor hardware or by instructions in software form. The steps of the method disclosed herein can be directly implemented by a hardware processor, or by a combination of hardware and software modules within the processor. The software modules can reside in mature storage media in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory; the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, detailed descriptions are omitted here. Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this disclosure.
[0041] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0042] In the embodiments provided in this disclosure, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of apparatuses or units may be electrical, mechanical, or other forms.
[0043] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0044] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
[0045] While the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of the present invention are still within the scope of protection of the present invention.
Claims
1. An unsupervised hierarchical rewriting method for electrical data, characterized in that, Includes the following steps: Obtain the original text of the power knowledge points to be rewritten and the target user group identification information; Based on the target user group identification information, select the corresponding continuous prompt vector group; The original text of electricity knowledge points and the continuous prompt vector group are input into the trained text rewriting model to obtain rewritten text that meets the style requirements of the target audience. During the training of the text rewriting model, the information reconstruction reward and style transfer reward are calculated by estimating the output probability of the large language model. These rewards are combined with the contrast reward to form the total reward. Unsupervised contrastive learning is then performed to fine-tune the model parameters of the text rewriting model, resulting in the trained text rewriting model.
2. The unsupervised hierarchical rewriting method for power text as described in claim 1, characterized in that: The text rewriting model consists of multiple stacked Transformers, each of which includes a multi-head self-attention machine layer and a feedforward network.
3. The unsupervised hierarchical rewriting method for electrical text as described in claim 2, characterized in that: The original power knowledge point text and the continuous cue vector group are input into the trained text rewriting model to rewrite the power knowledge point text. In the input sequence of each Transformer multi-head self-attention layer, the continuous cue vector group is added. The token after the original power knowledge point text is segmented and the continuous cue vector group are concatenated to form a new token, which is then input into each Transformer multi-head self-attention layer.
4. The unsupervised hierarchical rewriting method for power text as described in claim 2, characterized in that: The original power knowledge point text and the continuous cue vector group are input into the trained text rewriting model to rewrite the power knowledge point text. The continuous cue vector is used to construct a style bias term through function mapping and added to the Query or Key of the multi-head self-attention layer of each Transformer.
5. The unsupervised hierarchical rewriting method for electrical text as described in claim 1, characterized in that, The training process of a text rewriting model includes the following steps: Obtain the original text of electricity knowledge points, and rewrite some of the knowledge point text according to the set rewriting level. Use these rewritten texts as pseudo-labels for the original electricity knowledge point text to construct a hierarchical pseudo-label dataset: Based on the target user group identification information, select the corresponding continuous prompt vector group; The original power knowledge point text and the corresponding continuous prompt vector group in the hierarchical pseudo-label dataset are input into the text rewriting model to obtain the rewritten text corresponding to the style requirements of the target audience. Based on the obtained rewritten text, it is input into a large language model to calculate reconstruction reward and style transfer reward; The rewards obtained from the current training are compared. If the reconstruction reward and style transfer reward are greater than 0, and the set interval number of rounds is greater than the historical values of the reconstruction reward and style transfer reward, a positive reward is given. Otherwise, a negative reward is given, and the next round of iteration training is carried out until the iteration deadline is met, and the trained text rewriting model is obtained.
6. The unsupervised hierarchical rewriting method for power text as described in claim 1, characterized in that: Information Reconstruction Reward The determination method is as follows: ; in, Represents the original knowledge points. The knowledge points after the model is rewritten in a hierarchical manner are: ; Will Input into the Deepseek large model, and generate it by calculating it one by one. The probability of each word The probabilities of the three words with the lowest probabilities are multiplied together, and the logarithm is taken as the result. The value; As the primary reward benchmark; Alternatively, a style conversion reward, specifically: ; in, These are pseudo-labels obtained by manually rewriting data from a hierarchical pseudo-label dataset. It uses context learning and the Deepseek model to determine whether the hierarchical text before and after the current model's rewriting meets the rewriting requirements: given manually rewritten hierarchical text as a reference, the current model inputs the hierarchical text before and after rewriting into the Deepseek model, judges the rewriting similarity, and obtains the probability that the Deepseek model outputs the word "yes"; similarly, It is the probability that the Deepseek large model outputs the word "no"; This serves as the second reward benchmark.
7. An unsupervised hierarchical rewriting system for electrical data, characterized in that, include: The acquisition module is configured to acquire the original text of the power knowledge points to be rewritten and the target user group identification information. The cue vector construction module is configured to select a continuous cue vector group corresponding to the target user group based on the target user group identification information; The rewriting module is configured to input the original power knowledge point text and the continuous prompt vector group into the trained text rewriting model to obtain rewritten text that meets the style requirements of the target audience. During the training of the text rewriting model, the information reconstruction reward and style transfer reward are calculated by estimating the output probability of the large language model. These rewards are combined with the contrast reward to form the total reward. Unsupervised contrastive learning is then performed to fine-tune the model parameters of the text rewriting model, resulting in the trained text rewriting model.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the unsupervised power text hierarchical rewriting method according to any one of claims 1-6.
9. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps of the unsupervised power text hierarchical rewriting method according to any one of claims 1-6.
10. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps of the unsupervised power text hierarchical rewriting method according to any one of claims 1-6.