A semantic large model content controllable generation method for power supply service command
Through the Sentence-BERT sentence embedding representation model and hybrid retrieval method, the problems of multi-source data integration and information islands in the power supply service command system are solved, the query processing efficiency and security are improved, and efficient and secure information processing of the power supply service command system is realized.
Patent Information
- Application Number
- CN202411102527.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-12
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2044-08-12
AI Technical Summary
The existing technology in the power supply service command system has the problem of difficulty in integrating multi-source data and serious information island phenomenon. In addition, the large language model lacks retrieval efficiency and flexibility when processing complex or semantically rich queries, and cannot provide accurate global information of the entire network.
The Sentence-BERT sentence embedding representation model is used for text vectorization, and the comprehensive relevance score is calculated by combining dense and sparse retrieval methods. The input-output security protection model is used to improve system security and achieve efficient retrieval and security filtering of knowledge base documents.
It improves the information processing efficiency and accuracy of the power supply service command system, realizes the efficient integration of multi-source data and global information sharing, and enhances the security of the system and the accuracy of retrieval results.
Smart Images

Figure CN118964644B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to a semantic large model content controllable generation method for power supply service command, and belongs to the technical field of artificial intelligence. BACKGROUND
[0002] The current actual power supply service command system is still in a semi-automated development state, and mainly relies on expert experience for manual decision-making, and the degree of data processing and utilization is low. Based on the existing business of the operation inspection, marketing and dispatching professionals of the State Grid Corporation, a power supply service command application of "information collection, one-stop external service; process supervision, collaborative command; event inspection, risk warning; panoramic analysis, comprehensive evaluation" is constructed. However, in the actual operation process, there are problems such as difficulty in integrating multi-source data due to the diversification of information platforms, and difficulty in integrating marketing and distribution. Power companies develop different pricing strategies and personalized services for different customer groups according to use, power consumption, power consumption period and season. However, the business scope of power companies is relatively narrow, and it is difficult to obtain accurate global information to provide advanced applications. At the same time, there is a clear professional gap between different business systems, and information cannot be shared and interacted between various business subsystems, forming a series of information islands. Therefore, it is necessary to use large model technology to comprehensively integrate the current dispersed information resources, collect, classify, filter and process power big data, and conduct correlation analysis and optimal decision-making on power business.
[0003] A language large model (LLM, Large Language Models) is a deep learning model trained using a large amount of text data, which can generate natural language text or understand the meaning of language text. Language large models can handle a variety of natural language tasks such as text classification, question answering, and dialogue, and are an important way to artificial intelligence. Language large models use deep learning technology to model the statistical rules and potential semantic information of language through multiple layers of neural networks, realizing power supply service command knowledge question answering and content generation.
[0004] The prior art such as Chinese Patent No. CN114153947A discloses a document processing method, device, equipment and storage medium. The method comprises: determining each document to be searched as a to-be-searched document; inputting each to-be-searched document into a word weight model to obtain the word weight of each word in the corresponding to-be-searched document output by the word weight model; wherein the word weight model is obtained by pre-training a plurality of texts and the word weight of each word in the corresponding text; and each to-be-searched document containing the word weight of each word is added to a knowledge base for searching the to-be-searched document in the knowledge base based on the word weight of each word.
[0005] The prior art has the problem that the word weight model is relied on to give different weights to each word in the document, and then the retrieval is realized. This method is more effective for simple or structured document retrieval, but it may not be able to meet the needs when dealing with complex or semantically rich queries. When adding documents to the knowledge base, the word weight of each word needs to be calculated and stored in advance. This fixed processing method limits the scalability and flexibility of the system, especially when facing new emerging vocabulary or terminology. And mainly relying on word weight for retrieval, ignoring the overall similarity and context relationship between texts. SUMMARY
[0006] In order to solve the problems existing in the prior art, the present application proposes a semantic large model content controllable generation method for power supply service command.
[0007] The technical scheme of the present application is as follows:
[0008] On the one hand, the present application proposes a semantic large model content controllable generation method for power supply service command, comprising the following steps:
[0009] Pre-acquire the knowledge base file and load the text content of the knowledge base file, and segment the text content of the knowledge base file to obtain the question text content;
[0010] Based on the text vectorization method of the Sentence-BERT sentence embedding representation model, the vector similarity of the question text content and the text content of the knowledge base file is calculated and stored in the vector database;
[0011] The comprehensive relevance score of the question text content and the text content of the knowledge base file is calculated using hybrid retrieval, and the corresponding vector similarity results in the vector database are sorted according to the comprehensive relevance score;
[0012] The input-output security protection model is used to improve the security of the semantic large model for the question text content and the knowledge base file text content retrieval result.
[0013] As a preferred embodiment, the text content of the knowledge base file is segmented using a recursive character text splitter.
[0014] As a preferred embodiment, the text vectorization method of the Sentence-BERT sentence embedding representation model, the specific training steps are:
[0015] S1, input the question text content and any text content of the knowledge base file into two parameter-shared BERT models respectively;
[0016] S2, encode the input two text contents to generate a series of word vectors; then pass the word vectors into the Pooling layer for average pooling to obtain the sentence vector representation of the two text contents;
[0017] S3, calculate the similarity of the two sentence vectors using the cosine similarity formula, the specific calculation method is:
[0018]
[0019] Wherein, a represents the sentence vector of the question text content, b represents the sentence vector of the text content of the knowledge base file;
[0020] S4, store the similarity result in the vector database;
[0021] S5, repeat step S1 until the similarity calculation of the sentence vector of each text content of the knowledge base file and the question text content is completed.
[0022] As a preferred embodiment, the Sentence-BERT sentence embedding representation model uses mean square error to calculate the loss function MSE to optimize the model parameters, and the calculation method is represented as:
[0023]
[0024] Wherein, The expected value of the estimator is represented as: The true value is represented as:
[0025] As a preferred embodiment, the mixed retrieval is used to adjust the sorting of the corresponding vector similarity results in the vector database:
[0026] The mixed retrieval includes dense retrieval and sparse retrieval;
[0027] The dense retrieval converts the input question text content q into the hidden state Vec q According to the text vector method, the corresponding strategy is:
[0028] e q = norm(Vec q [0]);
[0029] Wherein, norm(·) represents the normalization function, Vec q [0] represents the question text content, and e q represents the question text content vector;
[0030] Convert the text content p of the knowledge base file into the hidden state Vec p According to the specific method:
[0031] ep = norm(Vec p [0]);
[0032] wherein Vec p [0] represents the text content of the knowledge base file, e p represents the text content vector of the knowledge base file;
[0033] The dense retrieval score result s dense is calculated by the question text content vector e p and the text content vector e q of the knowledge base file, and the calculation method is:
[0034] s dense ←<e p ,e q >;
[0035] Sparse retrieval is a word-level retrieval method. For each character in the question text content and each text content t in the knowledge base file, the character weight is calculated, and the calculation method is:
[0036]
[0037] wherein t represents a character in the question text content or a text content in the knowledge base file, represents the matrix mapping hidden state vector, and ReLU(·) represents a nonlinear activation function;
[0038] The same character t appears multiple times in the question text content, and only the maximum weight of the character t is retained;
[0039] According to the weight and the shared items between the question text content and the text content of the knowledge base file, the sparse retrieval score result s sparse is calculated:
[0040]
[0041] wherein q∩p represents the text content co-occurrence of the document knowledge base file;
[0042] The dense retrieval score result and the sparse retrieval score result are combined to calculate the comprehensive relevance score s rank :
[0043] s rank ←s dense +s sparse ;
[0044] According to the comprehensive relevance score s rank , the corresponding vector similarity results in the vector database are sorted;
[0045] The above steps are repeated until the text content of each knowledge base file is associated with the question text content to complete the comprehensive correlation score calculation;
[0046] The text content of the knowledge base file ranked highest in the vector database is output.
[0047] As a preferred embodiment, the input-output security protection model uses the following steps:
[0048] Seven typical security scenarios are designed, including dirty words and insults, prejudice and discrimination, illegal and criminal, physical injury, mental health, property privacy, and moral ethics;
[0049] Three types of instruction attack scenarios are designed, including prompt disclosure, role-playing instructions, and sensitive instruction topics;
[0050] The LLaMa Guard input-output protection model is used to check the question input and content output of the semantic large model based on the seven typical security scenarios and three types of instruction attack scenarios, and to classify whether a specific prompt or response is considered safe or unsafe. If the content is identified as unsafe, the category of the violation is prompted.
[0051] In another aspect, the present application also provides a semantic large model content controllable generation system for power supply service command, comprising:
[0052] The content preprocessing module pre-acquires the knowledge base file and loads the text content of the knowledge base file, and divides the text content of the knowledge base file to obtain the question text content;
[0053] The retrieval matching module calculates the vector similarity of the question text content and the text content of the knowledge base file based on the text vectorization method of the Sentence-BERT sentence embedding representation model, and stores it in the vector database;
[0054] The retrieval enhancement module uses hybrid retrieval to calculate the comprehensive correlation score of the question text content and the text content of the knowledge base file, and sorts the corresponding vector similarity results in the vector database according to the comprehensive correlation score;
[0055] The input-output protection module uses the input-output security protection model to improve the security of the semantic large model for the question text content and the knowledge base file text content retrieval results.
[0056] In another aspect, the present application also provides an electronic device having a computer program stored thereon, wherein the computer program is executed by a processor to implement a semantic large model content controllable generation method for power supply service command as described in any embodiment of the present application.
[0057] In still another aspect, the present application also provides a computer readable medium for storing one or more programs, which when executed by one or more processors, cause the one or more processors to implement a method for controllable generation of semantic large model content for power supply service-oriented command as described in any embodiment of the present application.
[0058] The present application has the following beneficial effects:
[0059] The present application effectively improves the efficiency and accuracy of subsequent processing by preloading knowledge base files and performing text content segmentation. This fine-grained processing method helps better capture key information in the text. And using the Sentence-BERT sentence embedding representation model for text vectorization, compared with the traditional bag-of-words model or TF-IDF method, Sentence-BERT can more accurately capture the semantic similarity between sentences, thereby improving the accuracy of the search results. Combined with vector similarity retrieval and comprehensive relevance scoring, double screening and adjustment of the search results are realized. This hybrid retrieval method can fully utilize the advantages of different retrieval methods, further improving the accuracy and efficiency of retrieval. Using efficient vector databases such as VectorStore to store vector similarity results not only speeds up the retrieval speed, but also facilitates further optimization and adjustment of the search results. Finally, the input-output security protection model is introduced to perform security verification and filtering on the search results of the question text content and the knowledge base file text content, effectively reducing the impact of malicious input or data pollution on the system, and improving the overall security of the system. BRIEF DESCRIPTION OF DRAWINGS
[0060] Figure 1 The step flowchart of Example 1 of the present application. DETAILED DESCRIPTION
[0061] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0062] It should be understood that the step numbers used herein are only for the convenience of description, and are not limited to the execution sequence of the steps.
[0063] It is to be understood that the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting thereof. As used in the description of the application and the appended claims, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
[0064] The terms "including" and "comprising" as used herein are meant to be open-ended terms that specify the presence of stated features, integers, steps, operations, elements, and / or components but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0065] The term "and / or" means any combination of one or more of the associated listed items and all possible combinations thereof.
[0066] Embodiment One:
[0067] Referring to Figure 1 The present application proposes a semantic large model content controllable generation method for power supply service command, comprising the following steps:
[0068] Pre-acquire the knowledge base file and load the text content of the knowledge base file, and segment the text content of the knowledge base file to obtain the question text content;
[0069] Based on the text vectorization method of the Sentence-BERT sentence embedding representation model, the vector similarity of the question text content and the text content of the knowledge base file is calculated and stored in the vector database;
[0070] The comprehensive relevance score of the question text content and the text content of the knowledge base file is calculated using hybrid retrieval, and the corresponding vector similarity results in the vector database are sorted according to the comprehensive relevance score;
[0071] The input-output security protection model is used to improve the security of the semantic large model for the question text content and the knowledge base file text content retrieval results.
[0072] As a preferred embodiment, the text content of the knowledge base file is segmented using a recursive character text splitter.
[0073] As a preferred embodiment, the text vectorization method of the Sentence-BERT sentence embedding representation model, the specific training steps are:
[0074] S1, input the question text content and any text content of the knowledge base file into two parameter-shared BERT models respectively;
[0075] S2, encode the input two text contents to generate a series of word vectors; then pass the word vectors into the Pooling layer for average pooling to obtain the sentence vector representation of the two text contents;
[0076] S3, calculate the similarity of the two sentence vectors using the cosine similarity formula, the specific calculation method is:
[0077]
[0078] Wherein, a represents the sentence vector of the question text content, and b represents the sentence vector of the text content of the knowledge base file;
[0079] S4, store the similarity result in the vector database;
[0080] S5, repeat step S1 until the similarity calculation of the sentence vector of each text content of the knowledge base file and the question text content is completed.
[0081] The idea of introducing twin network is to compare the representation of a pair of sentences and the artificially annotated similarity, so as to realize the fine tuning of BERT, and make the sentence embedding output by BERT more suitable for semantic matching scene.
[0082] As a preferred embodiment, the Sentence-BERT sentence embedding representation model uses mean square error to calculate the loss function MSE to optimize the model parameters, and the calculation method is represented as:
[0083]
[0084] Wherein, The expected value of the estimator is represented as: The true value is represented as.
[0085] The method based on the pre-trained BERT twin network can obtain a chapter vector with sufficient semantic meaning, solve the huge time overhead of semantic similarity retrieval, and solve the problem that the sentence representation is not suitable for unsupervised tasks such as clustering, sentence similarity calculation, etc. The twin network structure is used to obtain the vector representation of the sentence pair, and then the similarity model is pre-trained.
[0086] As a preferred embodiment, the mixed retrieval is used to adjust the corresponding vector similarity result in the vector database:
[0087] The mixed retrieval includes dense retrieval and sparse retrieval;
[0088] The dense retrieval converts the input question text content q into the hidden state Vec q according to the text vector method, and the specific method is:
[0089] eq = norm(Vec q [0]);
[0090] where norm(·) denotes a normalization function, Vec q [0] denotes the question text content, and e q denotes the question text content vector.
[0091] The text content p of the knowledge base file is converted into the hidden state Vec p of the corresponding strategy, and the specific method is as follows:
[0092] e p = norm(Vec p [0]);
[0093] where Vec p [0] denotes the text content of the knowledge base file, and e p denotes the text content vector of the knowledge base file.
[0094] The dense retrieval score result s dense is calculated by the question text content vector e q and the text content vector e p of the knowledge base file, and the calculation method is as follows:
[0095] s dense ←<e p ,e q >;
[0096] Sparse retrieval is a word-level retrieval method, which is used to estimate the importance of each word. For each character in the question text content and each text content t of the knowledge base file, the character weight w is calculated, and the calculation method is as follows:
[0097]
[0098] where t denotes a character in the question text content or a text content of the knowledge base file, denotes the matrix mapping hidden state vector, and ReLU(·) denotes a nonlinear activation function.
[0099] The same character t appears multiple times in the question text content, and only its maximum weight is retained.
[0100] The sparse retrieval score result s sparse is calculated according to the weight w and the shared item between the question text content and the text content of the knowledge base file:
[0101]
[0102] Wherein, q intersection p represents the text content co-occurrence item of the document knowledge base file;
[0103] The dense retrieval score result is combined with the sparse retrieval score result to calculate a comprehensive relevance score s rank :
[0104] s rank ←s dense +s sparse ;
[0105] According to the comprehensive relevance score s rank In the vector database, the corresponding vector similarity result is sorted;
[0106] Repeat the above steps until the comprehensive relevance score calculation of each text content of the knowledge base file and the question text content is completed;
[0107] Output the text content of the top-ranked knowledge base file in the vector database.
[0108] The hybrid retrieval method combines full-text search and semantic search, improving the accuracy and comprehensiveness of search results.
[0109] As a preferred embodiment, the input-output security protection model uses the following steps:
[0110] Seven typical security scenarios are designed, including dirty words and insults, prejudice and discrimination, illegal and criminal behavior, physical injury, mental health, property privacy and moral ethics;
[0111] Three types of instruction attack scenarios are designed, including prompt disclosure, role-playing instructions and sensitive instruction topics;
[0112] The LLaMa Guard input-output protection model is used to check the question input and content output of the semantic large model based on the seven typical security scenarios and three types of instruction attack scenarios, and to classify whether a specific prompt or response is considered safe or unsafe. If the identified content is unsafe, the category of the violation is prompted.
[0113] Embodiment two:
[0114] The present application provides a semantic large model content controllable generation system for power supply service command, comprising:
[0115] The content preprocessing module pre-acquires the knowledge base file and loads the text content of the knowledge base file, and divides the text content of the knowledge base file to obtain the question text content;
[0116] The retrieval matching module calculates the vector similarity of the text content of the question sentence and the text content of the knowledge base file based on the text vectorization method of the Sentence-BERT sentence embedding representation model, and stores the vector similarity in a vector database;
[0117] The retrieval enhancement module calculates the comprehensive relevance score of the text content of the question sentence and the text content of the knowledge base file using hybrid retrieval, and sorts the corresponding vector similarity results in the vector database according to the comprehensive relevance score.
[0118] The input-output protection module uses an input-output security protection model to improve the security of the semantic large model for the retrieval results of the text content of the question sentence and the text content of the knowledge base file.
[0119] Embodiment three:
[0120] The embodiment provides an electronic device having a computer program stored thereon, wherein the computer program is executed by a processor to implement a semantic large model content controllable generation method for power supply service command as described in any embodiment of the present application.
[0121] Embodiment four:
[0122] The embodiment provides a computer readable medium for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement a semantic large model content controllable generation method for power supply service command as described in any embodiment of the present application.
[0123] In the embodiments of the present application, "at least one" means one or more, and "multiple" means two or more. The "and / or" describes the association relationship of the associated objects, which means that there can be three kinds of relationships, for example, A and / or B, which can represent the cases of A alone, A and B together, and B alone. Wherein A and B can be singular or plural. The character " / " generally represents that the front and rear associated objects are in an "or" relationship. "At least one of the following" and the like means any combination of these items, including any combination of single or multiple items. For example, at least one of a, b and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, wherein a, b, and c can be single or multiple.
[0124] Those skilled in the art can clearly understand that the units and algorithm steps described in the embodiments disclosed herein can be realized by electronic hardware, computer software and a combination of the two. Whether the functions are realized 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 realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0125] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be described here.
[0126] In several embodiments provided in the present application, any function realized in the form of a software function unit and sold or used as an independent product can be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts that make contributions to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0127] The above is only an embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation, or direct or indirect application in other related technical fields, is also included in the patent protection scope of the present application.
Claims
1. A method for generating content-controllable semantic large models for power supply service command, characterized in that: The following steps are involved: Pre-acquire the knowledge base file and load the text content of the knowledge base file at the same time, and segment the text content of the knowledge base file to obtain the text content of the question; A text vectorization method based on the Sentence-BERT sentence embedding representation model calculates the vector similarity between the question text content and the text content of the knowledge base file and stores it in the vector database; Use hybrid retrieval to calculate the comprehensive relevance score between the question text content and the knowledge base document text content, and sort the corresponding vector similarity results in the vector database according to the comprehensive relevance score. The specific steps are as follows: Hybrid retrieval includes dense retrieval and sparse retrieval; The dense retrieval converts the input question text content q into the hidden state Vec of the corresponding strategy according to the text vector method. q , the specific method is: e q =norm(Thing q [0]); Among them, norm(·) represents the normalization function, Vec q [0] represents the question text content, e q Represents the question text content vector; Convert the text content p of the knowledge base file into the hidden state Vec of the corresponding strategy p , the specific method is: e p =norm(Thing p [0]); Among them, Vec p [0] represents the text content of the knowledge base file, e p A text content vector representing a knowledge base document; By question text content vector e q The text content vector of the knowledge base file p Calculate the dense search score result s dense , the calculation method is: s dense ← <e p ,e q >; Sparse search is a word-level search method. For each character in the question text and each text content t in the knowledge base file, the character weight The calculation method is: Where t represents the characters in the question text or the text content of the knowledge base file, represents the matrix mapping hidden state vector, and ReLU(·) represents the nonlinear activation function; If the same character t appears multiple times in the question text, only its maximum weight is retained; According to the weight w qt and the shared items between the question text content and the text content of the knowledge base file to calculate the sparse retrieval score result s sparse : Among them, q∩p represents the coexistence items of the text content of the document knowledge base file; Combine the dense search score results with the sparse search score results to calculate the comprehensive relevance score s rank : s rank ←s dense +s sparse ; According to the comprehensive relevance score rank Sort the corresponding vector similarity results in the vector database; Repeat the above steps until all the text contents of the knowledge base file and the question text content have completed the comprehensive relevance score calculation; Output the text content of the knowledge base file with the highest ranking in the vector database; For the retrieval results of question text content and knowledge base file text content, an input-output security protection model is used to improve the security of the semantic large model.
2. The method for generating a semantic large model with controllable content for power supply service command according to claim 1, characterized in that: The text content of the knowledge base file is segmented using a recursive character text splitter.
3. The method for generating a semantic large model with controllable content for power supply service command according to claim 1, characterized in that: The text vectorization method of the Sentence-BERT sentence embedding representation model has the following specific training steps: S1. Input the question text content and any text content of the knowledge base file into two parameter-sharing BERT models respectively; S2. Encode the two input text contents to generate a series of word vectors; then pass the word vectors to the Pooling layer for average pooling to obtain the sentence vector representation of the two text contents; S3. Use the cosine similarity formula to calculate the similarity between the two sentence vectors. The specific calculation method is: Among them, α represents the sentence vector of the question text content, and b represents the sentence vector of the text content of the knowledge base file; S4, storing the similarity results in a vector database; S5. Repeat step S1 until the sentence vector similarity calculation is completed between each text content in the knowledge base file and the question text content.
4. The method for generating a semantic large model with controllable content for power supply service command according to claim 3, characterized in that: The Sentence-BERT sentence embedding representation model uses the mean square error to calculate the loss function MSE to optimize the model parameters. The calculation method is expressed as: in, represents the expected value of the estimator, Represents the true value.
5. The method for generating a semantic large model with controllable content for power supply service command according to claim 1, characterized in that: The steps for using the input-output security protection model are as follows: Design seven typical safety scenarios, including swearing and insults, prejudice and discrimination, illegal crimes, physical harm, mental health, property privacy, and morality and ethics; Design three types of command attack scenarios, including prompt leakage, role-playing commands, and sensitive command topics; The LLaMa Guard input-output protection model is used to check the question input and content output of the semantic large model based on seven typical security scenarios and three types of instruction attack scenarios, and classify them to determine whether a specific prompt or response is considered safe or unsafe. If the root identification content is unsafe, the violation category is prompted.
6. A semantic large model content controllable generation system for power supply service command, using the semantic large model content controllable generation method for power supply service command according to any one of claims 1 to 5, characterized in that: include: The content preprocessing module pre-acquires the knowledge base file and loads the text content of the knowledge base file, and segments the text content of the knowledge base file to obtain the text content of the question; The retrieval and matching module uses the text vectorization method of the Sentence-BERT sentence embedding representation model to calculate the vector similarity between the text content of the question and the text content of the knowledge base file, and stores it in the vector database; The retrieval enhancement module uses hybrid retrieval to calculate the comprehensive relevance score between the question text content and the text content of the knowledge base file, and sorts the corresponding vector similarity results in the vector database according to the comprehensive relevance score; The input-output protection module uses the input-output security protection model to improve the security of the semantic large model for the question text content and the knowledge base file text content retrieval results.
7. A semantic large model content controllable generation system for power supply service command according to claim 6, characterized in that: The retrieval matching module and the text vectorization method of the Sentence-BERT sentence embedding representation model have the following specific training steps: S1. Input the question text content and any text content of the knowledge base file into two parameter-sharing BERT models respectively; S2. Encode the two input text contents to generate a series of word vectors; then pass the word vectors to the Pooling layer for average pooling to obtain the sentence vector representation of the two text contents; S3. Use the cosine similarity formula to calculate the similarity between the two sentence vectors. The specific calculation method is: Among them, α represents the sentence vector of the question text content, and b represents the sentence vector of the text content of the knowledge base file; S4, storing the similarity results in a vector database; S5. Repeat step S1 until the sentence vector similarity calculation is completed between each text content in the knowledge base file and the question text content.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, it implements a method for controllable generation of semantic large model content for power supply service command as described in any one of claims 1 to 5.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, it implements a method for controllable generation of semantic large model content for power supply service command as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Document processing method and device, equipment and storage medium
CN114153947A
Semantic large model content generation method and device, electronic equipment and storage medium
CN117370577A
Knowledge retrieval enhancement generation method and system based on large language model
CN118394890A