Milk industry knowledge question-answering method and device based on large model and RAG and medium
By collecting and processing multi-source heterogeneous data in the dairy industry and generating an enhanced language model, the problems of professional terminology parsing deviation and multi-source data fusion in the dairy industry knowledge question and answer system are solved, and high-precision dairy industry knowledge question and answer and dynamic decision support are achieved.
Patent Information
- Application Number
- CN202510608246.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-13
- Publication Date
- 2025-09-05
AI Technical Summary
Existing dairy knowledge question-and-answer systems lack understanding of professional terminology in dairy processing and microbial testing, resulting in semantic bias and factual errors. Traditional retrieval strategies cannot effectively integrate multi-source heterogeneous data, making it difficult to support decision-making needs in dynamic production environments.
By collecting multi-source heterogeneous data from the dairy industry and performing term protection segmentation processing, a domain corpus is generated, and an enhanced language model is generated using a pre-trained language model and adversarial learning mechanism. Combined with semantic vector retrieval and dynamic ranking algorithms, multimodal retrieval results are screened, the final answer is generated, and the knowledge sources are associated.
It significantly improves the model's semantic understanding accuracy of complex technical parameters, reduces the risk of factual errors, ensures the breadth and accuracy of retrieval coverage, supports decision-making needs in production scenarios, and achieves transparency and traceability of the answer generation process.
Smart Images

Figure CN120596601A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of knowledge question answering technology, and in particular to a dairy knowledge question answering method, device and medium based on a large model and RAG. Background Art
[0002] As the dairy industry's digital transformation deepens, dairy knowledge question-and-answer systems are becoming core tools for pasture management, quality monitoring, and process optimization. However, existing general-purpose models lack a deep understanding of specialized terminology such as dairy processing and microbial testing, making it difficult to accurately parse complex concepts within the dairy sector. This can lead to semantic biases and even factual errors in responses. Furthermore, traditional knowledge base systems rely on keyword matching and rule engines, making them ineffective in integrating heterogeneous data from multiple sources. Search results are incomplete and lack timeliness, making them difficult to support decision-making in dynamic production environments.
[0003] While current technical solutions based on Retrieval-augmented Generation (RAG) can alleviate some of these issues, they still suffer from key flaws in the dairy industry. For one thing, static knowledge bases are often lagging behind in updates, unable to promptly respond to changes in industry standards or unexpected production anomalies, resulting in model outputs being out of sync with the latest specifications. Furthermore, traditional retrieval strategies overly rely on semantic similarity and ignore the need for precise matching of numerical parameters, which can lead to the risk of technical parameter misuse. Summary of the Invention
[0004] The embodiments of the present application provide a dairy industry knowledge question-answering method, device and medium based on a large model and RAG to solve the above-mentioned technical problems.
[0005] On the one hand, the present application embodiment provides a dairy knowledge question-answering method based on a large model and RAG, including: Collecting multi-source heterogeneous data from the dairy industry, performing term protection segmentation processing on the multi-source heterogeneous data, and generating an annotated domain corpus; Based on the pre-trained language model base, and through the injection of domain corpus from the domain corpus and the adversarial learning mechanism, an enhanced language model adapted to dairy industry professional terminology is generated; Receive users' dairy questions, perform semantic vector search and term expansion search in parallel, and filter multimodal search results through dynamic sorting algorithms; The multimodal retrieval results and the dairy industry question are spliced into an enhanced prompt to be input into the enhanced language model to generate a final answer corresponding to the dairy industry question, and the final answer is associated with a knowledge source.
[0006] In one implementation of the present application, multi-source heterogeneous data from the dairy industry is collected, term protection segmentation is performed on the multi-source heterogeneous data, and annotated domain corpus is generated, specifically including: Automated crawler tools are used to crawl online dairy information at preset time intervals. Real-time production data from the farm's MES system and structured data from the laboratory testing system are collected through the API gateway to form multi-source heterogeneous data. Identifying compound words in the dairy field, building a term protection segmentation strategy, atomizing the compound words using the term protection segmentation strategy, and generating an annotated domain corpus; Generate high-dimensional vectors corresponding to the annotated domain corpus through a pre-trained language model, and store the high-dimensional vectors in a vector database; the high-dimensional vectors are used to support semantic similarity retrieval; Performing OCR parsing and table recognition on the unstructured test report in the multi-source heterogeneous data to generate structured fields, and storing the structured fields in a relational database; A multimodal knowledge base is constructed based on the vector database and the relational database; the knowledge base is used for mixed storage of structured data and unstructured data.
[0007] In one implementation of the present application, based on the pre-trained language model base, and through the injection of domain corpus in the domain corpus and the adversarial learning mechanism, an enhanced language model adapted to dairy industry terminology is generated, specifically including: Constructing a noise corpus containing incorrect technical parameters, and training a model through comparative learning to identify parameter anomalies and logical contradictions in the noise corpus; A dynamic weight distillation strategy is used to adjust the strength of knowledge transfer based on the difference in prediction confidence between the teacher model and the student model. Based on the improved Transformer-XL architecture, a pre-trained language model foundation is built. Through the gated fusion mechanism, the knowledge graph entity vectors and word vectors are mixed to obtain enhanced semantic representation. Through low-rank adaptation technology, dairy documents and adversarial corpus containing interference corpus are injected into the enhanced semantic representation to train and generate an enhanced language model adapted to dairy professional terminology.
[0008] In one implementation of the present application, a user's dairy industry question is received, semantic vector search and term expansion search are performed in parallel, and multimodal search results are screened through a dynamic sorting algorithm, specifically including: Receive user dairy questions, build a multimodal knowledge base, and dynamically recall relevant document fragments of the dairy questions from vector databases and relational databases based on an improved dense retrieval model to obtain candidate documents; Matching key terms in the candidate documents with preset constraints using an attention weight algorithm to filter candidate documents that do not meet the preset constraints; The remaining candidate documents are dynamically sorted based on a weight matrix to screen out multimodal retrieval results corresponding to the dairy industry question; the weight matrix includes weight coefficients corresponding to semantic similarity, numerical matching and timeliness dimensions.
[0009] In one implementation of the present application, associating the final answer with the knowledge source specifically includes: Based on the factual statements in the final answer, the corresponding knowledge source is marked in the knowledge base; the knowledge source includes the original data fragment, version identifier and retrieval path; In the case where it is detected that the final answer refers to conflicting data from multiple sources, generating a credibility score and adding the credibility score to the end of the final answer; An interactive traceability link is embedded in the final answer to respond to the user's query request for the dairy industry issue and return a complete evidence chain corresponding to the dairy industry issue; the complete evidence chain includes the semantic vector and structured fields of the associated document.
[0010] In one implementation of the present application, after associating the final answer with the knowledge source, the method further includes: Receive sensor data uploaded by ranch IoT devices in real time and perform anomaly detection and dynamic compliance verification based on the streaming computing engine; If a parameter exceeds a standard or a standard conflict is detected, a multimodal alarm is triggered to analyze the abnormality type and impact range in the sensor data and generate a structured alarm message; the alarm message includes a treatment suggestion; According to the preset push priority, the alarm information is distributed in parallel to the corresponding target terminals through multiple channels, and the alarm events are associated with the disposal records and stored in the multimodal knowledge base as negative samples for model optimization.
[0011] In one implementation of the present application, the present invention further includes: Collect production and transportation data and dairy quality information from the dairy industry chain, and build a dynamic knowledge graph based on graph neural networks; the production and transportation data includes raw material batch data, production process data, and logistics and transportation data; the dairy quality information includes quality inspection reports, user feedback, and public opinion data; Using an event-driven architecture, we analyze triples in quality inspection reports, user feedback, and public opinion data in real time and perform logical conflict detection on the triples; the triples are used to represent entity-relationship-event. Based on the triples that have passed the detection and through the knowledge graph embedding technology, the weights of the nodes and edges in the knowledge graph are updated, and the updated knowledge graph is synchronized to the vector database in an incremental form.
[0012] In one implementation of the present application, after generating the final answer corresponding to the dairy industry question, the method further includes: Based on a pre-built user feedback data collection channel, user feedback on the final answer is received, and core correction points in the user feedback are extracted; the user feedback includes satisfaction scores, supplementary explanations, and error correction information; Based on a preset multimodal feedback parser, the supplementary explanations in the user feedback are converted into structured correction corpus and marked with the corresponding correction type; the supplementary explanations include text, pictures or table data, and the correction types include terminology correction, logic correction and data update; Based on the reinforcement learning framework, the modified corpus is used as an environmental feedback signal to adjust the weight coefficient and retrieval strategy of the dynamic ranking algorithm, and a model iteration report is generated to visually display the updated heat map of the knowledge graph.
[0013] On the other hand, the present application embodiment also provides a dairy knowledge question-answering device based on a large model and RAG, the device comprising: at least one processor; and, a memory communicatively coupled to the at least one processor; Wherein, the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the dairy knowledge question-and-answer method based on the large model and RAG as described above.
[0014] On the other hand, an embodiment of the present application further provides a non-volatile computer storage medium storing computer executable instructions, which, when executed, implements the dairy industry knowledge question-and-answer method based on the large model and RAG as described above.
[0015] The present application provides a method, device, and medium for answering dairy industry knowledge questions based on a large model and RAG, which have at least the following beneficial effects: Based on term protection segmentation and domain corpus injection, the problem of parsing deviation of dairy professional terms in general large models is solved. Through atomization of compound words and adversarial learning mechanism, the semantic understanding accuracy of the model for complex technical parameters is significantly improved, reducing the risk of factual errors; by executing semantic vector retrieval and term expansion retrieval in parallel, combined with dynamic sorting algorithm to perform weighted fusion of semantic relevance, numerical matching and knowledge timeliness, it breaks through the limitations of traditional keyword matching, while ensuring the breadth of retrieval coverage, the precise matching ability of core parameters is improved, and the decision-making needs of production scenarios are effectively supported; the final answer is associated with the source of knowledge, and by marking the original data fragments, version identifiers and interactive traceability links, the transparency and traceability of the answer generation process are achieved, avoiding the reference to conflicting data or abolished standards, and greatly improving the reliability of technical guidance. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 A schematic diagram of the process of the dairy industry knowledge question-answering method based on a large model and RAG provided in an embodiment of the present application; Figure 2 Schematic diagram of the internal structure of the dairy industry knowledge question-and-answer device based on a large model and RAG provided in an embodiment of the present application. DETAILED DESCRIPTION
[0017] To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0018] The following describes in detail the technical solutions provided by various embodiments of the present application in conjunction with the accompanying drawings.
[0019] Figure 1 A schematic flow chart of the dairy industry knowledge question-answering method based on a large model and RAG provided in an embodiment of the present application.
[0020] The analysis method involved in the embodiments of the present application can be implemented by a terminal device or a server, and the present application does not impose any special restrictions on this. For ease of understanding and description, the following embodiments are described in detail using a server as an example.
[0021] It should be noted that the server can be a single device or a system composed of multiple devices, that is, a distributed server, and this application does not make any specific restrictions on this.
[0022] like Figure 1 As shown, the dairy knowledge question-answering method based on the large model and RAG provided in the embodiment of the present application includes: Step 101: Collect multi-source heterogeneous data of the dairy industry, perform term protection segmentation processing on the multi-source heterogeneous data, and generate a labeled domain corpus.
[0023] In this embodiment, the purpose is to build a multimodal knowledge base in the dairy field. Multi-source heterogeneous data are integrated through a distributed data acquisition module, and a domain corpus is constructed based on a term protection segmentation strategy. It is understandable that the integration of multi-source data in the dairy scenario is the basis of knowledge services, but the traditional method causes semantic fragmentation due to differences in data formats and term parsing deviations. Specifically, the system uses automated crawler tools and regularly captures public dairy information on the Internet platform at preset time intervals, such as industry research reports and policy and regulations web pages. At the same time, it uses the API gateway to connect to the real-time operating parameters of the pasture production system and the structured test reports of the laboratory testing system. The pasture production system is such as the MES system, the real-time operating parameters are such as milking equipment sensor data, milk storage tank temperature and humidity monitoring values, and the laboratory testing system is such as the LIMS system.
[0024] For unstructured text, such as PDF test reports, we use OCR parsing technology to identify text regions and combine it with table detection algorithms to extract structured fields. For example, we can parse "protein content 3.25±0.15g / 100g" into numerical data and associate it with the test timestamp.
[0025] Specifically, there are a large number of compound professional terms in the dairy field, such as "thermophilic colony count detection method" and "UHT sterilization parameters". General word segmentation tools are prone to incorrect decomposition, such as splitting "pasteurization" into "pasteurization" and "sterilization", resulting in semantic distortion. In order to solve the problem of ambiguous word segmentation of compound terms in the dairy industry, a term protection word segmentation strategy is constructed to atomize the terms. For example, the term "abnormal fluctuation of somatic cell count" is split into "somatic cell / count / abnormal / fluctuation" while retaining the integrity of the term to avoid semantic loss. Based on dairy industry standard documents and historical corpora, high-frequency compound words are extracted and a term dictionary is established. The integrity of compound words is forced to be retained during the word segmentation process. For example, "somatic cell count" is treated as a single word, and the cleaned text is input into the pre-trained language model. A high-dimensional semantic vector is generated through the pre-trained language model, and the annotated corpus is stored in the vector database and the relational database to form a bimodal knowledge base that supports multimodal retrieval.
[0026] For example, a hybrid knowledge base is constructed: structured data, such as real-time pasture parameters, is stored in a relational database, while unstructured text and its vector representation are stored in a vector database. The two are linked by unique identifiers. It should be noted that this design supports efficient joint queries across cross-modal data. For example, the "protein content" field in a test report records its raw value in the relational database and its associated term description vector in the vector database.
[0027] Step 102: Based on the pre-trained language model base, and through the injection of domain corpus in the domain corpus and the adversarial learning mechanism, an enhanced language model adapted to dairy industry professional terminology is generated.
[0028] In this embodiment, the core is to enhance the model's ability to understand dairy industry terminology through an adversarial training mechanism. For example, an interference corpus containing incorrect technical parameters is constructed. For example, incorrect parameters of "pasteurization temperature" are inserted into the original corpus, such as reversing the temperature value, and the model is trained through comparative learning to identify logical contradictions. Specifically, a dynamic weight distillation strategy is adopted to carry out two-way knowledge transfer between the teacher model and the student model. The teacher model focuses on parsing the test report and dynamically adjusts the loss function weight according to the difference in prediction confidence to avoid overfitting interference samples.
[0029] It should be noted that the improved Transformer-XL architecture is used as the pre-training foundation, with an expanded context window to support long text parsing, such as the complete semantic understanding of dairy standard documents like GB 19302-X. The domain corpus infusion process involves two mechanisms: first, a gated fusion mechanism blends knowledge graph entity vectors (such as the standardized parameter range for "pasteurization temperature") with word vectors in a preset ratio to strengthen the model's semantic representation of professional concepts. Second, a dynamic weight distillation strategy is constructed to adjust the strength of knowledge transfer based on the difference in prediction confidence between the teacher and student models. For example, when the model's inference confidence for "lactose intolerance mechanism" falls below a threshold, the knowledge transfer weight of the domain corpus is automatically increased.
[0030] Furthermore, the adversarial learning mechanism generates interference data containing incorrect technical parameters, such as tampering with the "UHT sterilization temperature" to a non-standard value, forcing the model to learn parameter logic verification capabilities. Specifically, the system constructs an adversarial sample library containing logically contradictory parameters and numerically out-of-limit values, such as "protein content is positively correlated with acidity" and numerically out-of-limit values such as "fat content > 10%." Through comparative learning, the system optimizes the model's sensitivity to standard parameters. It should be noted that the adversarial corpus is dynamically updated through domain adaptation technology, for example, generating adaptive interference samples based on new test indicators emerging in actual ranch production data, such as lactoferrin content.
[0031] Step 103: Receive the user's dairy question, perform semantic vector search and term expansion search in parallel, and filter the multimodal search results through a dynamic sorting algorithm.
[0032] In this embodiment, a dual-channel retrieval mechanism is used to improve the comprehensiveness and accuracy of knowledge recall, and to achieve efficient screening of multimodal data. In specific implementation, the system first performs intent analysis on the user's question, for example, breaking down "reasons for excessive total colony counts in raw milk in recent times" into key semantic units such as "total colony count", "reasons for excessive counts", and "recently". Semantic vector retrieval and term extension retrieval are performed in parallel. The semantic vector retrieval adopts an improved DPR model to recall the top 50 related documents from the vector database through cosine similarity, such as cases of excessive total colony counts in test reports. Term extension retrieval extracts core terms of the problem such as "total colony count" based on the BERT model, and matches synonyms, superordinate concepts, and extended documents of related standards in the knowledge base, such as synonyms such as "colony count", superordinate concepts such as "microbial indicators", and related standards such as GB 4789.2-X.
[0033] The dynamic sorting algorithm uses a weight matrix to comprehensively sort based on three dimensions: semantic relevance, numerical confidence, and timeliness. Semantic relevance includes the parameter matching degree between the test report and the question, numerical confidence includes the deviation range between the test value and the standard value, and timeliness includes the data update time. For example, when a user asks "What are the updated contents of the 2023 raw milk veterinary drug residue standards", the system gives priority to recalling the 2023 revised standard document rather than the historical version. It should be noted that the conflict detection module is used to identify contradictions in multi-source data, such as the difference between the company's self-inspection data and the third-party spot check results. For example, if the key terms in the candidate document conflict with the problem constraints, such as "the total colony count exceeds the standard", they are directly eliminated through the attention weight algorithm. In addition, the dynamic sorting algorithm supports real-time feedback optimization, such as dynamically adjusting the weight coefficient based on the user's click behavior on the search results.
[0034] Step 104: Combine the multimodal search results and the dairy question into an enhanced prompt, input it into the enhanced language model, generate a final answer corresponding to the dairy question, and associate the final answer with the knowledge source.
[0035] In this embodiment, the accuracy and verifiability of the answers are ensured through knowledge enhancement and trusted traceability mechanisms, realizing a closed loop of answer generation and knowledge traceability. In specific implementation, the system splices retrieval result fragments, user questions, and related standard clauses into a structured prompt template. Retrieval result fragments are such as "somatic cell count 500,000 CFU / mL" in the test report, user questions are such as "Does this value exceed the standard?", and related standard clauses are such as the somatic cell count limit in GB 19302-X. The enhanced language model is based on contextual understanding and calls the logical link of "somatic cell count → diagnosis result → treatment plan" in the knowledge graph to generate an answer containing diagnostic basis, standard references, and treatment suggestions.
[0036] When associating knowledge sources, the system uses metadata annotation technology to record the basis for answers, citing the inspection report number and inspection timestamp for structured data, and annotating text snippets with the knowledge base chapter and version number. When conflicting search results occur, such as when the differences in parameters between different sources exceed a threshold, the system triggers a credibility assessment mechanism, calculates the statistical significance of the conflicting parameters, such as a p-value, and appends a credibility score to the end of the answer, such as "85% credibility, data source: Enterprise Self-Inspection Report [No. A-2023]." It should be noted that the knowledge base is updated synchronously after the answer is generated. User feedback, such as correction suggestions, is converted into model iteration signals through a reinforcement learning framework, such as adjusting the weight coefficients of the dynamic ranking algorithm or expanding the term protection segmentation dictionary. For example, when users make correction suggestions to answers (such as adding missing terms), the system converts them into structured corpus, adjusts the search weights through reinforcement learning, and adds new nodes to the knowledge graph, establishing continuous optimization capabilities.
[0037] In one embodiment of this application, the final answer is associated with the knowledge source, aiming to achieve real-time monitoring and closed-loop optimization in the production environment. It is understandable that the dynamic changes in equipment parameters and standard compliance in dairy production scenarios directly affect product quality. Traditional manual inspections and offline analysis methods are subject to response delays and the risk of missed detections.
[0038] For example, IoT devices such as pH sensors and temperature probes collect real-time farm production data and transmit it to the Flink streaming computing engine. Sensor data, such as raw milk pH, is compared in real time against national standards (e.g., 6.6-6.8). If continuous violations are detected, such as a pH value below 6.5, an abnormal event is flagged. If sensor data conflicts with the latest industry standards, such as if the sterilization temperature falls below the updated threshold, a logical inconsistency alert is triggered.
[0039] Specifically, when an abnormal event is triggered, the system identifies the abnormality type (e.g., "Total bacterial count exceeds standard" or "Abnormal equipment temperature") and its potential impact (e.g., "Batch numbers A001-A005 affected") based on predefined rules and the historical event database within the knowledge base. A disposition suggestion template is automatically populated, such as "Total bacterial count exceeds standard. Recommendation: Immediately suspend filling of the current batch, initiate CIP cleaning procedures, and resample for inspection." Alarm information is distributed to target terminals, such as ranch managers and quality inspectors, based on preset push priorities (e.g., "Emergency Alert → SMS + App Pop-up" and "General Alert → Email Notification").
[0040] It should be noted that alarm events and subsequent handling records are associated and stored in a multimodal knowledge base, forming a negative sample dataset, such as "cleaning completion time" and "re-inspection results." For example, abnormal parameters in alarm events are used as adversarial corpus input into the model to enhance its ability to identify erroneous data. In the dynamic ranking algorithm, the weight of documents associated with historical alarm events is reduced to avoid repeated recommendations of invalid solutions. If multiple alarms point to the same abnormal device parameter, a revision of the knowledge base entry is automatically triggered, such as updating the equipment maintenance cycle recommendation.
[0041] In this example, the goal is to build a dynamic knowledge graph for the entire dairy industry chain, enabling data integration and intelligent reasoning from production to consumption. Understandably, the dairy industry chain involves multiple links, including raw material procurement, production and processing, logistics and transportation, and market feedback. Traditional knowledge systems, due to data silos and static modeling, struggle to support decision-making across the entire chain.
[0042] Exemplarily, production and transportation data include raw material batch data, production process data, and logistics and transportation data. Raw material batch data include milk source pasture number and raw milk testing indicators. Production process data include sterilization temperature curve and filling line efficiency. Logistics and transportation data include cold chain temperature records and transportation time. Dairy quality information covers quality inspection reports, user feedback, and public opinion data. Quality inspection reports include microbial test results, user feedback includes product reviews and complaint records, and public opinion data includes quality discussions on social media. It should be noted that the above data is collected in real time through API interfaces and log crawling tools, and converted into a unified entity-relationship-event triple format.
[0043] A dynamic knowledge graph is constructed based on graph neural networks (GNNs), with "ranch", "equipment", "product batch" and other entities defined as entities, and relationships including "belong to", "produced in", "transported to", etc. Entities and relationships are mapped into low-dimensional vectors through knowledge graph embedding technology, and an initial graph is constructed based on historical data. Based on the timeliness and confidence of the data, initial weights are assigned to nodes and edges, such as the weight of quality inspection reports is higher than that of public opinion data.
[0044] It should be noted that the event-driven architecture monitors the data source in real time. When new data is received, such as user feedback that "a batch of products has a clumping phenomenon", triples are extracted from the text, such as "batch A203-entity", "quality problems exist-relationship", and "caking phenomenon-event", and the new triples are compared with the existing data in the knowledge graph. If a logical contradiction is detected, such as the quality inspection report of the batch shows that "microbial indicators are qualified", it is marked as data to be verified, and the conflicting data is pushed to the expert review interface for correction or rejection after confirmation.
[0045] For example, for triples that pass the test, the node embedding vector is dynamically updated based on the GraphSAGE algorithm, taking into account the timeliness and relevance of new data, such as recent user feedback being weighted higher than historical data. Embeddings are recalculated only for modified portions, such as the newly added "Batch A203 - Chunk" relationship. Updates are synchronized to the vector database via a message queue, creating a snapshot for each update. This supports historical state tracing and impact analysis, such as tracing batch quality issues caused by a device failure.
[0046] In this embodiment, the goal is to drive continuous optimization of the system through user feedback, forming a self-evolutionary capability. It is understandable that user feedback is a key driving force for the iteration of knowledge service systems, but traditional methods have difficulty achieving closed-loop optimization due to low feedback processing efficiency and insufficient multimodal analysis capabilities.
[0047] Exemplary user feedback data collection channels include API interfaces, interactive interface feedback buttons, and voice input modules. It should be noted that user feedback types include satisfaction ratings, supplementary explanations, and error correction information. Satisfaction ratings include a five-star rating, supplementary explanations include a text description such as "The answer does not mention the pasteurization temperature standard," and error correction information such as noting that the total colony count threshold is incorrect in the answer.
[0048] An NLP model is used to identify key correction requests, such as "missing term" and "parameter error," and link them to the corresponding paragraphs in the original answer. For supplementary explanations using images or tables, such as screenshots of test reports uploaded by users, OCR and table recognition algorithms are used to extract structured fields, such as "Protein content 3.2g / 100g," and compare them with existing data in the knowledge base to identify discrepancies.
[0049] Specifically, if a user points out an error in the terminology in the answer, such as mistakenly writing "thermophiles" as "heat-resistant bacteria," the parser matches standard terms from the knowledge base and generates correction corpus, such as "replace 'heat-resistant bacteria' with 'thermophiles'." When feedback reveals logical contradictions, such as "the cleaning cycle suggested in the answer conflicts with the national standard," the parser associates relevant nodes in the knowledge graph, such as "cleaning process" and "national standard clauses," and generates logical verification rules. If the user provides new standard documents or test data, such as PDF attachments, the parser extracts key parameters, such as "update the pasteurization temperature to 75°C," and marks them as entries to be updated in the knowledge base.
[0050] It should be noted that the reinforcement learning framework uses the revised corpus as an environmental feedback signal. If users frequently revise a certain type of term, such as "somatic cell count," the system automatically increases the weight coefficient of the term in the dynamic sorting algorithm and prioritizes recalling highly authoritative documents. When logic revision feedback is detected, the reinforcement learning policy adds a knowledge graph relationship verification step to the answer generation stage, such as forcing the reference to the latest standard version. Based on high-frequency update areas in the revised corpus, such as "sterilization parameters" and "microbial indicators," a visual heat map is generated to mark the changing trends of node weights in the knowledge graph, assisting operation and maintenance personnel in locating knowledge weaknesses.
[0051] The above is an embodiment of the method proposed in this application. Based on the same inventive concept, the embodiment of this application also provides a dairy knowledge question-answering device based on a large model and RAG, the structure of which is as follows: Figure 2 shown.
[0052] Figure 2 This is a schematic diagram of the internal structure of the dairy knowledge question-answering device based on the large model and RAG provided in the embodiment of this application. Figure 2 As shown, the equipment includes: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to: Collect multi-source heterogeneous data from the dairy industry, perform term protection segmentation on the multi-source heterogeneous data, and generate annotated domain corpus; Based on the pre-trained language model base, and through the injection of domain data from the domain corpus and the adversarial learning mechanism, an enhanced language model adapted to dairy industry terminology is generated; Receive users' dairy questions, perform semantic vector search and term expansion search in parallel, and filter multimodal search results through dynamic sorting algorithms; The multimodal retrieval results and dairy questions are spliced into enhanced prompts and input into the enhanced language model to generate the final answer corresponding to the dairy question, and the final answer is associated with the knowledge source.
[0053] The present application also provides a non-volatile computer storage medium storing computer-executable instructions. When the computer-executable instructions are executed, they can: Collect multi-source heterogeneous data from the dairy industry, perform term protection segmentation on the multi-source heterogeneous data, and generate annotated domain corpus; Based on the pre-trained language model base, and through the injection of domain data from the domain corpus and the adversarial learning mechanism, an enhanced language model adapted to dairy industry terminology is generated; Receive users' dairy questions, perform semantic vector search and term expansion search in parallel, and filter multimodal search results through dynamic sorting algorithms; The multimodal retrieval results and dairy questions are spliced into enhanced prompts and input into the enhanced language model to generate the final answer corresponding to the dairy question, and the final answer is associated with the knowledge source.
[0054] The various embodiments in this application are described in a progressive manner. Similar portions between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the device and medium embodiments are generally similar to the method embodiments, so their descriptions are relatively simple. For relevant portions, refer to the descriptions of the method embodiments.
[0055] The devices and media provided in the embodiments of the present application correspond one-to-one to the methods. Therefore, the devices and media also have similar beneficial technical effects to their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.
[0056] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0057] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0058] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0059] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.
[0060] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0061] Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0062] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can be implemented using any method or technology for information storage. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change RAM (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves.
[0063] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0064] The above are merely embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.
Claims
1. A dairy industry knowledge question-answering method based on a large model and RAG, characterized in that: The method comprises: Collecting multi-source heterogeneous data from the dairy industry, performing term protection segmentation processing on the multi-source heterogeneous data, and generating an annotated domain corpus; Based on the pre-trained language model base, and through the injection of domain corpus from the domain corpus and the adversarial learning mechanism, an enhanced language model adapted to dairy industry professional terminology is generated; Receive users' dairy questions, perform semantic vector search and term expansion search in parallel, and filter multimodal search results through dynamic sorting algorithms; The multimodal retrieval results and the dairy industry question are spliced into an enhanced prompt to be input into the enhanced language model to generate a final answer corresponding to the dairy industry question, and the final answer is associated with a knowledge source.
2. The dairy industry knowledge question-answering method based on a large model and RAG according to claim 1, characterized in that: Collect multi-source heterogeneous data from the dairy industry, perform term protection segmentation on the multi-source heterogeneous data, and generate annotated domain corpus, specifically including: Automated crawler tools are used to crawl online dairy information at preset time intervals. Real-time production data from the farm's MES system and structured data from the laboratory testing system are collected through the API gateway to form multi-source heterogeneous data. Identifying compound words in the dairy field, building a term protection segmentation strategy, atomizing the compound words using the term protection segmentation strategy, and generating an annotated domain corpus; Generate high-dimensional vectors corresponding to the annotated domain corpus through a pre-trained language model, and store the high-dimensional vectors in a vector database; the high-dimensional vectors are used to support semantic similarity retrieval; Performing OCR parsing and table recognition on the unstructured test report in the multi-source heterogeneous data to generate structured fields, and storing the structured fields in a relational database; A multimodal knowledge base is constructed based on the vector database and the relational database; the knowledge base is used for mixed storage of structured data and unstructured data.
3. The dairy industry knowledge question-answering method based on a large model and RAG according to claim 1, characterized in that: Based on the pre-trained language model base, and through the injection of domain data from the domain corpus and the adversarial learning mechanism, an enhanced language model adapted to dairy industry terminology is generated, specifically including: Constructing a noise corpus containing incorrect technical parameters, and training a model through comparative learning to identify parameter anomalies and logical contradictions in the noise corpus; A dynamic weight distillation strategy is used to adjust the strength of knowledge transfer based on the difference in prediction confidence between the teacher model and the student model. Based on the improved Transformer-XL architecture, a pre-trained language model foundation is built. Through the gated fusion mechanism, the knowledge graph entity vectors and word vectors are mixed to obtain enhanced semantic representation. Through low-rank adaptation technology, dairy documents and adversarial corpus containing interference corpus are injected into the enhanced semantic representation to train and generate an enhanced language model adapted to dairy professional terminology.
4. The dairy industry knowledge question-answering method based on a large model and RAG according to claim 1, characterized in that: Receive user dairy questions, perform semantic vector search and term expansion search in parallel, and filter multimodal search results through dynamic sorting algorithms, including: Receive user dairy questions, build a multimodal knowledge base, and dynamically recall relevant document fragments of the dairy questions from vector databases and relational databases based on an improved dense retrieval model to obtain candidate documents; Matching key terms in the candidate documents with preset constraints using an attention weight algorithm to filter candidate documents that do not meet the preset constraints; The remaining candidate documents are dynamically sorted based on a weight matrix to screen out multimodal retrieval results corresponding to the dairy industry question; the weight matrix includes weight coefficients corresponding to semantic similarity, numerical matching and timeliness dimensions.
5. The dairy industry knowledge question-answering method based on a large model and RAG according to claim 1, characterized in that: Associating the final answer with the knowledge source, including: Based on the factual statements in the final answer, the corresponding knowledge source is marked in the knowledge base; the knowledge source includes the original data fragment, version identifier and retrieval path; In the case where it is detected that the final answer refers to conflicting data from multiple sources, generating a credibility score and adding the credibility score to the end of the final answer; An interactive traceability link is embedded in the final answer to respond to the user's query request for the dairy industry issue and return a complete evidence chain corresponding to the dairy industry issue; the complete evidence chain includes the semantic vector and structured fields of the associated document.
6. The dairy industry knowledge question-answering method based on a large model and RAG according to claim 1, characterized in that: After associating the final answer with the knowledge source, the method further includes: Receive sensor data uploaded by ranch IoT devices in real time and perform anomaly detection and dynamic compliance verification based on the streaming computing engine; If a parameter exceeds a standard or a standard conflict is detected, a multimodal alarm is triggered to analyze the abnormality type and impact range in the sensor data and generate a structured alarm message; the alarm message includes a treatment suggestion; According to the preset push priority, the alarm information is distributed in parallel to the corresponding target terminals through multiple channels, and the alarm events are associated with the disposal records and stored in the multimodal knowledge base as negative samples for model optimization.
7. The dairy industry knowledge question-answering method based on a large model and RAG according to claim 1, characterized in that: The method further comprises: Collect production and transportation data and dairy quality information from the dairy industry chain, and build a dynamic knowledge graph based on graph neural networks; the production and transportation data includes raw material batch data, production process data, and logistics and transportation data; the dairy quality information includes quality inspection reports, user feedback, and public opinion data; Using an event-driven architecture, we analyze triples in quality inspection reports, user feedback, and public opinion data in real time and perform logical conflict detection on the triples; the triples are used to represent entity-relationship-event. Based on the triples that have passed the detection and through the knowledge graph embedding technology, the weights of the nodes and edges in the knowledge graph are updated, and the updated knowledge graph is synchronized to the vector database in an incremental form.
8. The dairy industry knowledge question-answering method based on a large model and RAG according to claim 1, characterized in that: After generating the final answer corresponding to the dairy industry question, the method further includes: Based on a pre-built user feedback data collection channel, user feedback on the final answer is received, and core correction points in the user feedback are extracted; the user feedback includes satisfaction scores, supplementary explanations, and error correction information; Based on a preset multimodal feedback parser, the supplementary explanations in the user feedback are converted into structured correction corpus and marked with the corresponding correction type; the supplementary explanations include text, pictures or table data, and the correction types include terminology correction, logic correction and data update; Based on the reinforcement learning framework, the modified corpus is used as an environmental feedback signal to adjust the weight coefficient and retrieval strategy of the dynamic ranking algorithm, and a model iteration report is generated to visually display the updated heat map of the knowledge graph.
9. Dairy industry knowledge question-answering device based on large model and RAG, characterized by: The device comprises: at least one processor; and, a memory communicatively coupled to the at least one processor; Wherein, the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the dairy knowledge question and answer method based on the large model and RAG as described in any one of claims 1-8.
10. A non-volatile computer storage medium storing computer executable instructions, characterized in that: When the computer-executable instructions are executed, the dairy industry knowledge question-answering method based on the large model and RAG as described in any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Voice interaction method and device based on multi-model dynamic mutual verification, and electronic equipment
CN120954406A
Scheduling method and device in model reasoning process, medium, program and electronic equipment
CN121050863A
Answer output method and device based on semiconductor knowledge base and medium
CN121051218A
Industrial chain knowledge question and answer interaction method and system based on large model
CN121118918A
Method, device and equipment for retrieving and enhancing enterprise multi-source knowledge traceability and storage medium
CN121256067A