Mulching film agriculture intelligent question and answer method and system based on knowledge graph and enhanced generation

By constructing a knowledge graph for plastic film mulching agriculture and using enhanced generation technology, the problems of incomplete knowledge coverage, insufficient retrieval accuracy, and difficulty in integrating multi-source data have been solved, achieving professional and reliable intelligent question answering and improving the professionalism and interpretability of agricultural information systems.

CN121614587APending Publication Date: 2026-03-06JIANGSU ACAD OF AGRI SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511801909.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-02
Publication Date
2026-03-06

AI Technical Summary

Technical Problem

Existing technologies lack a large-scale, structured, and semantically complete professional knowledge graph in the field of plastic film mulching agriculture, resulting in incomplete knowledge coverage, insufficient retrieval accuracy, lack of professionalism in generated content, difficulty in updating knowledge, and difficulty in integrating multi-source data, making it difficult to meet the professional question-and-answer needs of vertical fields.

Method used

By performing multimodal analysis on agricultural literature, knowledge graph data is generated. A vectorized knowledge base is constructed by combining the content of agricultural literature, and the pre-trained language model is fine-tuned in a domain-specific manner. Reasoning and standardization are performed using a question-answering model specifically for mulch film agriculture to achieve intelligent question answering.

Benefits of technology

It enables the structured expression, precise retrieval, and controlled generation of knowledge in the field of plastic film mulching agriculture, outputting professional, reliable, and interpretable intelligent question-and-answer results. This improves the professionalism, consistency, and controllability of agricultural question-and-answer, and lowers the threshold for farmers and grassroots technicians to access agricultural technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121614587A_ABST
    Figure CN121614587A_ABST
Patent Text Reader

Abstract

The invention discloses a mulching film agriculture intelligent question and answer method and system based on a knowledge graph and enhanced generation, and relates to the technical field of agricultural informationization, the method comprises the following steps: carrying out multi-modal analysis on agricultural literatures, extracting entities and relationships, and generating knowledge graph data for knowledge modeling; based on the generated knowledge graph data, constructing a vectorization knowledge base oriented to the field of mulching film agriculture in combination with agricultural literature content; performing domain fine tuning on the pre-trained language model to obtain a question and answer model special for mulching film agriculture; based on the constructed vectorization knowledge base, forming a document set related to query; generating a context based on the obtained document set, and reasoning by using a special question and answer model for mulching film agriculture to obtain a final answer; and returning the final answer and the related document information to the user. According to the method, the mulching film agricultural knowledge graph and the enhanced generation technology are deeply fused, so that a professional, reliable and explainable intelligent question and answer result is output in a multi-factor complex scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of agricultural information technology, and in particular to an intelligent question-and-answer method and system for agricultural mulching based on knowledge graphs and enhanced generation. Background Technology

[0002] With the advancement of agricultural digitalization and intelligentization, the demand for knowledge services related to mulch film cultivation is rapidly increasing. Existing agricultural information systems, mostly based on traditional databases and keyword retrieval, struggle to meet the specialized question-and-answer needs of this vertical field. While knowledge graph technology has been applied in some vertical sectors, no publicly available solution exists for constructing a large-scale, structured, and semantically complete professional knowledge graph in the specific field of mulch film agriculture. Furthermore, while large language models perform well in general natural language processing tasks, their application in specialized fields suffers from inherent flaws such as severe "illusion" phenomena, untraceable generated content, and difficulty in guaranteeing the accuracy of professional knowledge. Existing agricultural information systems largely rely on traditional database keyword matching or directly call general large language models, making it difficult to balance the accuracy, professionalism, and interpretability of answers when dealing with specialized questions in mulch film agriculture.

[0003] The shortcomings and deficiencies of existing technologies are as follows: 1. Difficulty in constructing knowledge graphs: Automatically constructing knowledge graphs from unstructured PDF documents requires processing multimodal content (text, tables, scanned documents), and existing methods struggle to simultaneously guarantee accuracy and efficiency. 2. Incomplete knowledge coverage: A single knowledge source cannot cover the complete knowledge system of plastic film mulching agriculture, including structured knowledge graphs, unstructured literature, technical parameters, and other multi-dimensional information. 3. Insufficient retrieval accuracy: Traditional keyword retrieval methods cannot understand semantics, resulting in poor relevance of search results and affecting the quality of question answering. 4. Lack of professionalism in generated content: General-purpose large language models lack domain-specific knowledge, and the generated answers are often inaccurate and unprofessional. 5. Difficulty in knowledge updating: Static knowledge bases struggle to quickly integrate new research findings and technical data. 6. Difficulty in multi-source data fusion: Heterogeneous data sources such as knowledge graphs, literature data, and PDF documents are difficult to manage and retrieve in a unified manner.

[0004] While existing technologies like Retrieval Enhancement Generation (RAG) can improve the answer quality of large language models by combining with external knowledge bases, they still have shortcomings in areas such as automatic knowledge graph construction, multi-source knowledge fusion, domain-specific optimization, and improved retrieval accuracy. In particular, in the specialized field of plastic film mulching agriculture, there is a lack of a complete technical solution from literature to knowledge graph to intelligent question answering. Summary of the Invention

[0005] In view of the above-mentioned problems, the present invention is proposed.

[0006] Therefore, the problem to be solved by this invention is how to address the technical problems in the prior art, such as difficulty in constructing knowledge graphs, incomplete knowledge coverage, insufficient retrieval accuracy, lack of professionalism in generated content, difficulty in updating knowledge, and difficulty in integrating multi-source data.

[0007] To solve the above-mentioned technical problems, the present invention provides the following technical solution: In a first aspect, embodiments of the present invention provide a smart question-answering method for agricultural mulch film based on knowledge graphs and enhanced generation, including multimodal parsing of agricultural literature and extraction of entities and relationships, and generating knowledge graph data that can be used for knowledge modeling after standardization, semantic alignment and structuring processing; Based on the generated knowledge graph data, and combined with agricultural literature content, document parsing, vectorization processing and multi-source fusion are performed to construct a vectorized knowledge base for the field of plastic film mulching agriculture. Domain-specific fine-tuning of the pre-trained language model yields a question-and-answer model specifically for plastic film mulching agriculture. Based on the constructed vectorized knowledge base, vector retrieval, semantic filtering, and result reordering are performed on user queries to form a collection of documents related to the query. Context is generated based on the obtained document set, and reasoning is performed using a question-answering model specifically for plastic film mulching agriculture. The generated results are then standardized to obtain the final answer. The final answer and related documentation will be returned to the user.

[0008] As a preferred embodiment of the intelligent question-answering method for mulch film agriculture based on knowledge graphs and enhanced generation described in this invention, the method involves: performing multimodal parsing on agricultural literature and extracting entities and relationships; and generating knowledge graph data suitable for knowledge modeling after standardization, semantic alignment, and structuring. This includes: Multimodal parsing of PDF agricultural documents includes extracting the main text using pdfplumber; extracting bordered and borderless tables using Camelot; performing OCR recognition on scanned documents using PaddleOCR PP-Structure; and structuring the extracted text, tables, and OCR results to generate JSON format parsed data. Based on parsed data, entities and relationships are extracted from text and tables, including rapid identification of basic entities and relationships based on keyword matching. The basic entities include, but are not limited to, mulch film type, crop type, location and indicators. A large language model is used to process complex paragraphs and table rows to extract deep semantic relationships, comparative relationships and technical parameters. Rule-based methods are used for pre-screening and LLM methods are used for deep extraction to generate JSON format extracted data containing entities, relationships and evidence. The extracted knowledge is standardized and validated, including unit standardization, numerical validation, semantic alignment, and embedding-based deduplication. The integrated knowledge is converted into a knowledge graph format, including node generation, relation generation, export as Neo4j compatible node CSV and relation CSV, and JSON format knowledge graph data, and statistics on the number of nodes, the number of relations, and the distribution information of entity types are calculated.

[0009] As a preferred embodiment of the intelligent question-answering method for mulch film agriculture based on knowledge graphs and enhanced generation described in this invention, the method involves: constructing a vectorized knowledge base for the field of mulch film agriculture based on generated knowledge graph data and combined with agricultural literature content through document parsing, vectorization processing, and multi-source fusion, including: Load node and relationship data from a knowledge graph file in CSV format. The node data includes at least node ID, name, type and description. The relationship data includes at least relationship ID, start node, end node, relationship type and description. The data is compatible with multiple encoding formats and performs error handling for missing fields. Structured information is extracted from agricultural PDF documents to generate extracted data in JSON format. The structured information includes at least the type of mulch film, crop type, application indicators, and technical parameters. The extracted text is fully parsed and divided into blocks using RecursiveCharacterTextSplitter, with each block being 800 characters in size and overlapping by 150 characters. The original PDF document is divided into blocks and metadata is attached to each document block to form document blocks suitable for vector retrieval; Supplementary knowledge documents are generated based on domain requirements, including answers to questions about crop adaptability, application effect data, technical parameters, and biodegradability characteristics of plastic film. Data from multiple sources is deduplicated, a unique document identifier is generated using UUID, and the data from multiple sources is uniformly converted into a document format that includes text, metadata, and id fields; Documents are vectorized using a multilingual optimized embedding model and stored in a vector database to form a multi-source vector knowledge base.

[0010] As a preferred embodiment of the intelligent question-answering method for mulch film agriculture based on knowledge graphs and augmented generation described in this invention, the method includes: performing domain-specific fine-tuning on a pre-trained language model to obtain a question-answering model specifically for mulch film agriculture, including: High-quality question-answer pairs are generated based on nodes and relationships in a knowledge graph; the training data undergoes multiple rounds of quality optimization, including removing citation formats, ensuring sentence integrity, improving the naturalness of answers, and removing duplicates. The basic large model is efficiently fine-tuned using 4-bit quantization and LoRA technology. Training data was input in ChatML format and trained using gradient checkpoints to obtain a domain-specific question-and-answer model for plastic film mulching agriculture.

[0011] As a preferred embodiment of the intelligent question-answering method for mulch film agriculture based on knowledge graph and augmented generation described in this invention, the LoRA configuration includes r=16, alpha=32, dropout=0.05, and the target module includes at least q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, and down_proj.

[0012] As a preferred embodiment of the intelligent question-answering method for mulch film agriculture based on knowledge graphs and enhanced generation described in this invention, the method involves: based on a constructed vectorized knowledge base, performing vector retrieval, semantic filtering, and result reordering on user queries to form a set of documents related to the query, including: Expand user queries with synonyms based on a thesaurus for the field of agricultural film; The expanded user query is converted into a vector and retrieved from the vector database, returning TOP-K related documents. The search results are semantically filtered based on agricultural keywords and content quality indicators to remove irrelevant documents. The filtered documents are calculated and re-ranked according to multiple dimensions. The comprehensive score is composed of weighted factors such as original similarity, keyword matching, content quality and source credibility, and query intent matching. Perform diversity processing on the reordering results.

[0013] As a preferred embodiment of the intelligent question-answering method for mulch film agriculture based on knowledge graphs and enhanced generation described in this invention, the method includes: generating a context based on the obtained document set, performing reasoning using a question-answering model specifically for mulch film agriculture, standardizing the generated results, and obtaining the final answer, including: The system classifies user queries by type, including definition, comparison, application, technology, method, effect, and general categories. Suggestion words are dynamically constructed based on query type. The suggestion words include system role definitions, retrieved context documents, answer requirements, and Few-Shot examples. The constructed prompts are input into the fine-tuned domain model and inference is performed with specified generation parameters, including max_new_tokens, temperature, top_p, top_k, repetition_penalty, length_penalty, and no_repeat_ngram_size. Post-processing is performed on the answers generated by the model, including removing thought tags and special marks, formatting cleanup, removing redundant sentences, sentence normalization, accuracy verification and completeness checks, and extracting supplementary information from the retrieval context when necessary; The generated results are cached using the hash value of the query content and parameters as the cache key. The cache has a preset validity period and a maximum number of entries.

[0014] Secondly, embodiments of the present invention provide an intelligent question-and-answer system for mulch film agriculture based on knowledge graphs and enhanced generation, characterized in that it includes: The knowledge graph construction module is used to perform multimodal parsing of agricultural literature and extract entities and relationships. After standardization, semantic alignment and structuring, it generates knowledge graph data that can be used for knowledge modeling. The multi-source knowledge base construction module is used to construct a vectorized knowledge base for the field of plastic film mulching agriculture by using generated knowledge graph data and combining it with agricultural literature content for document parsing, vectorization processing and multi-source fusion. A domain-specific model fine-tuning module is used to fine-tune the pre-trained language model to obtain a question-answering model specifically for plastic film mulching agriculture. The intelligent retrieval module is used to perform vector retrieval, semantic filtering, and result reordering on user queries based on the constructed vectorized knowledge base, forming a collection of documents related to the query. The enhanced generation module is used to generate context based on the obtained document set, and to perform reasoning using a question-answering model specifically for plastic film mulching agriculture. The generated results are then standardized to obtain the final answer. The results return module is used to return the final answer and related document information to the user.

[0015] Thirdly, embodiments of the present invention provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program instructions are executed by the processor, they implement the steps of the intelligent question-answering method for mulch film agriculture based on knowledge graph and augmented generation as described in the first aspect of the present invention.

[0016] Fourthly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program instructions are executed by a processor, they implement the steps of the intelligent question-answering method for mulch film agriculture based on knowledge graphs and augmented generation as described in the first aspect of the present invention.

[0017] The beneficial effects of this invention are as follows: By deeply integrating the knowledge graph of plastic film mulching agriculture with enhanced generation technology, this invention realizes the structured expression, accurate retrieval and controlled generation of knowledge in the field of plastic film mulching agriculture. It can output professional, reliable and interpretable intelligent question-and-answer results in complex scenarios with multiple factors, significantly improving the professionalism, consistency and controllability of agricultural question-and-answer, while reducing the threshold for farmers and grassroots technicians to obtain agricultural technology. It has good scalability, adaptability and promotion value. Attached Figure Description

[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a flowchart of a method and system for intelligent question answering in plastic film mulching agriculture based on knowledge graphs and augmented generation. Figure 2 This is a schematic diagram of the system structure of an intelligent question-answering method and system for plastic film mulching agriculture based on knowledge graphs and augmented generation. Detailed Implementation

[0020] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0021] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.

[0022] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.

[0023] Reference Figures 1-2 This is the first embodiment of the present invention, which provides a smart question-answering method for mulch film agriculture based on knowledge graphs and enhanced generation, including: S1: Perform multimodal parsing on agricultural literature and extract entities and relationships. After standardization, semantic alignment and structuring, generate knowledge graph data that can be used for knowledge modeling.

[0024] Furthermore, multimodal parsing is performed on PDF-format agricultural documents, including extracting the main text using pdfplumber; extracting bordered and borderless tables using Camelot; performing OCR recognition on scanned documents using PaddleOCR PP-Structure; and structuring the extracted text, tables, and OCR results to generate JSON-formatted parsed data. Based on parsed data, entities and relationships are extracted from text and tables, including rapid identification of basic entities and relationships based on keyword matching. The basic entities include, but are not limited to, mulch film type, crop type, location and indicators. A large language model is used to process complex paragraphs and table rows to extract deep semantic relationships, comparative relationships and technical parameters. Rule-based methods are used for pre-screening and LLM methods are used for deep extraction to generate JSON format extracted data containing entities, relationships and evidence. The extracted knowledge is standardized and validated, including unit standardization, numerical validation, semantic alignment, and embedding-based deduplication. The integrated knowledge is converted into a knowledge graph format, including node generation, relation generation, export as Neo4j compatible node CSV and relation CSV, and JSON format knowledge graph data, and statistics on the number of nodes, the number of relations, and the distribution information of entity types are calculated.

[0025] For example, step 1: Extract multimodal content from agricultural documents in PDF format: Use pdfplumber to extract the main text, which supports multiple PDF formats; use Camelot to extract table data, which supports bordered and borderless tables, with a table extraction accuracy of 90%; use PaddleOCR PP-Structure to process the scanned documents and perform OCR recognition, with a scanned document recognition coverage of 90%; store the extracted content in a structured manner, generate JSON format parsed data, and store it in the `output / parsed / ` directory; Step 2: Extract entities and relationships from the parsed text and tables: Rule-based extraction: Quickly identify basic entities based on keyword matching, including: Mulch film type: PBAT, PLA, PPC, PE, biodegradable mulch film, etc.; Crop type: Corn, wheat, potato, cotton, tomato, etc.; Location: Use regular expressions to identify provinces, cities, and counties; Indicators: Yield, degradation rate, soil temperature, soil moisture content, etc., and extract the corresponding values ​​and units; LLM extraction: Use DeepSeek API or Qwen3-8B to process complex paragraphs and table rows: Extract deep semantic relationships, such as comparative relationships, impact relationships, application relationships, etc.; Extract complex entities, such as technical parameters, application effects, environmental conditions, etc.; Generate JSON format extracted data containing entities, relationships, and evidence; Hybrid strategy: Rule-based methods are used for fast pre-screening (speed: 1000 pages / second), and LLM methods are used for deep extraction (accuracy: 92%), with an overall accuracy of 91%; Step 3: Integrate and standardize the extracted knowledge: Unit standardization: Establish a unit conversion rule table, including: Yield: kg / mu → kg / ha (conversion coefficient 15.0), t / ha → kg / ha (conversion coefficient 1000.0); Thickness: mm → μm (conversion coefficient 1000.0), filament → μm (conversion coefficient 10.0) Temperature: uniformly expressed in °C; Percentage: uniformly expressed in %; Numerical validation: the standardized values ​​are checked for reasonableness, including: yield range: 0-50000 kg / ha; thickness range: 0.1-100μm; temperature range: -20-60℃; values ​​outside the range are marked; semantic alignment: entity embedding vectors are generated using the bge-m3 embedding model, and similarity is calculated using the FAISS vector database: similarity threshold: 0.95; Prioritize merging within the same paper; integrate and align across papers; achieve an F1-score of 0.92 for entity alignment; deduplication: remove duplicate entities and relationships based on entity embedding and semantic similarity, retaining high-quality knowledge; Step 4: Export the integrated knowledge into a knowledge graph format: Node generation: Convert entities into knowledge graph nodes, including: Node ID: Generate a unique ID using MD5 hash; Node type: Mulch film, crop, location, indicator, etc.; Node name: Entity value; Node attributes: Description information, source file, page number, evidence, etc.; Relationship generation: Convert relationships into knowledge graph edges, including: Start node ID and end node ID; Relationship type: Applied to, Influenced, Planted in, etc.; Relationship attributes: Numerical value, unit, source file, etc.; Format export: Generate a Neo4j-compatible CSV format file; `nodes.csv`: Node data, including node ID, label, name, attributes, etc.; `relationships.csv`: Relationship data, including start node, end node, relationship type, attributes, etc.; `knowledge_graph.json`: Knowledge graph data in JSON format; Data statistics: Statistics on the number of nodes, the number of relationships, the distribution of entity types, etc. For example: Processing 1442 PDFs, generating approximately 50,000+ nodes and 30,000+ relationships.

[0026] S2: Based on the generated knowledge graph data, and combined with agricultural literature content, document parsing, vectorization processing and multi-source fusion are performed to construct a vectorized knowledge base for the field of plastic film mulching agriculture.

[0027] Furthermore, node and relationship data are loaded from a knowledge graph file in CSV format. The node data includes at least node ID, name, type, and description, and the relationship data includes at least relationship ID, start node, end node, relationship type, and description. The system is compatible with multiple encoding formats and performs error handling for missing fields. Structured information is extracted from agricultural PDF documents to generate extracted data in JSON format. The structured information includes at least the type of mulch film, crop type, application indicators, and technical parameters. The extracted text is fully parsed and divided into blocks using RecursiveCharacterTextSplitter, with each block being 800 characters in size and overlapping by 150 characters. The original PDF document is divided into blocks and metadata is attached to each document block to form document blocks suitable for vector retrieval; Supplementary knowledge documents are generated based on domain requirements, including answers to questions about crop adaptability, application effect data, technical parameters, and biodegradability characteristics of plastic film. Data from multiple sources is deduplicated, a unique document identifier is generated using UUID, and the data from multiple sources is uniformly converted into a document format that includes text, metadata, and id fields; Documents are vectorized using a multilingual optimized embedding model and stored in a vector database to form a multi-source vector knowledge base.

[0028] For example, step 1: Load data from a CSV format knowledge graph file: Node data file: `Mulch Film Expert Screening_Node Data.csv`, containing fields such as node ID, node name, node type, and description; Relationship data file: `Mulch Film Expert Screening_Relationship Data.csv`, containing fields such as relationship ID, start node, end node, relationship type, and relationship description; Multiple encoding formats (utf-8, gbk, gb2312, utf-8-sig) are supported during loading, and error handling is performed for missing fields, using UUID to generate a unique document ID; Step 2: Extract structured information from agricultural documents in PDF format: Use tools such as pdfplumber, Camelot, PaddleOCR PP-Structure to parse PDFs; extract information such as mulch film type, crop type, application indicators, and technical parameters; generate extracted data in JSON format and store it in the `output / extracted / ` directory; Step 3: Perform complete text parsing on the PDF document: Load the PDF document using UnstructuredFileLoader; use RecursiveCharacterTextSplitter to segment the text into chunks; chunk size 800 characters, overlap 150 characters; generate parsed data in JSON format and store it in the `output / parsed / ` directory; Step 4: Divide the original PDF document into chunks: Read PDF files from the `Mulch Film Database Literature / ` catalog; select 50 representative PDF files for processing; generate multiple document blocks for each PDF, with each document block containing text content and metadata; Step 5: Generate domain-specific supplementary knowledge documents: Crop adaptability knowledge: the adaptability of different crops to different types of mulch film; Application effect data: data on the impact of mulch film application on crop yield and quality; Technical parameters: technical parameters such as mulch film thickness, width, and light transmittance; Characteristics of biodegradable mulch film: degradation performance and environmental impact of biodegradable mulch film; Frequently Asked Questions: common problems and answers in the use of mulch film; Step 6: Deduplicatize and merge multi-source data: Use the hash value of the document content for deduplication; Use UUID to generate unique document IDs to avoid ID conflicts; unify document format: include fields such as text, metadata, and id; ultimately generate 18,403 unique documents; Step 7: Vectorize using a multilingual optimized embedding model; Embedding model: `sentence-transformers / paraphrase-multilingual-MiniLM-L12-v2`; Vector database: ChromaDB; Collection name: `geomulch_knowledge_base`; Storage path: `geomul-agent / rag / vector_db / `.

[0029] S3: Perform domain-specific fine-tuning on the pre-trained language model to obtain a question-and-answer model specifically for plastic film mulching agriculture.

[0030] Furthermore, high-quality question-answer pairs are generated based on knowledge graph nodes and relationships; the training data undergoes multiple rounds of quality optimization, including removing literature citation formats, ensuring sentence integrity, improving the naturalness of answers, and removing duplicates. The basic large model is efficiently fine-tuned using 4-bit quantization and LoRA technology. Training data was input in ChatML format and trained using gradient checkpoints to obtain a domain-specific question-and-answer model for plastic film mulching agriculture.

[0031] Furthermore, the LoRA configuration includes r=16, alpha=32, dropout=0.05, and the target modules include at least q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, and down_proj.

[0032] For example, step 1: Generate high-quality question-answer pairs based on knowledge graph: extract information from the node and relationship data of the knowledge graph; generate question-answer pairs containing specific information (numerical values, specific effects); Remove template-based expressions to ensure natural and fluent answers; generate 10,000+ high-quality question-and-answer pairs; Step 2: Perform multiple rounds of quality optimization on the training data: Round 1: Remove templated expressions such as "XX relationship exists"; Round 2: Remove expressions such as "XX is an Entity type"; Round 3: Ensure that the answers contain specific information and delete invalid data; Round 4: Remove citation formats and ensure sentence integrity. Fifth round: Improve the naturalness of the answers and remove duplicate content; finally, 1,028 high-quality training samples were obtained; Step 3: Configure QLoRA fine-tuning parameters: Python # 4-bit quantization configuration bnb_config=BitsAndBytesConfig( load_in_4bit=True, bnb_4bit_quant_type="nf4", bnb_4bit_compute_dtype=torch.bfloat16, bnb_4bit_use_double_quant=True, ) # LoRA Configuration lora_config=LoraConfig( r=16, lora_alpha=32, target_modules=["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"], lora_dropout=0.05, bias="none", task_type="CAUSAL_LM" ) ``` Step 4: Train using ChatML format: Training data format: `<|im_start|>user\n{query}<|im_end|>\n<|im_start|>assistant\n{answer}<|im_end|>` Training parameters: learning rate 2e-4, batch size 4, gradient accumulation steps 4, number of training rounds 3; Use gradient checkpoints to save video memory; After training is complete, save the LoRA weights to `lora_output_fine_tuned / `.

[0033] S4: Based on the constructed vectorized knowledge base, vector retrieval, semantic filtering, and result reordering are performed on user queries to form a collection of documents related to the query.

[0034] Furthermore, the user query is expanded using a thesaurus of synonyms in the field of plastic film; The expanded user query is converted into a vector and retrieved from the vector database, returning TOP-K related documents. The search results are semantically filtered based on agricultural keywords and content quality indicators to remove irrelevant documents. The filtered documents are calculated and re-ranked according to multiple dimensions. The comprehensive score is composed of weighted factors such as original similarity, keyword matching, content quality and source credibility, and query intent matching. Perform diversity processing on the reordering results.

[0035] For example, step 1: Expand the query based on a thesaurus of terms related to agricultural mulch film: Input query: "What is agricultural mulch film?" Expanded query: "What is agricultural mulch film? Agricultural mulch film coverings"; This improves the search coverage by 10-15%. Step 2: Use an embedding model for vector retrieval: Convert the expanded query into a vector; perform a similarity search in the vector database; return the top-8 relevant documents; Step 3: Filter based on agricultural keywords: Keywords include: mulch film, covering, crops, soil, temperature, humidity, yield, etc.; calculate the semantic relevance between the document and the query; filter out documents with relevance below the threshold. Step 4: Calculate the document's overall score: Python Overall score = 0.3 × Original similarity + 0.4 × Keyword matching + 0.25 × Content quality + 0.15 × Source credibility + 0.2 × Query intent matching; ``` Step 5: Ensure the diversity of search results: Group by data source type; select the best documents from each group; ensure coverage of various data sources such as knowledge graphs, documents, and PDFs.

[0036] S5: Generate context based on the obtained document set, and use a question-and-answer model specifically for plastic film mulching agriculture for reasoning. Standardize the generated results to obtain the final answer.

[0037] Furthermore, user queries are categorized into types, including definition, comparison, application, technology, method, effect, and general categories. Suggestion words are dynamically constructed based on query type. The suggestion words include system role definitions, retrieved context documents, answer requirements, and Few-Shot examples. The constructed prompts are input into the fine-tuned domain model and inference is performed with specified generation parameters, including max_new_tokens, temperature, top_p, top_k, repetition_penalty, length_penalty, and no_repeat_ngram_size. Post-processing is performed on the answers generated by the model, including removing thought tags and special marks, formatting cleanup, removing redundant sentences, sentence normalization, accuracy verification and completeness checks, and extracting supplementary information from the retrieval context when necessary; The generated results are cached using the hash value of the query content and parameters as the cache key. The cache has a preset validity period and a maximum number of entries.

[0038] For example, step 1: Analyze the user query type: Define a class: "What is plastic film?" Comparison: "What are the differences between PE mulch film and biodegradable mulch film?" Application category: "What are the applications of plastic film mulching in corn cultivation?" Technical question: "What is the typical thickness of plastic film used for mulching?" Method-based question: "How to choose the right mulch film?" Effects-based question: "What is the impact of plastic film mulching on soil temperature?" General category: Other types of queries; Step 2: Construct suggestion keywords based on query type: Python System prompt = "" You are a professional expert in plastic film mulching technology. Answer the question based on the following context.

[0039] Context information: {context} Answer requirements: 1. Accuracy: Ensure information is accurate and answer based on context; 2. Completeness: Provide complete information, including key data; 3. Structured: Use clear paragraph structure; 4. Key data: including specific numerical values ​​and technical parameters; 5. Objectivity: Maintain an objective and professional tone; 6. If the information is insufficient, please provide a clear explanation; 7. Avoid guessing or fabricating information; """ Few-Shot Examples (selected based on query type): Definition Example: Provides example answers to definition-type questions; Comparison Example: Provides example answers to comparison-type questions; ... (other types are similar); ``` Step 3: Perform inference using the fine-tuned model: Python Generate parameters = { "max_new_tokens": 512, "temperature": 0.3, "top_p": 0.85, "top_k": 50, "repetition_penalty": 1.15, "length_penalty": 1.2, "no_repeat_ngram_size": 3 } ``` Step 4: Post-process the generated answers: 1. Remove the "Thinking" tag: Delete ` <think> ...< / think> Tags such as `; 2. Formatting and cleaning: Standardize line breaks, spaces, and punctuation marks; 3. Redundancy Removal: Identify and delete duplicate sentences; 4. Sentence standardization: Ensure sentences are complete and punctuation is correct; 5. Accuracy Verification: Detect obvious errors (such as "thickness is 0") and extract the correct information from the context. 6. Completeness check: Verify answer length and keyword coverage, and extract supplementary information if necessary; Step 5: Cache query results: Cache key: query content + hash value of generated parameters; Cache validity period: 1 hour; Maximum number of cached entries: 1000; Cache location: `geomul-agent / rag / cache / `.

[0040] S6: Return the final answer and related document information to the user.

[0041] For example, system initialization Python from rag.rag_manager import RAGManager # Initialize the RAG system rag_manager=RAGManager() rag_manager.initialize() # Building a multi-source knowledge base result=rag_manager.build_knowledge_base( integrate_all_sources=True, rebuild=True ) ``` Execute query Python # Execute RAG query result = rag_manager.query( What is plastic film mulch? max_new_tokens=512, temperature=0.3, top_k_retrieval=8 ) # Get Results answer=result["answer"] retrieved_docs=result["retrieved_docs"] num_docs=result["num_docs"] ``` System configurations are defined in `config.py`: Basic model path: `Qwen3-8B / `; LoRA model path: `geomul-agent / model / lora_output_fine_tuned / ` Embedded model: `sentence-transformers / paraphrase-multilingual-MiniLM-L12-v2`; Vector database: ChromaDB; Knowledge base name: `geomulch_knowledge_base`.

[0042] This embodiment also provides an intelligent question-and-answer system for plastic film mulching agriculture based on knowledge graphs and enhanced generation, including: The knowledge graph construction module is used to perform multimodal parsing of agricultural literature and extract entities and relationships. After standardization, semantic alignment and structuring, it generates knowledge graph data that can be used for knowledge modeling. The multi-source knowledge base construction module is used to construct a vectorized knowledge base for the field of plastic film mulching agriculture by using generated knowledge graph data and combining it with agricultural literature content for document parsing, vectorization processing and multi-source fusion. A domain-specific model fine-tuning module is used to fine-tune the pre-trained language model to obtain a question-answering model specifically for plastic film mulching agriculture. The intelligent retrieval module is used to perform vector retrieval, semantic filtering, and result reordering on user queries based on the constructed vectorized knowledge base, forming a collection of documents related to the query. The enhanced generation module is used to generate context based on the obtained document set, and to perform reasoning using a question-answering model specifically for plastic film mulching agriculture. The generated results are then standardized to obtain the final answer. The results return module is used to return the final answer and related document information to the user.

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

[0044] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0045] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0046] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless defined as herein.

[0047] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. An intelligent question and answer method for geofilm agriculture based on knowledge graph and enhanced generation, characterized in that, Comprise: Multi-modal analysis of agricultural literature and extraction of entities and relationships, after standardization, semantic alignment and structured processing, generate knowledge graph data that can be used for knowledge modeling; Based on the generated knowledge graph data, combined with the content of agricultural literature, document analysis, vectorization processing and multi-source fusion are carried out to construct a vectorized knowledge base for the mulch agriculture field; Fine-tune the pre-trained language model in the field to obtain a mulch agriculture specific question and answer model; Based on the constructed vectorized knowledge base, vector retrieval, semantic filtering and result reordering are performed on user queries to form a document set related to the query; Based on the obtained document set, generate the context and use the mulch agriculture specific question and answer model for reasoning, and perform standardization processing on the generated results to obtain the final answer; The final answer and related document information are returned to the user.

2. The intelligent question answering method for mulching agriculture based on knowledge graph and enhanced generation according to claim 1, characterized in that, The multi-modal analysis of agricultural literature and the extraction of entities and relationships, after standardization, semantic alignment and structured processing, generate knowledge graph data that can be used for knowledge modeling, comprising: Multi-modal analysis of PDF format agricultural literature, including extracting text using pdfplumber; Extracting tables with and without borders using Camelot; Using PaddleOCR PP-Structure for OCR recognition on scanned documents; Structuring the extracted text, tables and OCR results and generating JSON format analysis data; Extract entities and relationships from text and tables based on analysis data, including quickly identifying basic entities and basic relationships based on keyword matching, the basic entities include but are not limited to mulch type, crop type, location and index; Use large language model to process complex paragraphs and table rows to extract deep semantic relationships, comparison relationships and technical parameters; Pre-screening by rule method and deep extraction by LLM method to generate JSON format extraction data containing entities, relationships and evidence; Standardization and verification of extracted knowledge, including unit standardization, numerical verification, semantic alignment and de-duplication based on embedding; Convert the integrated knowledge into knowledge graph format, including node generation, relationship generation, export as Neo4j compatible node CSV and relationship CSV, and JSON format knowledge graph data, and count node number, relationship number and entity type distribution information.

3. The intelligent question answering method for mulching agriculture based on knowledge graph and enhanced generation according to claim 1, characterized in that, Based on the generated knowledge graph data, combined with the content of agricultural literature, document analysis, vectorization processing and multi-source fusion are carried out to construct a vectorized knowledge base for the mulch agriculture field, comprising: Load node and relationship data from CSV format knowledge graph file, the node data at least contains node ID, name, type and description, the relationship data at least contains relationship ID, start node, end node, relationship type and description, and compatible with multiple encoding formats and fault tolerance processing for missing fields; Extract structured information from agricultural PDF literature to generate JSON format extraction data, the structured information at least includes mulch type, crop type, application index and technical parameter; The extracted text is fully parsed and split into chunks using RecursiveCharacterTextSplitter, with a chunk size of 800 characters and an overlap of 150 characters; The original PDF documents are chunked and metadata is attached to each document chunk, forming document chunks suitable for vector retrieval; Supplemental knowledge documents are generated based on domain requirements, including crop adaptability, application effect data, technical parameters, and biodegradation characteristics of mulching film; Data from multiple sources is deduplicated using UUID to generate unique document identifiers, and is unified into a document format containing text, metadata, and id fields; The documents are vectorized using a multilingual optimized embedding model and stored in a vector database, forming a multi-source vector knowledge base.

4. The intelligent question answering method for mulching agriculture based on knowledge graph and enhanced generation according to claim 1, characterized in that, The pre-trained language model is fine-tuned for the mulching film agriculture domain to obtain a specialized question and answer model, including: Based on the knowledge graph, high-quality question and answer pairs are generated based on nodes and relationships. The training data is optimized in multiple rounds, including removing literature citation formats, ensuring sentence integrity, improving answer naturalness, and deduplicating; The base large model is efficiently fine-tuned using 4-bit quantization and LoRA technology; The training data is input in ChatML format and trained using gradient checkpoints to obtain a domain-specific mulching film agriculture question and answer model.

5. The method of claim 4, wherein the method is based on a knowledge graph and enhanced generation of a film agriculture intelligent question and answer. The LoRA configuration includes r=16, alpha=32, dropout=0.05, and the target module includes at least q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, and down_proj.

6. The intelligent question answering method for mulching agriculture based on knowledge graph and enhanced generation according to claim 1, characterized in that, Based on the constructed vectorized knowledge base, the user query is vector retrieved, semantically filtered, and the results are reordered to form a document set related to the query, including: Based on the mulching film domain synonym dictionary, the user query is expanded with synonyms; The expanded user query is converted into a vector and retrieved in the vector database, returning the TOP-K related documents; Based on agricultural keywords and content quality indicators, the retrieval results are filtered for semantic relevance to eliminate irrelevant documents; The filtered documents are scored and reordered according to multiple dimensions, and the comprehensive score is composed of original similarity, keyword matching, content quality, source credibility, and query intent matching weights; The reordered results are processed for diversity.

7. The intelligent question-answering method for mulching agriculture based on knowledge graph and enhanced generation according to claim 1, wherein, Based on the obtained document set, the context is generated, and the mulching film agriculture specialized question and answer model is used for reasoning, and the generated results are standardized to obtain the final answer, including: The user query is classified by type, including definition, comparison, application, technology, method, effect, and general; Based on the query type, prompt words are dynamically constructed, including system role definition, retrieved context documents, answer requirements, and Few-Shot examples. The constructed prompt word is input into the fine-tuned domain model and inferred with specified generation parameters, including max_new_tokens, temperature, top_p, top_k, repetition_penalty, length_penalty, and no_repeat_ngram_size; Post-processing is performed on the generated answer, including removing thinking tags and special marks, formatting and cleaning, removing redundant sentences, sentence standardization, accuracy verification, and integrity check, and extracting supplementary information from the retrieval context if necessary; The generated result is cached with the hash value of the query content and parameters as the cache key, and the cache has a preset validity period and a maximum number of entries.

8. An intelligent question and answer system for mulching agriculture based on knowledge graph and enhanced generation, characterized in that, It includes: A knowledge graph construction module for multi-modal analysis of agricultural literature and extraction of entities and relationships, which generates knowledge graph data for knowledge modeling after standardization, semantic alignment, and structural processing; A multi-source knowledge base construction module for document analysis, vectorization processing, and multi-source fusion based on the generated knowledge graph data and agricultural literature content to construct a vectorized knowledge base for the mulch agriculture field; A domain-specific model fine-tuning module for domain-specific fine-tuning of a pre-trained language model to obtain a mulch agriculture-specific question and answer model; An intelligent retrieval module for vector retrieval, semantic filtering, and result reordering based on the constructed vectorized knowledge base to form a document set related to the query; An enhanced generation module for generating context based on the obtained document set and using the mulch agriculture-specific question and answer model for inference to standardize the generated result and obtain the final answer; A result return module for returning the final answer and related document information to the user. 9.An electronic device comprising a memory and a processor, the memory storing a computer program, wherein, The processor executes the computer program to realize the steps of the mulch agriculture intelligent question and answer method based on knowledge graph and enhanced generation of any one of claims 1-7.

10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the steps of the mulch agriculture intelligent question and answer method based on knowledge graph and enhanced generation of any one of claims 1-7.