Knowledge retrieval interface implementation method, device and equipment for small power model and medium

By introducing a new domain detection and dual-path response mechanism into the small power model, combined with a pre-trained embedded model and standardized interface specifications, the problems of knowledge response delay and data security in the small power model in new domains are solved, and efficient and secure knowledge updating and real-time interaction are achieved.

CN121785690APending Publication Date: 2026-04-03ZHUHAI POWER SUPPLY BUREAU GUANGDONG POWER GIRD CO
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-31
Publication Date
2026-04-03

Smart Images

  • Figure CN121785690A_ABST
    Figure CN121785690A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of model training, and provides a knowledge retrieval interface implementation method and device for an electric power small model, equipment and a medium, and the method comprises the steps: carrying out the similarity matching of user input through a pre-training embedded model; if it is judged that the user input is new domain knowledge based on the similarity matching result, triggering retrieval enhancement to generate a response path so as to call a knowledge retrieval interface in the response path to retrieve a new domain knowledge base, and transmitting a retrieval result into the universal base model to fuse and generate an answer; if it is judged that the user input is not new domain knowledge based on the similarity matching result, under the condition that the user input belongs to the knowledge category of the power small model, calling the power small model to generate a structured natural language answer; and under the condition that the user input does not belong to the knowledge category of the electric power small model, calling the universal model to generate an answer. According to the method, a standardized interface specification of retrieval and model fusion can be formed, and the application of the knowledge retrieval interface in the electric power small model is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of model training technology, and in particular to a method for implementing a knowledge retrieval interface for a small power model, a device for implementing a knowledge retrieval interface for a small power model, a corresponding electronic device, and a corresponding computer-readable storage medium. Background Technology

[0002] The global power industry is currently accelerating its transformation towards internationalization, intelligence, and service, driven by two core demands that are propelling the upgrade of power small-scale model application interface technology. Firstly, regional integration and cross-border cooperation are creating multi-scenario interaction needs. Specifically, with the establishment of cooperation zones, diverse user structures are emerging, leading to complex power service demands. Simultaneously, under the Economic Cooperation Initiative, cross-border power project cooperation is becoming increasingly frequent, requiring interfaces to support multilingual knowledge retrieval and response to avoid service disruptions due to language or terminology discrepancies. Secondly, the rapid iteration of power knowledge is forcing improvements in interface flexibility. Specifically, the power industry's technology update cycle is shortening, and traditional interfaces, relying on full model training and redeployment, cannot quickly integrate new knowledge. For example, after a region adds a distributed photovoltaic subsidy policy, existing interfaces need to re-collect data and retrain models. During this period, when users inquire about the policy, the interface can only return a response without providing an answer, severely impacting service timeliness. Furthermore, frontline power scenarios (such as handheld terminals for maintenance personnel and self-service equipment in business halls) have stringent requirements for interface response speed, leading to delays that cannot meet real-time interaction needs.

[0003] Most of the current technologies related to power small model application interfaces in the power industry focus on single model response or independent knowledge retrieval, and have not formed a standardized interface specification for retrieval and model fusion. Summary of the Invention

[0004] This application provides a method, apparatus, device, and medium for implementing a knowledge retrieval interface for a small power model. It can form a standardized interface specification for fusion of retrieval and model, which supports both the power model's response to existing knowledge and the user's addition of knowledge and RAG (Retrieval-Augmented Generation) response. This allows for the coverage of a wider range of knowledge, providing stable responses and updating knowledge, thus realizing the application of the knowledge retrieval interface in the power model.

[0005] In one aspect, this application provides a method for implementing a knowledge retrieval interface for a small power model, the method comprising:

[0006] Similarity matching of user input is performed using a pre-trained embedding model;

[0007] If the user input is determined to be new domain knowledge based on the similarity matching result, the retrieval enhancement generation response path is triggered to call the knowledge retrieval interface in the retrieval enhancement generation response path to retrieve the new domain knowledge base, and the retrieval result is passed into the general base model to fuse and generate an answer;

[0008] If the similarity matching result determines that the user input is not new domain knowledge, then it is detected whether the user input belongs to the knowledge category of the small power model.

[0009] If the user input falls within the knowledge scope of the power mini-model, the power mini-model response path is triggered, and the power mini-model is invoked to generate a structured natural language answer; wherein, the power mini-model is trained on a preset basic model based on multilingual single-round question-and-answer data in the power field;

[0010] If the user input does not fall within the knowledge scope of the small power model, then the general model is invoked to generate an answer.

[0011] On the other hand, this application provides a knowledge retrieval interface implementation device for a small power model, the device comprising:

[0012] The similarity matching module is used to perform similarity matching on user input using a pre-trained embedding model;

[0013] The first response path triggering module is used to trigger the retrieval enhancement generation response path when the user input is determined to be new domain knowledge based on the similarity matching result. This path calls the knowledge retrieval interface in the retrieval enhancement generation response path to retrieve the new domain knowledge base and inputs the retrieval results into the general base model to fuse and generate an answer.

[0014] The knowledge category detection module is used to detect whether the user input belongs to the knowledge category of the power small model when it is determined that the user input is not new domain knowledge based on the similarity matching result.

[0015] The second response path triggering module is used to trigger the power small model response path and call the power small model to generate a structured natural language answer when the user input belongs to the knowledge scope of the power small model; and to call a general model to generate an answer when the user input does not belong to the knowledge scope of the power small model; wherein, the power small model is obtained by training a preset basic model based on multilingual single-round question and answer data in the power field.

[0016] In another aspect, this application also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the knowledge retrieval interface implementation method of any of the power mini-models described above.

[0017] In another aspect, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the knowledge retrieval interface implementation method for any of the power mini-models described in the present invention.

[0018] In another aspect, this application also provides a computer program product containing instructions that, when run on a computer, cause the computer to execute the knowledge retrieval interface implementation method for the power mini-model described in the above aspects.

[0019] The knowledge retrieval interface implementation method, apparatus, device, and storage medium provided in this application for a small-scale power model perform similarity matching on user input through a pre-trained embedded model. If the similarity matching result determines that the user input is knowledge from a new domain, a retrieval enhancement response path can be triggered to call the knowledge retrieval interface in the retrieval enhancement response path to retrieve the knowledge base of the new domain, and the retrieval result is passed to a general base model for fusion and answer generation. If the similarity matching result determines that the user input is not knowledge from a new domain, it can detect whether the user input belongs to the knowledge scope of the small-scale power model. If the user input belongs to the knowledge scope of the small-scale power model, a response path can be triggered to call the small-scale power model to directly generate a structured natural language answer. The small-scale power model can be pre-trained on a preset base model based on multilingual single-turn question-and-answer data in the power field. If the user input does not belong to the knowledge scope of the small-scale power model, a general model can be called to generate an answer. By designing a new domain detection and dual-path response mechanism, when the user input is new domain knowledge, the knowledge retrieval interface is invoked for retrieval, and the answer is generated through fusion with a general base model. When the user input is not new domain knowledge, if the user input is detected to be within the knowledge scope of the power small model (i.e., existing knowledge), the power small model is directly invoked to generate an answer. If the user input is detected to be outside the knowledge scope of the power small model, the general model is invoked to generate an answer. This forms a standardized interface specification for retrieval and model fusion, which supports both the power small model's response to existing knowledge and the user's addition of new knowledge and RAG response. This allows for the coverage of a wider range of knowledge, providing stable responses and updating knowledge, and enables the application of the knowledge retrieval interface in the power small model. Attached Figure Description

[0020] Figure 1 This is a flowchart illustrating the steps of a knowledge retrieval interface implementation method for a small power model provided in this application embodiment;

[0021] Figure 2 This is a schematic diagram illustrating the implementation process of the knowledge retrieval interface for the small power model provided in this application embodiment;

[0022] Figure 3This is a structural block diagram of a knowledge retrieval interface implementation device for a small power model provided in an embodiment of this application;

[0023] Figure 4 This is a structural block diagram of an electronic device provided in an embodiment of this application;

[0024] Figure 5 This is a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. Detailed Implementation

[0025] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0026] To facilitate understanding of the embodiments provided in this application by those skilled in the art, the technical terms involved are described as follows:

[0027] Small models: These typically refer to deep learning models with a small parameter size and simple structure, which are focused on a specific domain or task.

[0028] Adaptive multi-turn dialogue construction: A method for generating training data to transform a single-turn electricity knowledge base into a natural multi-turn dialogue using a large language model (such as DeepSeek).

[0029] Hybrid knowledge retrieval structure: refers to a dual-path decision-making mechanism that combines RAG retrieval with fine-tuning model response.

[0030] RAG: Retrieval Augmentation, refers to a technique that combines external knowledge base retrieval with model generation. When a user asks a question involving new domain knowledge that the model has not been trained on, the model first retrieves external knowledge bases and then generates an answer based on the retrieval results.

[0031] Embedding model: It is an embedding model that mainly transforms text (such as user input, knowledge base content) into low-dimensional vectors (embedded vectors). Its core function is semantic similarity matching. Specifically, semantically similar texts will be mapped to vectors that are closer in distance, and vice versa. It can be used to determine the degree of correlation between user questions and existing knowledge / new domain knowledge.

[0032] LoRA: Low-Rank Adaptation, is a lightweight model fine-tuning technique that reduces the number of fine-tuning parameters by inserting low-rank matrices into key layers of the model (such as attention layers and feedforward networks) (only the low-rank matrices need to be trained instead of all model parameters), thus reducing computational costs.

[0033] Among the current technologies related to power industry small-scale model application interfaces, most interfaces only support direct question-and-answer or static knowledge base retrieval, and have significant shortcomings in areas such as incremental knowledge updates and intelligent response logic. Specifically:

[0034] 1) Lack of new domain knowledge processing capability: Existing power small model application interfaces mostly adopt a single model response mode, only supporting the interface of model response. Due to the lack of a knowledge retrieval module, when faced with new domain knowledge that has not been trained, it can only return that it cannot be answered; the interface of simple serial retrieval with the model does not set up a new domain knowledge detection mechanism. Regardless of whether the user's question belongs to the existing trained knowledge, the retrieval process is executed first, and then the model is called. This results in a long response delay for simple questions within the scope of existing knowledge, which cannot meet the real-time interaction needs of the power front line.

[0035] 2) High cost and poor flexibility of knowledge updates, unable to respond quickly to business changes: The knowledge update of the existing interface relies on full training. Specifically, when adding new power knowledge, it is necessary to first manually organize the knowledge documents, and then retrain the model or rebuild the retrieval engine index. The whole process takes a long time. Moreover, it does not support batch updates and requires professional technicians to handle it, resulting in low efficiency of knowledge updates and inability to respond quickly to dynamic changes in power business.

[0036] 3) Lack of standardized interfaces, resulting in high integration and maintenance costs: The technical specifications of existing power small model application interfaces are not uniform. Specifically, the request parameters and return fields (calling protocols, error code systems) of interfaces from different vendors vary greatly. When power companies integrate interfaces from multiple vendors, they need to develop dedicated adaptation code for each interface, which increases the adaptation cost. Furthermore, subsequent maintenance requires keeping up with the standard updates of different vendors, resulting in low operation and maintenance efficiency.

[0037] 4) Lack of data security protection, failing to meet the privacy requirements of the power industry: Mainstream interfaces rely on public cloud services to achieve knowledge retrieval and model inference: User interaction data and power-sensitive knowledge need to be transmitted to third-party public cloud servers, making it impossible to achieve a closed-loop intranet for the entire "training-inference-storage" chain; this does not meet the requirement that power-sensitive data must be stored locally, posing a risk of data leakage and making it difficult to support scenarios such as cross-border power cooperation.

[0038] The embodiments of this application can form a standardized interface specification for retrieval and model fusion, and realize the application of knowledge retrieval interface in small power models. Specifically, by designing a new domain detection and dual-path response mechanism, when the user input is knowledge from a new domain, the knowledge retrieval interface is invoked for retrieval, and a response is generated through fusion with a general base model. When the user input is not knowledge from a new domain, if the user input is detected to fall within the knowledge scope of the power small model (i.e., it is existing knowledge), the power small model is directly invoked to generate a response. If the user input is detected to fall outside the knowledge scope of the power small model, the general model is invoked to generate a response. This allows for both responses from the power small model based on existing knowledge and responses from users who add new knowledge and provide RAG responses, thereby covering a wider range of knowledge, providing stable responses, and updating knowledge. The high coverage of new domain responses effectively lowers the understanding threshold for users. It also checks the matching between search results and user input to avoid irrelevant answers. Furthermore, the new domain knowledge base supports batch updates in XLSX format without requiring full training, meeting the rapidly changing needs of power business. In addition, standardized interface specifications can be formulated to clarify the full-link technical specifications of the interfaces, supporting power companies to quickly integrate interfaces for multiple scenarios, reducing the amount of adaptation code, lowering integration costs, and requiring only adherence to unified specifications for later maintenance, which not only reduces maintenance costs but also improves operational efficiency. In addition, a private deployment framework can be designed. For example, the implementation links of knowledge retrieval, model inference, and data storage of the interface can be deployed to the private server of the power company, without direct connection to the public network. This ensures that user interaction data and power-sensitive knowledge only circulate within the power intranet and are not transmitted to a third-party public cloud. The knowledge base of new domains is also stored in the intranet database, supporting hierarchical permission management, ensuring a closed loop of data security, ensuring zero leakage of sensitive data such as model training data and user consultation records, meeting the localization requirements of power-sensitive data, satisfying the requirements of cross-border data supervision, and applicable to scenarios such as cross-border power cooperation.

[0039] Reference Figure 1 The diagram illustrates a flowchart of the steps involved in implementing a knowledge retrieval interface for a small power model according to an embodiment of this application. Specifically, the steps may include the following:

[0040] Step S101: Similarity matching of user input is performed using a pre-trained embedding model.

[0041] This application's embodiments construct a three-layer closed-loop mechanism of detection-decision-response by designing a new domain detection and dual-path response mechanism. The pre-trained embedding model, i.e., the Embedding model, serves as the core judgment hub. It enhances retrieval accuracy through hybrid retrieval, achieves accurate technical response based on RAG and existing knowledge, and maintains natural dialogue wakefulness. It realizes an efficient interactive mode of rapid response of existing knowledge and accurate generation of new domain knowledge, ensuring a natural and high-quality response.

[0042] In the context of electricity Q&A, user input is usually a user question. In this case, the Embedding model can be used to detect new domains and determine the response path to be triggered.

[0043] Specifically, the Embedding model can be used to convert user input into input semantic vectors, and semantic vector retrieval in the knowledge vector database can be performed to obtain knowledge vectors in the power field. The similarity matching result between the input semantic vector and the knowledge vector in the power field can be calculated, and then new domain detection can be achieved based on the comparison result between the similarity matching result and the preset first threshold.

[0044] In one scenario, if the similarity matching result is less than a preset first threshold, the user input can be determined to be new domain knowledge, meaning it differs from the domain knowledge previously provided by the user for training the small power model, but is new / added power domain knowledge uploaded by the user later. In another scenario, if the similarity matching result is greater than or equal to the preset first threshold, the user input can be determined to be not new domain knowledge; in other words, it may belong to existing knowledge, i.e., the knowledge scope of the small power model, or it may be general knowledge (within or outside the power domain). It should be noted that the preset first threshold can be set based on actual conditions, such as 85%, and this embodiment does not limit it in this way.

[0045] Optionally, the similarity matching result can be calculated using a cosine similarity algorithm, and this application embodiment does not limit this.

[0046] Step S102: If the user input is determined to be new domain knowledge based on the similarity matching result, the retrieval enhancement generation response path is triggered to call the knowledge retrieval interface in the retrieval enhancement generation response path to retrieve the new domain knowledge base, and the retrieval result is passed into the general base model to fuse and generate an answer.

[0047] like Figure 2 As shown, when the user input is determined to be new domain knowledge, the RAG response path can be triggered. By combining the RAG result response, a natural interaction can be performed on the new knowledge content. The RAG response path involves calling the knowledge retrieval interface to search the new domain knowledge base and then passing the retrieval results into the general base model to fuse and generate an answer. This enables the fusion of retrieval and model, accurately generates new domain knowledge, has high coverage of new domain answers, and effectively reduces the user's understanding threshold.

[0048] Specifically, a knowledge retrieval interface can be called to search a new domain knowledge base to obtain search results. These results are typically materials matching the user's question. The search results can then be fed into a general base model for fusion and generation. In practical applications, when calling the knowledge retrieval interface to search a new domain knowledge base, a semantic matching check can also be performed. This involves verifying the relevance between the search results and the user's input. If the relevance meets a preset second threshold, it means the retrieved fragment is sufficient to generate an answer, and the search results can be directly fed into the general base model for fusion and generation. If the relevance is less than the preset second threshold, it means the retrieved fragment cannot answer the question, and an unanswerable message can be generated. It should be noted that the preset second threshold can be used to assess whether the retrieved fragment is sufficient to generate an answer. The specific value of the preset second threshold can be set based on actual circumstances, and this embodiment does not impose any limitations on this.

[0049] Among them, the general base model (such as Qwen3-8B) has not been trained, but possesses general domain knowledge and RAG capabilities.

[0050] In practical applications of retrieval and model fusion, the base model is not retrained. Instead, the base model can be used by adding context to the prompts, allowing it to generate answers based on new information and requirements. This avoids training costs and flexibly adapts to knowledge update scenarios.

[0051] In some embodiments of this application, the knowledge boundary of the base model is fixed without retraining the base model. User input can be bound to new context (such as new domain knowledge) through prompt words. Essentially, this allows the model to respond to user input based on the contextual information in the prompt words before generating an answer.

[0052] Optionally, the search results can be used as contextual information, and the contextual information, user input, and output requirements can be integrated into structured prompts. Then, the structured prompts can be input into a general base model, so that the general base model can generate answers based on the contextual information in the structured prompts, thereby achieving fusion-based answer generation.

[0053] In some embodiments of this application, the new domain knowledge base is deployed on a private server, and the new domain knowledge base can adopt a dual storage mode of local files and database. It can use xlsx format files as the user update entry point, support batch import of technical manuals, case data, etc. After the updated content is imported, it can be automatically parsed into structured data for storage, and generate corresponding new domain knowledge vectors to be stored in the new domain knowledge vector library.

[0054] Optionally, the knowledge types in the new domain knowledge base can cover both unstructured documents and structured data. Unstructured documents can include technical manuals, case studies, troubleshooting guides, etc., and when imported into the new domain knowledge base, they can be stored in a structured manner after extracting the text content. Structured data can include equipment parameter tables, operation and maintenance record tables, etc., and this data can be directly parsed and stored by field, supporting precise keyword retrieval.

[0055] When a user uploads a new XLSX file, the updated content is the newly added data, meaning that users can choose to perform incremental updates by adding only new data. After the data update, the vector library synchronization can also be triggered, eliminating the need for full training or index rebuilding, thus meeting the rapidly changing needs of the power industry.

[0056] In some embodiments of this application, when calling the knowledge retrieval interface to retrieve knowledge from a new domain knowledge base, standardized interface specifications can be formulated to clarify the full-link technical specifications of the interface, such as unified request parameters, return fields, calling protocols, error code system, and standardized API documentation and calling examples, so as to support power companies to quickly integrate interfaces for multiple scenarios and reduce integration and maintenance costs.

[0057] For example, when calling the knowledge retrieval interface, request parameters may include, but are not limited to, user identifier and user input; returned fields may include, but are not limited to, status codes (e.g., 200 Success, 400 Parameter Error, 500 Server Error), answer content, knowledge source (e.g., existing knowledge base, new domain knowledge base), and response time; the calling protocol may be, for example, HTTP / HTTPS; the error code system implements detailed error types, such as 401 (user does not have permission), 404 (related knowledge not found), and 503 (model service temporarily unavailable), and provides error handling suggestions (e.g., for 404, it is recommended to provide more details about the problem), etc. The provided standardized API documentation may include parameter descriptions, error code explanations, calling flow, etc., and supports online debugging; calling examples may be, for example, Python or Java code snippets, including both existing knowledge queries and new domain knowledge queries, reducing the user access threshold. This application embodiment does not impose any limitations on this.

[0058] Step S103: If the similarity matching result determines that the user input is not new domain knowledge, then detect whether the user input belongs to the knowledge category of the small power model.

[0059] Step S104: If the user input falls within the knowledge scope of the power small model, the power small model response path is triggered, and the power small model is called to generate a structured natural language answer.

[0060] Step S105: If the user input does not fall within the knowledge scope of the small power model, then the general model is invoked to generate an answer.

[0061] like Figure 2 As shown, if the user input is determined not to be new domain knowledge, it may belong to existing knowledge, i.e., the knowledge scope of the small power model, or it may be general knowledge (within or outside the power field). In this case, the user input can be detected.

[0062] In one scenario, if the user input falls within the knowledge scope of the power small model (i.e., it is existing knowledge), the power small model response path can be triggered. This response path can manifest as calling a pre-trained power small model to directly generate a structured natural language response. Calling a pre-trained power small model can improve the response speed to user input.

[0063] Among them, the power mini-model is a model with stable and convergent loss, which has more flexible domain knowledge question answering capabilities. Optionally, the power mini-model can be trained using a three-stage progressive training architecture. Based on the three-stage progressive training architecture, the domain knowledge reserve, multi-round interaction capability and training stability of the model are gradually improved. Specifically, the power mini-model can be trained on a preset base model based on multilingual single-round question answering data in the power field. This application embodiment will not retrain the power mini-model.

[0064] Specifically, the first stage involves single-turn injection training of knowledge from the power sector to build a base model with single-turn cross-lingual question-and-answer capabilities in the power sector. This involves directly injecting translated single-turn question-and-answer data into a pre-defined base model to provide it with basic question-and-answer capabilities in the target domain. The Qwen3 series model can be used as the pre-defined base model. The second stage involves constructing and training multi-turn dialogue data to improve the interactive coherence of the base model. This involves constructing multi-turn dialogue data based on power sector knowledge base materials, enabling the base model obtained in the first stage to possess context-sensitive multi-turn natural interaction capabilities while maintaining multilingual data balance. This can be achieved by converting single-turn question-and-answer data from a static power sector knowledge base into dynamic multi-turn dialogue data, thus improving the trained model. The third stage involves optimizing the training strategy to achieve stable loss convergence and improved generalization capabilities when facing complex power domain knowledge. Specifically, this involves introducing RSLoRA's rank selection and low-rank adaptation mechanisms onto the LoRA framework. This optimizes the multi-round interactive model obtained in the second stage, precisely fine-tuning the model parameter matrices related to power domain knowledge. This addresses issues such as loss fluctuations and overfitting in multi-stage training. The introduced rank selection mechanism precisely selects highly relevant low-rank matrices for fine-tuning based on the power domain knowledge-related parameter matrices. The introduced low-rank adaptation mechanism dynamically adjusts the dimensions of these highly relevant low-rank matrices based on the importance of the parameter matrices. During training, only the newly added low-rank parameters from RSLoRA are updated, avoiding loss oscillations caused by irrelevant parameters and precisely enhancing the flexible application of power domain knowledge. This application's embodiments do not impose limitations on this approach.

[0065] In another scenario, if the user input does not fall within the scope of knowledge of the small power model, but is general knowledge within or outside the power field, the general model can be invoked to provide a natural response.

[0066] In some embodiments of this application, training and model optimization can also be performed periodically. Since the trained model has a better understanding of domain knowledge, using the trained model within the scope of training knowledge can yield more accurate answers. In addition, the small power model also has general capabilities.

[0067] Optionally, the power mini-model can be iterated. This involves collecting user interaction data, filtering target samples from the user interaction data, and using the target samples to incrementally fine-tune the power mini-model. For example, monthly user interaction data (including user questions, answers, and user feedback) can be collected, high-quality samples (such as user satisfaction ≥ 4) can be filtered to supplement the training set, and the corpus can be updated in conjunction with the latest power industry standards to incrementally fine-tune the power mini-model, ensuring the model's depth of understanding of domain knowledge.

[0068] In this embodiment, a pre-trained embedding model is used to perform similarity matching on user input. If the similarity matching result indicates that the user input is new domain knowledge, a retrieval enhancement response generation path can be triggered to call the knowledge retrieval interface in the retrieval enhancement response generation path to retrieve the new domain knowledge base, and the retrieval result is passed to the general base model for fusion and answer generation. If the similarity matching result indicates that the user input is not new domain knowledge, it can be detected whether the user input belongs to the knowledge category of the power small model. If the user input belongs to the knowledge category of the power small model, the power small model response path can be triggered to call the power small model to directly generate a structured natural language answer. The power small model can be pre-trained on a preset base model based on multilingual single-turn question-and-answer data in the power field. If the user input does not belong to the knowledge category of the power small model, the general model can be called to generate an answer. By designing a new domain detection and dual-path response mechanism, when the user input is new domain knowledge, the knowledge retrieval interface is invoked for retrieval, and the answer is generated through fusion with a general base model. When the user input is not new domain knowledge, if the user input is detected to be within the knowledge scope of the power small model (i.e., existing knowledge), the power small model is directly invoked to generate an answer. If the user input is detected to be outside the knowledge scope of the power small model, the general model is invoked to generate an answer. This forms a standardized interface specification for retrieval and model fusion, which supports both the power small model's response to existing knowledge and the user's addition of new knowledge and RAG response. This allows for the coverage of a wider range of knowledge, providing stable responses and updating knowledge, and enables the application of the knowledge retrieval interface in the power small model.

[0069] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of this application are not limited to the described order of actions, because according to the embodiments of this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of this application.

[0070] Reference Figure 3This diagram illustrates a structural block diagram of a knowledge retrieval interface implementation device for a small power model provided in this application embodiment. The device provided in this application embodiment is deployed on a private server and may specifically include the following modules:

[0071] The similarity matching module 301 is used to perform similarity matching on user input using a pre-trained embedding model;

[0072] The first response path triggering module 302 is used to trigger the retrieval enhancement generation response path when the user input is determined to be new domain knowledge based on the similarity matching result. This is to call the knowledge retrieval interface in the retrieval enhancement generation response path to retrieve the new domain knowledge base and pass the retrieval results into the general base model to fuse and generate an answer.

[0073] The knowledge category detection module 303 is used to detect whether the user input belongs to the knowledge category of the power small model when it is determined that the user input is not new domain knowledge based on the similarity matching result.

[0074] The second response path triggering module 304 is used to trigger the power small model response path and call the power small model to generate a structured natural language answer when the user input belongs to the knowledge scope of the power small model; when the user input does not belong to the knowledge scope of the power small model, the general model is called to generate an answer; wherein, the power small model is obtained by training a preset basic model based on multilingual single-round question and answer data in the power field.

[0075] In some embodiments of this application, the similarity matching module 301 may include the following sub-modules:

[0076] The similarity matching submodule is used to convert user input into input semantic vectors using a pre-trained embedding model, retrieve knowledge vectors in the power field from the knowledge vector database, and calculate the similarity matching result between the input semantic vector and the knowledge vector in the power field. If the similarity matching result is less than a preset first threshold, the user input is determined to be new domain knowledge; if the similarity matching result is greater than or equal to the preset first threshold, the user input is determined not to be new domain knowledge.

[0077] In some embodiments of this application, the first response path triggering module 302 may include the following sub-modules:

[0078] The integrated answer generation submodule is used to use search results as contextual information; integrate contextual information, user input, and output requirements into structured prompts; input the structured prompts into a general base model, which generates an answer based on the contextual information in the structured prompts.

[0079] In some embodiments of this application, the first response path triggering module 302 may further include the following sub-modules:

[0080] The search result verification submodule is used to verify the relevance between the search results and the user input; if the relevance is less than a preset second threshold, a prompt message indicating that the answer cannot be given is generated.

[0081] In some embodiments of this application, the new domain knowledge base is stored in the power intranet database; the new domain knowledge base uses an xlsx format file as the user update entry point, and after the updated content is imported, it is automatically parsed into structured data for storage, and the corresponding new domain knowledge vector is generated and stored in the new domain knowledge vector library;

[0082] Specifically, when a user uploads a new xlsx file, the updated content is the newly added data, and the vector library is synchronized after the update.

[0083] In some embodiments of this application, the apparatus provided in this application may further include the following modules:

[0084] The fine-tuning module is used to collect user interaction data, filter target samples from the user interaction data, and use the target samples to perform incremental fine-tuning on the small power model.

[0085] In this embodiment, a pre-trained embedding model is used to perform similarity matching on user input. If the similarity matching result indicates that the user input is new domain knowledge, a retrieval enhancement response generation path can be triggered to call the knowledge retrieval interface in the retrieval enhancement response generation path to retrieve the new domain knowledge base, and the retrieval result is passed to the general base model for fusion and answer generation. If the similarity matching result indicates that the user input is not new domain knowledge, it can be detected whether the user input belongs to the knowledge category of the power small model. If the user input belongs to the knowledge category of the power small model, the power small model response path can be triggered to call the power small model to directly generate a structured natural language answer. The power small model can be pre-trained on a preset base model based on multilingual single-turn question-and-answer data in the power field. If the user input does not belong to the knowledge category of the power small model, the general model can be called to generate an answer. By designing a new domain detection and dual-path response mechanism, when the user input is new domain knowledge, the knowledge retrieval interface is invoked for retrieval, and the answer is generated through fusion with a general base model. When the user input is not new domain knowledge, if the user input is detected to be within the knowledge scope of the power small model (i.e., existing knowledge), the power small model is directly invoked to generate an answer. If the user input is detected to be outside the knowledge scope of the power small model, the general model is invoked to generate an answer. This forms a standardized interface specification for retrieval and model fusion, which supports both the power small model's response to existing knowledge and the user's addition of new knowledge and RAG response. This allows for the coverage of a wider range of knowledge, providing stable responses and updating knowledge, and enables the application of the knowledge retrieval interface in the power small model.

[0086] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0087] This application also provides an electronic device, which is described in reference to... Figure 4 The provided electronic device 400 includes a memory 410, a processor 420, and a computer program 411 stored in the memory 410 and capable of running on the processor 420. When the computer program 411 is executed by the processor, it implements the various processes of the above-described embodiment of the knowledge retrieval interface implementation method for the power small model and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0088] This application also provides a computer-readable storage medium, see embodiments thereof. Figure 5 The computer-readable storage medium 500 provides a computer program 411. When the computer program 411 is executed by the processor, it implements the various processes of the above-mentioned power small model knowledge retrieval interface implementation method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0089] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0090] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of the embodiments of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or modules is not necessarily limited to those steps or modules explicitly listed, but may include other steps or modules not explicitly listed or inherent to these processes, methods, products, or devices. The division of modules in the embodiments of this application is merely a logical division; in actual applications, there may be other division methods. For example, multiple modules may be combined into or integrated into another system, or some features may be ignored or not performed. Additionally, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interface, and the indirect coupling or communication connection between modules may be electrical or other similar forms, none of which are limited in the embodiments of this application. Furthermore, the modules or sub-modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed among multiple circuit modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiments of this application.

[0091] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0092] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0093] In the embodiments provided in this application, 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 modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules 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 indirect coupling or communication connection through some interfaces, apparatuses, or modules, and may be electrical, mechanical, or other forms.

[0094] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0095] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium.

[0096] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.

[0097] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0098] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0099] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The functions specified in one or more boxes; these computer program instructions may also be loaded onto a computer or other programmable data processing terminal equipment to cause a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0100] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.

[0101] Finally, it should be noted that 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, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.

[0102] The technical solutions provided in the embodiments of this application have been described in detail above. Specific examples have been used in the embodiments of this application to illustrate the principles and implementation methods of the embodiments of this application. The description of the above embodiments is only for the purpose of helping to understand the methods and core ideas of the embodiments of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the embodiments of this application. Therefore, the content of this specification should not be construed as a limitation on the embodiments of this application.

Claims

1. A method for implementing a knowledge retrieval interface for a small-scale power model, characterized in that, The method includes: Similarity matching of user input is performed using a pre-trained embedding model; If the user input is determined to be new domain knowledge based on the similarity matching result, the retrieval enhancement generation response path is triggered to call the knowledge retrieval interface in the retrieval enhancement generation response path to retrieve the new domain knowledge base, and the retrieval result is passed into the general base model to fuse and generate an answer; If the similarity matching result determines that the user input is not new domain knowledge, then it is detected whether the user input belongs to the knowledge category of the small power model. If the user input falls within the knowledge scope of the power mini-model, the power mini-model response path is triggered, and the power mini-model is invoked to generate a structured natural language answer; wherein, the power mini-model is trained on a preset basic model based on multilingual single-round question-and-answer data in the power field; If the user input does not fall within the knowledge scope of the small power model, then the general model is invoked to generate an answer.

2. The method according to claim 1, characterized in that, The step of performing similarity matching on user input using a pre-trained embedding model includes: The user input is transformed into an input semantic vector using the pre-trained embedding model, and a knowledge vector in the power field is obtained by semantic vector retrieval in the knowledge vector database. The similarity matching result between the input semantic vector and the knowledge vector in the power field is calculated. If the similarity matching result is less than a preset first threshold, then the user input is determined to be new domain knowledge; If the similarity matching result is greater than or equal to the preset first threshold, then the user input is determined not to be new domain knowledge.

3. The method according to claim 1 or 2, characterized in that, The step of inputting the search results into a general base model to fuse and generate a response includes: Use the search results as context information; The context information, user input, and output requirements are integrated into structured prompt words; The structured prompts are input into the general base model, which generates an answer based on the contextual information in the structured prompts.

4. The method according to claim 1, characterized in that, The step of calling the knowledge retrieval interface to retrieve knowledge from the new domain knowledge base also includes: Verify the correlation between the search results and the user input; If the correlation is less than a preset second threshold, an unanswerable prompt message is generated.

5. The method according to claim 1, characterized in that, The new domain knowledge base is stored in the power intranet database; the new domain knowledge base uses xlsx format files as the user update entry point. After the updated content is imported, it is automatically parsed into structured data for storage, and corresponding new domain knowledge vectors are generated and stored in the new domain knowledge vector library. Specifically, when a user uploads a new xlsx file, the updated content is the newly added data, and the vector library is synchronized after the update.

6. The method according to claim 1, characterized in that, The method further includes: Collect user interaction data, filter target samples from the user interaction data, and use the target samples to incrementally fine-tune the power mini-model.

7. A knowledge retrieval interface implementation device for a small-scale power model, characterized in that, The device includes: The similarity matching module is used to perform similarity matching on user input using a pre-trained embedding model; The first response path triggering module is used to trigger the retrieval enhancement generation response path when the user input is determined to be new domain knowledge based on the similarity matching result. This path calls the knowledge retrieval interface in the retrieval enhancement generation response path to retrieve the new domain knowledge base and inputs the retrieval results into the general base model to fuse and generate an answer. The knowledge category detection module is used to detect whether the user input belongs to the knowledge category of the power small model when it is determined that the user input is not new domain knowledge based on the similarity matching result. The second response path triggering module is used to trigger the power small model response path and call the power small model to generate a structured natural language answer when the user input belongs to the knowledge scope of the power small model; and to call a general model to generate an answer when the user input does not belong to the knowledge scope of the power small model; wherein, the power small model is obtained by training a preset basic model based on multilingual single-round question and answer data in the power field.

8. The apparatus according to claim 7, characterized in that, The knowledge retrieval interface implementation device for the power mini-model is deployed on a private server.

9. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the knowledge retrieval interface implementation method of the power mini-model as described in any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, it implements the knowledge retrieval interface implementation method of the power mini-model as described in any one of claims 1 to 6.