Small sample knowledge base construction method and device for vertical field
Patent Information
- Application Number
- CN202610802163.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-04
- Publication Date
- 2026-10-02
AI Technical Summary
当前垂直领域智能应用普遍面临三大核心痛点:一是领域专业数据稀缺,公开数据集少、企业内部数据脱敏成本高,传统知识库构建依赖大量人工标注,成本高周期长;二是领域知识更新快,传统静态知识库时效性差,无法适配业务变化;三是小样本场景下预训练模型泛化能力弱,领域知识理解不深,抽取准确率低,且全量重训容易引发灾难性遗忘,无法持续迭代
[0017]由上述方案可知,本公开提供的面向垂直领域的小样本知识库构建方法和装置,通过采集多渠道小样本数据对预训练大模型进行微调,实现领域知识自动化抽取,知识库与模型构建形成互补闭环,知识更新推动模型优化,模型提升反哺知识抽取,实现二者的持续协同进化;通过建立动态更新机制和版本管理体系,实现知识的实时更新和历史回溯,通过知识库质量与模型性能的双重评估体系,形成了数据采集-知识库构建-模型训练-评估优化闭环,可以在数据稀缺的垂直领域中构建高质量的知识库,并提升模型的精度和泛化能力。
Smart Images

Figure CN122862597A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and more specifically, to a method and apparatus for constructing a few-sample knowledge base for a vertical domain. Background Technology
[0002] Vertical domains refer to niche markets and specialized services targeting a specific industry or professional field. Currently, intelligent applications in vertical domains generally face three core pain points: First, domain-specific data is scarce, with few publicly available datasets and high costs associated with anonymizing internal enterprise data. Traditional knowledge base construction relies heavily on manual annotation, which is costly and time-consuming. Second, domain knowledge updates rapidly, and traditional static knowledge bases are not timely enough to adapt to business changes. Third, pre-trained models have weak generalization ability in small-sample scenarios, lack a deep understanding of domain knowledge, have low extraction accuracy, and full retraining can easily lead to catastrophic forgetting, making continuous iteration impossible. Summary of the Invention
[0003] The main purpose of this application is to provide a method and apparatus for constructing a small-sample knowledge base for vertical domains, which can build a high-quality knowledge base in data-scarce vertical domains and provide high-quality knowledge support for applications such as intelligent question answering and decision assistance in vertical domains.
[0004] To achieve the above objectives, the first aspect of this application proposes a method for constructing a few-sample knowledge base oriented towards a vertical domain, including: Data from various vertical domains is acquired through multiple channels and then cleaned, lightly labeled, and structured to obtain domain sample data. A pre-trained large model is fine-tuned based on this data. Domain knowledge, including entities, relationships, and attributes, is extracted from the fine-tuned model, and this extracted knowledge is validated and integrated to form a standardized knowledge base. New knowledge data is acquired, and the model is incrementally trained using a weighted incremental loss function to output an optimized domain model. This optimized model is then used to extract new knowledge from the new data, which is then validated and integrated into the existing knowledge base. The quality of the knowledge base and model performance are periodically evaluated according to the domain knowledge update cycle to generate a comprehensive evaluation score. Based on the evaluation results, the knowledge extraction rules, incremental training strategies, and knowledge base schema are optimized.
[0005] Furthermore, data from vertical domains is acquired from multiple channels, and the acquired data is cleaned, lightly labeled, and structured to obtain domain sample data, including: We acquire raw data from multiple channels, including domain-specific documents, industry reports, official websites and databases, vertical community Q&A and forums, and internal enterprise data. We remove garbled characters, redundancy, irrelevant information and abnormal data from the acquired raw data and perform format standardization processing. Initial annotations are performed on the cleaned data based on a general domain model. The annotation elements include domain entities, relationships, and attributes. An uncertainty sampling algorithm is used to select samples with model confidence scores below a threshold for manual annotation, and the consistency of the annotations is verified. The labeled data is converted into a structured format that can be used for model training and knowledge extraction, and divided into training set, validation set and test set according to the proportion. Data augmentation is performed on the training set to obtain domain sample data.
[0006] Furthermore, the pre-trained large model is fine-tuned based on domain sample data. Domain knowledge, including entities, relationships, and attributes, is extracted from the fine-tuned model. The extracted domain knowledge is then validated and integrated to form a standardized knowledge base, including: Based on domain characteristics, a pre-trained model based on the Transformer architecture is selected, and the pre-trained model is fine-tuned based on domain sample data. During the model training process, a multi-task joint learning framework for entity, relation, and attribute extraction is adopted, and a multi-task weighted loss function is used to balance the training objectives of each task. The model parameters are adjusted according to the effect of each task. Based on the fine-tuned model, domain knowledge including entities, relationships, and attributes is extracted simultaneously, and the extracted entity, relationship, and attribute results are checked against preset rules to see if they conform to the logic and common sense of the domain and whether there are any conflicts. The entity, relation, and attribute extraction results are integrated into standardized knowledge triples, and the attribute information related to the entity is integrated into entity-attribute key-value pairs; The integrated knowledge triples and entity attribute information are categorized and stored in the knowledge base according to domain knowledge categories.
[0007] Furthermore, the integrated knowledge triples and entity attribute information are categorized and stored in the knowledge base according to domain knowledge categories, including: Design a knowledge graph schema that conforms to the characteristics of the domain, define entity types, relation types, and attribute specifications; use a hybrid storage method of graph database, relational database, and vector database to store the integrated knowledge triples and entity attribute information according to the knowledge base schema.
[0008] Furthermore, new knowledge data is acquired, and the model is incrementally trained using a weighted incremental loss function to output an optimized domain model. This optimized domain model is then used to extract new knowledge from the new data. The new knowledge is then validated and integrated into the existing knowledge base, including: We continuously collect new knowledge data from vertical domains and preprocess it. Then, we fuse this new knowledge data with representative data from the existing knowledge base. We use a weighted incremental loss function to incrementally train the model. The weighted loss function is:
[0009] in, For the cross-entropy loss of newly added knowledge data, This refers to the knowledge distillation loss of the original knowledge base data. The weight coefficients range from (0,1) and are used to balance the weights of training with new data and retaining existing knowledge. The existing validation set is used to evaluate the retention of basic knowledge, and the validation set built with new data is used to evaluate the learning effect of new knowledge. If the model performance does not reach the expected threshold, the hyperparameters are adjusted or training data is added, and the model is retrained to obtain an optimized domain model. Using the optimized domain model, the latest knowledge is extracted from the new knowledge data, and the new knowledge is output. The new knowledge is then double-validated based on rules and models and integrated into the existing knowledge base. Each time the knowledge base is updated, a knowledge base version number is generated, and the added, deleted, and modified knowledge entries and timestamps are recorded.
[0010] Furthermore, the quality of the knowledge base is evaluated using the following formula: in, For the accuracy of knowledge in the knowledge base, For the completeness of knowledge in the knowledge base, To ensure the timeliness of knowledge in the knowledge base, Let be the weighting coefficient, satisfying ; The model performance is evaluated using the following formula:
[0011] in, To improve the accuracy of knowledge extraction from the model, To improve the recall rate of knowledge extraction for the model. Extract F1 scores for model knowledge. These are the weighting coefficients, and ; The overall evaluation score is:
[0012] in, The score is used to assess the quality of the knowledge base. The score is used to evaluate the model's performance.
[0013] Furthermore, the method also includes: constructing a three-layer decoupled architecture comprising a knowledge storage layer, a knowledge retrieval layer, and a knowledge update layer. The knowledge storage layer is responsible for the persistent storage of domain knowledge, knowledge base schema version management, access control, and data backup. The knowledge retrieval layer provides retrieval interfaces for entity retrieval, relationship retrieval, path retrieval, and semantic retrieval, connects to upper-layer business systems, and shields the underlying storage details. The knowledge update layer is used to obtain newly added domain knowledge data from external systems in real time, and updates the existing knowledge base after performing rule and model dual verification on the newly added knowledge data.
[0014] The second aspect of this disclosure provides a device for constructing a few-sample knowledge base for a vertical domain, comprising: The data acquisition and processing module is used to acquire data from multiple channels in the vertical field, and to clean, lightly label and structure the acquired data to obtain field sample data. The knowledge base construction module is used to fine-tune the pre-trained large model based on domain sample data, extract domain knowledge including entities, relationships and attributes based on the fine-tuned model, and verify and integrate the extracted domain knowledge to form a standardized knowledge base. The optimization and update module is used to acquire new knowledge data, incrementally train the model using a weighted incremental loss function, output an optimized domain model, extract new knowledge from the new data using the optimized domain model, verify the new knowledge and integrate it into the existing knowledge base. The performance evaluation module is used to periodically evaluate the quality of the knowledge base and the performance of the model according to the domain knowledge update cycle, generate a comprehensive evaluation score, and optimize the knowledge extraction rules, incremental training strategies and knowledge base schema based on the evaluation results.
[0015] A third aspect of this disclosure provides a computer-readable storage medium storing computer instructions for causing a computer to perform the method provided in the first aspect.
[0016] A fourth aspect of this disclosure provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to cause the at least one processor to perform the method provided in the first aspect.
[0017] As can be seen from the above scheme, the method and apparatus for constructing small-sample knowledge bases for vertical domains provided in this disclosure achieves automated extraction of domain knowledge by collecting small-sample data from multiple channels to fine-tune a pre-trained large model. The knowledge base and model construction form a complementary closed loop, with knowledge updates driving model optimization and model improvement feeding back into knowledge extraction, thus achieving continuous synergistic evolution between the two. By establishing a dynamic update mechanism and version management system, real-time updates and historical backtracking of knowledge are achieved. Through a dual evaluation system of knowledge base quality and model performance, a closed loop of data collection-knowledge base construction-model training-evaluation and optimization is formed. This allows for the construction of high-quality knowledge bases in data-scarce vertical domains and improves the accuracy and generalization ability of the model. Attached Figure Description
[0018] The accompanying drawings, which form part of this application, are used to provide a further understanding of the application and to make other features, objects, and advantages of the application more apparent. The illustrative embodiments and descriptions of this application are used to explain the application and do not constitute an undue limitation of the application. In the drawings: Figure 1 A flowchart illustrating the method for constructing a small-sample knowledge base for a vertical domain provided in this application; Figure 2 A schematic diagram of the structure of the small-sample knowledge base construction device for vertical domains provided in this application; Figure 3 This is a block diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation
[0019] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0020] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings 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 for the embodiments of this application 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 apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0021] In vertical domains, data is often small in quantity and scattered, making it difficult to directly apply traditional large-scale data-driven knowledge base construction methods. Existing technologies suffer from insufficient model generalization ability and untimely knowledge base updates when processing small sample data, thus limiting the effectiveness of domain-specific intelligent applications.
[0022] To address the issues of traditional vertical domain knowledge base construction relying on large-scale labeled data, weak model generalization ability, and poor knowledge timeliness, this disclosure proposes a knowledge base construction method for vertical domains with small sample data. Through efficient utilization of small sample data, incremental training mechanisms, and closed-loop iterative logic, it achieves automatic extraction and structured storage of domain knowledge. At the same time, it allows the model and knowledge base to continuously evolve with new data, improving domain adaptability and knowledge timeliness, and providing high-quality knowledge support for vertical domain applications such as intelligent question answering and business assistance.
[0023] Figure 1 A flowchart illustrating the method for constructing a small-sample knowledge base for a vertical domain provided in this application. (Refer to...) Figure 1 As shown, in step S102, data from the vertical field is obtained from multiple channels, and the obtained data is cleaned, lightly labeled and structured to obtain field sample data.
[0024] Given the limited and scattered nature of data in vertical industry sectors, we first conduct small-sample data collection from multiple channels to identify the core categories that need to be covered (e.g., in the legal field, the core includes legal provisions, judicial interpretations, causes of action, sentencing rules, and contract terms; in the medical field, the core includes diseases, drugs, treatment guidelines, and examination indicators). Then, we collect data from different data sources in a targeted manner to avoid blindly crawling invalid data. This includes, but is not limited to, multi-source heterogeneous data such as professional documents in vertical fields, publicly available industry reports, official websites in the field, Q&A in vertical communities, and internal business data of enterprises.
[0025] Specifically, professional documents in fields such as academic papers, industry standards, technical manuals, and patent documents can be obtained from public databases. Web scraping techniques are used to crawl Q&A content and comments from industry discussion forums and technical Q&A platforms. Internal enterprise data is obtained from CRM systems, log data, and product information databases, and anonymized private data such as internal business databases, work order systems, and customer service dialogue records are also integrated, collecting only structured / unstructured data relevant to domain knowledge. This multi-channel data approach covers typical business scenarios, ensuring the representativeness of small samples.
[0026] The acquired raw data is cleaned to remove garbled characters, redundancy, irrelevant information, and abnormal data. The format is then standardized by converting all unstructured text to Markdown / plain text format and encoding it uniformly to UTF-8. Metadata such as the source, time, and author of the original data is preserved for subsequent knowledge tracing.
[0027] For small-sample scenarios, a lightweight annotation mode combining pre-annotation and manual verification is adopted to annotate only three core knowledge elements: domain entities, entity relationships, and entity attributes, significantly reducing annotation costs. Initial annotation is performed on the cleaned data based on a general domain model, with annotation elements including domain entities, relationships, and attributes. An uncertainty sampling algorithm is used to select samples with model confidence scores below a threshold for manual annotation, and annotation consistency is verified. For example, the BIOES annotation system is used to clearly define the annotation boundaries for various entities, relationships, and attributes. After annotation, the consistency is verified using the Kappa coefficient (Kappa ≥ 0.85), and unqualified samples are re-annotated.
[0028] The labeled data is standardized into a structured format that can be used for model training and knowledge extraction, and divided into training, validation, and test sets in a ratio (e.g., 7:2:1). Data augmentation is performed on the training set, such as synonym replacement, back translation, and sentence rewriting. The size of the training set is expanded by 2-3 times without introducing noise, which alleviates the problem of overfitting with small samples and forms a domain sample dataset that is suitable for fine-tuning with small samples.
[0029] In step S104, the pre-trained large model is fine-tuned based on domain sample data. Domain knowledge, including entities, relationships, and attributes, is extracted based on the fine-tuned model. The extracted domain knowledge is then verified and integrated to form a standardized knowledge base.
[0030] In scenarios with limited sample data in vertical domains, a pre-trained model based on the Transformer architecture can be selected according to domain characteristics. To adapt the pre-trained model to domain-specific knowledge, the domain sample data generated in step S102 is used to train the model with a small number of iterations. During training, a multi-task joint learning framework for entity, relation, and attribute extraction is adopted. The bottom layer shares the Transformer encoding layer, and the top layers are built with three task heads: entity recognition head, relation classification head, and attribute extraction head. The three tasks share the underlying semantic features, reducing the number of parameters while implementing constraints between tasks (such as the two ends of relation extraction must be identified entities). A multi-task weighted loss function is used to balance the training objectives of each task. The model parameters are adjusted according to the performance of each task. The method of freezing some layer parameters and fine-tuning with a low learning rate is used to avoid overfitting caused by small samples and to optimize the model's ability to understand domain-specific vocabulary and terminology.
[0031] Among them, entity extraction is used to identify core concepts and technical terms in the text, relation extraction is used to identify semantic relationships between entities, such as "company-established-year", and attribute extraction is used to obtain key features and attribute values of entities, such as "product-model-specification".
[0032] The extracted knowledge may contain errors or conflicts. Therefore, a preliminary verification of the extracted knowledge is performed. Based on preset rules, the extraction results of entities, relationships, and attributes are checked to see if they conform to the logic and common sense of the domain and whether there are any conflicts. For example, rule matching, dictionary comparison, and model prediction confidence are used to eliminate obviously erroneous entities or relationships. Entries with missing values, abnormal formats, or logical contradictions are corrected or marked as pending confirmation. Multiple conflicting relationships or attribute values for the same entity are detected and filtered using priority rules (data source reliability, timestamp, frequency, etc.). Conflict information can be recorded for subsequent manual review or incremental updates. The entity, relationship, and attribute extraction results are integrated into standardized knowledge triples (entity 1, relationship, entity 2), and the attribute information related to the entity is integrated into entity-attribute key-value pairs (entity, attribute, value). The integrated knowledge triples and entity attribute information are stored in the knowledge base.
[0033] In one embodiment of this disclosure, knowledge is grouped and managed according to domain knowledge categories (such as enterprise information, product information, technical parameters, etc.). Each group of knowledge forms an independently callable subset of knowledge, supporting rapid retrieval by application systems. A knowledge base schema conforming to domain characteristics is designed, defining entity types, relationship types, and attribute specifications. Specifically, core entities within the domain are identified; for example, in the pharmaceutical field, this may include "drugs," "diseases," and "ingredients"; in the automotive field, it may include "models," "parts," and "suppliers." A unique identifier, name, and basic attribute fields are defined for each type of entity. Semantic relationships between entities are defined, such as "drugs-treatment-disease" and "models-contains-parts." The directionality, optional attributes, and constraint rules are defined for each relationship. Entity attributes are standardized, including type, unit, and optional value range. Data validation rules are established to ensure consistency between data input and extraction. The completed schema is not only used for storage but also guides subsequent knowledge verification, updates, and queries.
[0034] To accommodate complex relational and attribute queries, a hybrid storage approach combining graph and relational databases is employed. The integrated knowledge triples and entity attribute information are stored according to the designed schema, constructing a three-layer decoupled architecture comprising a knowledge storage layer, a knowledge retrieval layer, and a knowledge update layer. This ensures flexibility in knowledge querying and expansion. The knowledge storage layer is responsible for persistent storage of domain knowledge, knowledge base schema version management, access control, and data backup. The knowledge retrieval layer provides retrieval interfaces for entity retrieval, relation retrieval, path retrieval, and semantic retrieval, interfacing with upper-layer business systems and shielding the underlying storage details. The knowledge update layer retrieves new domain knowledge data from external systems in real time, performs rule and model dual validation on the new knowledge data, and updates it to the existing knowledge base. The graph database stores knowledge triples (entity 1, relation, entity 2), supporting complex relational and path queries, such as entity association analysis and shortest path retrieval. Graph databases such as Neo4j, ArangoDB, or JanusGraph can be selected. Relational databases are used to store entity attribute key-value pairs (entity, attribute, value) and standardized data tables, supporting fast attribute queries and statistical analysis, facilitating the generation of reports or data interfaces. Relational databases such as MySQL and PostgreSQL can be selected. They maintain a mapping relationship between knowledge triples and entity attributes between graph databases and relational databases. Data consistency is achieved through scheduled synchronization or real-time update interfaces.
[0035] In step S106, new knowledge data is acquired, the model is incrementally trained using a weighted incremental loss function, an optimized domain model is output, new knowledge is extracted from the new data using the optimized domain model, and the new knowledge is verified and integrated into the existing knowledge base.
[0036] Continuously collect new knowledge data in the vertical domain, such as the latest case studies, experimental results, and user question-and-answer data, and complete preprocessing such as data cleaning, annotation, and standardization. Merge the new knowledge data with representative data from the existing knowledge base to form a training set, and incrementally train the model using a weighted incremental loss function. The weighted loss function is:
[0037] in, For the cross-entropy loss of newly added knowledge data, This refers to the knowledge distillation loss of the original knowledge base data. The weighting coefficients, ranging from (0,1), are used to balance the weights of training on new data and retaining existing knowledge, ensuring the model retains old knowledge while absorbing new knowledge. The existing validation set is used to evaluate the retention of basic knowledge, while a validation set built with the new data is used to evaluate the learning effect of new knowledge. If the model performance does not reach the expected threshold, the hyperparameters are adjusted or training data is added, and the model is retrained to output an optimized domain model. This improves the model's ability to understand and extract domain knowledge while avoiding catastrophic forgetting.
[0038] Using an optimized domain model, the latest knowledge is extracted from newly added knowledge data, and the new knowledge is output. After dual validation based on rules and the model, the new knowledge is integrated into the existing knowledge base. Each time the knowledge base is updated, a version number is generated, and the added, deleted, and modified knowledge entries and their timestamps are recorded. Rule validation checks the format, completeness, and legal attribute values, while model validation uses the domain model or auxiliary models to verify the rationality of the extracted knowledge. The validated new knowledge is then integrated into the existing knowledge base, performing deduplication, correction, and supplementation operations to ensure the validity, consistency, and completeness of the new knowledge. A knowledge version management mechanism is established to record update information and support version backtracking and historical queries of the knowledge base.
[0039] In step S108, the quality of the knowledge base and the performance of the model are evaluated periodically according to the domain knowledge update cycle, a comprehensive evaluation score is generated, and the knowledge extraction rules, incremental training strategies and knowledge base schema are optimized based on the evaluation results.
[0040] To ensure the continuous improvement of incremental training and knowledge base updates, a dual evaluation system is established. Knowledge base quality and model performance are evaluated regularly based on the speed of domain knowledge updates, generating a comprehensive evaluation score. Knowledge extraction rules, incremental training strategies, and schemas are then optimized based on the evaluation results. Specifically, this includes setting an appropriate evaluation frequency (e.g., monthly, quarterly, or semi-annual) according to the speed of domain knowledge updates and the model's training cycle. Evaluation is conducted immediately after knowledge base and model updates to ensure their effectiveness aligns with actual needs.
[0041] The quality of a knowledge base can be evaluated using the following formula: in, For the accuracy of knowledge in the knowledge base, For the completeness of knowledge in the knowledge base, To ensure the timeliness of knowledge in the knowledge base, Let be the weighting coefficient, satisfying ; The model performance is evaluated using the following formula:
[0042] in, To improve the accuracy of knowledge extraction from the model, To improve the recall rate of knowledge extraction for the model. Extract F1 scores for model knowledge. These are the weighting coefficients, and .
[0043] The overall evaluation score is:
[0044] in, The score is used to assess the quality of the knowledge base. The score is used to evaluate the model's performance.
[0045] If the overall evaluation score is lower than the preset threshold (e.g., 80 points), optimization measures need to be taken. Optimization directions include: adjusting or expanding existing knowledge extraction rules and adding more domain-specific constraints; optimizing incremental training strategies to ensure a balance between old and new data and reduce catastrophic forgetting; optimizing the knowledge base schema according to new needs or data changes, and adding new entities, relationships, or attributes; and adjusting the model architecture or fine-tuning strategies based on the evaluation results to improve the model's ability to understand and extract domain knowledge.
[0046] Based on the optimized rules and strategies, knowledge extraction is performed again to ensure that new data can be effectively incorporated into the knowledge base. Incremental training is then conducted using the updated knowledge base to enhance the model's domain adaptability. Validated new knowledge is integrated into the knowledge base, and the performance of the model and knowledge base is re-evaluated. Through continuous closed-loop iteration, the overall performance of the system can be effectively improved, while ensuring that the system can adapt to new domain requirements and technological developments over time.
[0047] As can be seen from the above scheme, the method for constructing a small-sample knowledge base for vertical domains provided in this disclosure fine-tunes a pre-trained large model by collecting small-sample data from multiple channels, thereby achieving automated extraction of domain knowledge. The knowledge base and model construction form a complementary closed loop, with knowledge updates driving model optimization and model improvement feeding back into knowledge extraction, achieving continuous synergistic evolution between the two. By establishing a dynamic update mechanism and version management system, real-time updates and historical backtracking of knowledge are achieved. Through a dual evaluation system of knowledge base quality and model performance, a closed loop of data collection-knowledge base construction-model training-evaluation and optimization is formed. This method can construct a high-quality knowledge base in data-scarce vertical domains and improve the accuracy and generalization ability of the model.
[0048] Figure 2 This is a schematic diagram of the structure of the vertical domain-oriented few-shot knowledge base construction device 200 provided in this application. The vertical domain-oriented few-shot knowledge base construction device 200 may include: The data acquisition and processing module 210 is used to acquire data from multiple channels in the vertical field, and to clean, lightly label and structure the acquired data to obtain field sample data. The knowledge base construction module 220 is used to fine-tune the pre-trained large model based on domain sample data, extract domain knowledge including entities, relations and attributes based on the fine-tuned model, and verify and integrate the extracted domain knowledge to form a standardized knowledge base. The optimization and update module 230 is used to acquire new knowledge data, incrementally train the model using a weighted incremental loss function, output an optimized domain model, extract new knowledge from the new data using the optimized domain model, verify the new knowledge and integrate it into the existing knowledge base. The performance evaluation module 240 is used to periodically evaluate the quality of the knowledge base and the performance of the model according to the domain knowledge update cycle, generate a comprehensive evaluation score, and optimize the knowledge extraction rules, incremental training strategies and knowledge base schema based on the evaluation results.
[0049] The small-sample knowledge base construction apparatus for vertical domains provided in this disclosure can execute the above-described method embodiments. Its specific implementation principle and technical effects can be found in the above-described method embodiments, and will not be repeated here.
[0050] This disclosure also provides an electronic device, such as... Figure 3 As shown, the electronic device includes one or more processors 301 and a memory 302. Figure 3 Take processor 301 as an example.
[0051] The electronic device may also include an input device 303 and an output device 304.
[0052] The processor 301, memory 302, input device 303, and output device 304 can be connected via a bus or other means. Figure 3 Taking the example of a connection between China and Israel via a bus.
[0053] Processor 301 can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations of the above types of chips. The general-purpose processor can be a microprocessor or any conventional processor.
[0054] The memory 302, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the methods in the embodiments of this disclosure. The processor 301 executes various functional applications and data processing of the server by running the non-transitory software programs, instructions, and modules stored in the memory 302, thereby implementing the methods in the above-described method embodiments.
[0055] Memory 302 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created by the use of the processing device operated by the server. Furthermore, memory 302 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 302 may optionally include memory remotely located relative to processor 301, and these remote memories can be connected to a network connection device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0056] One or more modules are stored in memory 302 and, when executed by one or more processors 301, perform the methods shown in the above embodiments.
[0057] Those skilled in the art will understand that all or part of the processes in the above method embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes as described in the above method embodiments. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory (FM), hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium can also include combinations of the above types of memory.
[0058] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0059] Obviously, those skilled in the art should understand that the various units or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device, or fabricating them separately as individual integrated circuit modules, or fabricating multiple modules or steps into a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0060] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for constructing a small-sample knowledge base for a vertical domain, characterized in that, include: Data from vertical fields is obtained from multiple channels, and the obtained data is cleaned, lightly labeled, and structured to obtain domain sample data; The pre-trained large model is fine-tuned based on the domain sample data. Domain knowledge, including entities, relationships, and attributes, is extracted from the fine-tuned model. The extracted domain knowledge is then verified and integrated to form a standardized knowledge base. Acquire new knowledge data, use a weighted incremental loss function to incrementally train the model, output an optimized domain model, use the optimized domain model to extract new knowledge from the new data, verify the new knowledge and integrate it into the existing knowledge base. The knowledge base quality and model performance are evaluated periodically according to the domain knowledge update cycle. Knowledge base quality score and model performance score are calculated separately to generate a comprehensive evaluation score. Based on the evaluation results, knowledge extraction rules, incremental training strategies and knowledge base schema are optimized.
2. The method for constructing a small-sample knowledge base oriented towards a vertical domain according to claim 1, characterized in that, The process of acquiring vertical domain data from multiple channels, and then cleaning, lightly labeling, and structuring the acquired data to obtain domain sample data includes: Raw data from the vertical field is obtained from multiple channels, including professional documents, industry reports, official websites and databases, vertical community Q&A and forums, and internal enterprise data. The raw data is then processed to remove garbled characters, redundancy, irrelevant information and abnormal data, and the format is standardized. Initial annotations are performed on the cleaned data based on a general domain model. The annotation elements include domain entities, relationships, and attributes. An uncertainty sampling algorithm is used to select samples with model confidence scores below a threshold for manual annotation, and the consistency of the annotations is verified. The labeled data is converted into a structured format that can be used for model training and knowledge extraction, and divided into training set, validation set and test set according to proportion. Data augmentation is performed on the training set to obtain domain sample data.
3. The method for constructing a small-sample knowledge base oriented towards a vertical domain according to claim 2, characterized in that, The process of fine-tuning the pre-trained large model based on the domain sample data, extracting domain knowledge including entities, relationships, and attributes from the fine-tuned model, and verifying and integrating the extracted domain knowledge to form a standardized knowledge base includes: A pre-trained model based on the Transformer architecture is selected based on the domain characteristics. The pre-trained model is fine-tuned based on the domain sample data. During the model training process, a multi-task joint learning framework for entity, relation, and attribute extraction is adopted. A multi-task weighted loss function is used to balance the training objectives of each task. The model parameters are adjusted according to the effect of each task. Based on the fine-tuned model, domain knowledge including entities, relationships, and attributes is extracted simultaneously, and the extracted entity, relationship, and attribute results are checked against preset rules to see if they conform to the logic and common sense of the domain and whether there are any conflicts. The entity, relation, and attribute extraction results are integrated into standardized knowledge triples, and the attribute information related to the entity is integrated into entity-attribute key-value pairs; The integrated knowledge triples and entity attribute information are categorized and stored in the knowledge base according to domain knowledge categories.
4. The method for constructing a small-sample knowledge base oriented towards a vertical domain according to claim 3, characterized in that, The step of classifying and storing the integrated knowledge triples and entity attribute information in the knowledge base according to domain knowledge categories includes: Design a knowledge base schema that conforms to the characteristics of the domain, and define entity types, relation types, and attribute specifications; Using a hybrid storage method combining graph databases, relational databases, and vector databases, the integrated knowledge triples and entity attribute information are stored according to the knowledge base schema, constructing a three-layer decoupled architecture including a knowledge storage layer, a knowledge retrieval layer, and a knowledge update layer.
5. The method for constructing a small-sample knowledge base for vertical domains according to claim 4, characterized in that, The knowledge storage layer is responsible for the persistent storage of domain knowledge, knowledge base schema version management, access control, and data backup. The knowledge retrieval layer provides retrieval interfaces for entity retrieval, relationship retrieval, path retrieval, and semantic retrieval, connects to upper-layer business systems, and shields the underlying storage details. The knowledge update layer is used to obtain new domain knowledge data from external systems in real time, and update the existing knowledge base after performing rule and model dual verification on the new knowledge data.
6. The method for constructing a small-sample knowledge base oriented towards a vertical domain according to claim 2, characterized in that, The steps of acquiring new knowledge data, incrementally training the model using a weighted incremental loss function, outputting an optimized domain model, extracting new knowledge from the new data using the optimized domain model, verifying the new knowledge, and integrating it into the existing knowledge base include: Continuously collect newly added knowledge data in vertical domains, and complete data cleaning, standardization, and structuring preprocessing. Merge the newly added knowledge data with representative data from the existing knowledge base to form a training set. Use a weighted incremental loss function to incrementally train the model. The weighted incremental loss function is: in, For the cross-entropy loss of newly added knowledge data, This refers to the knowledge distillation loss of the original knowledge base data. is the weight coefficient, with a value range of (0,1), used to balance the weights of training with new data and retaining existing knowledge; The existing validation set is used to evaluate the retention of basic knowledge, and the validation set constructed with the newly added data is used to evaluate the learning effect of new knowledge. If the model performance index does not reach the expected threshold, the hyperparameters are adjusted or training data is added, and the model is retrained to obtain an optimized domain model. Using the optimized domain model, the latest knowledge is extracted from the new knowledge data, and the new knowledge is output. The new knowledge is then double-validated based on rules and models and integrated into the existing knowledge base. Each time the knowledge base is updated, a knowledge base version number is generated, and the added, deleted, and modified knowledge entries and timestamps are recorded.
7. The method for constructing a small-sample knowledge base oriented towards a vertical domain according to claim 1, characterized in that, The quality of a knowledge base can be evaluated using the following formula: in, For the accuracy of knowledge in the knowledge base, For the completeness of knowledge in the knowledge base, To ensure the timeliness of knowledge in the knowledge base, Let be the weighting coefficient, satisfying ; The model performance is evaluated using the following formula: in, To improve the accuracy of knowledge extraction from the model, To improve the recall rate of knowledge extraction for the model. Extract F1 scores for model knowledge. These are the weighting coefficients, and ; The overall evaluation score is: in, The score is used to assess the quality of the knowledge base. The score is used to evaluate the model's performance.
8. A device for constructing a small-sample knowledge base for a vertical domain, characterized in that, include: The data acquisition and processing module is used to acquire data from multiple channels in the vertical field, and to clean, lightly label and structure the acquired data to obtain field sample data. The knowledge base construction module is used to fine-tune the pre-trained large model based on the domain sample data, extract domain knowledge including entities, relations and attributes based on the fine-tuned model, and verify and integrate the extracted domain knowledge to form a standardized knowledge base. The optimization and update module is used to acquire new knowledge data, perform incremental training on the model using a weighted incremental loss function, output an optimized domain model, extract new knowledge from the new data using the optimized domain model, verify the new knowledge and integrate it into the existing knowledge base. The performance evaluation module is used to periodically evaluate the quality of the knowledge base and the performance of the model according to the domain knowledge update cycle, generate a comprehensive evaluation score, and optimize the knowledge extraction rules, incremental training strategies and knowledge base schema based on the evaluation results.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to execute the method for constructing a small-sample knowledge base oriented towards a vertical domain, as described in any one of claims 1 to 7.
10. An electronic device, characterized in that, The electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to cause the at least one processor to perform the method for constructing a small sample knowledge base oriented towards a vertical domain, as described in any one of claims 1 to 7.