Structured training data construction method and apparatus, computer device

By preprocessing and contextualizing the power materials table data, and using a large language model to generate inference instructions and verify formatting, the problem of insufficient data correlation in the power materials field is solved. This enables the construction of efficient and reliable structured training data and improves the understanding and decision-making capabilities of the large model.

CN122364206APending Publication Date: 2026-07-10SHENZHEN POWER SUPPLY BUREAU
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610482458.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-13
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

Existing technologies are insufficient for data correlation mining in the field of power materials, cannot support cross-line reasoning, have a high degree of reliance on manual intervention, and are difficult to adapt to complex business logic requirements.

Method used

By obtaining the original structured tables of the target business, preprocessing them, and then performing context aggregation, multi-row associated aggregation contexts are generated. Inference instructions are generated using a large language model, and then validation and formatting are performed to generate standard structured training data.

Benefits of technology

It significantly reduces the cost and time required to build training data, and the generated data is logically rigorous and formatted in a standardized manner, which can accurately adapt to the optimization needs of the target business management model and improve the model's understanding and decision-making capabilities in business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122364206A_ABST
    Figure CN122364206A_ABST
Patent Text Reader

Abstract

This application relates to a method, apparatus, and computer device for constructing structured training data. The method includes: first, obtaining the original structured table of the target business; performing preprocessing operations on the table; then, performing context aggregation processing on the preprocessed table to generate an aggregation context containing multiple rows of related table data; subsequently, based on the aggregation context and preset meta-hints, using a large language model to generate inference instructions containing reasoning questions, thought processes, and answers; and finally, validating and formatting the inference instructions to obtain standard structured training data for optimizing a large-scale target business management model. This method can accurately adapt to the optimization needs of the large-scale target business management model, effectively improving the model's understanding, reasoning, and decision-making capabilities in corresponding business scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of fine-tuning and training technology for large artificial intelligence models, and in particular to a method, apparatus, computer device, computer-readable storage medium, and computer program product for constructing structured training data. Background Technology

[0002] With the development of large-scale AI model fine-tuning training technology, a technique has emerged to transform tabular data into fine-tuning data. This technique mainly uses rule-based template filling and single-row data-based reverse synthesis to process tabular data. The former fills single-row data into a preset text template using a fixed script, while the latter extracts single-row data from the table and inputs it into a large model to generate simple question-and-answer pairs, thereby completing the construction of training data.

[0003] However, current traditional methods suffer from insufficient data correlation mining, inability to support cross-line reasoning, high reliance on manual intervention, and difficulty in adapting to the complex business logic requirements of the power materials sector. Summary of the Invention

[0004] Therefore, it is necessary to provide a method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can be applied to data analysis and processing in the field of power materials, and can efficiently and reliably construct structured training data.

[0005] Firstly, this application provides a method for constructing structured training data, including:

[0006] Obtain the original structured tables for the target business;

[0007] Preprocess the original structured table;

[0008] Perform context aggregation on the preprocessed original structured table to generate at least one aggregation context; the aggregation context includes multiple rows of related table data;

[0009] Based on the aggregated context and preset meta-hints, inference instructions are generated using a large language model; the inference instructions include inference questions, thought processes, and answers.

[0010] The inference instructions are validated and formatted to generate standard structured training data; this standard structured training data is used to optimize the target business management model.

[0011] In one embodiment, the preprocessed original structured table is subjected to context aggregation processing to generate at least one aggregation context, including:

[0012] Randomly select at least one starting row from the preprocessed original structured table;

[0013] For each starting row, select consecutive rows of data according to a preset number of rows to generate at least one aggregation context.

[0014] In one embodiment, the preprocessed original structured table is subjected to context aggregation processing to generate at least one aggregation context, including:

[0015] Calculate the similarity between rows in the preprocessed original structured table;

[0016] Select at least one anchor row, and filter out candidate rows corresponding to the anchor row from the preprocessed original structured table based on similarity to generate at least one aggregation context; the similarity between the candidate row and the anchor row meets the preset similarity condition; the aggregation context includes the anchor row and the corresponding candidate row.

[0017] In one embodiment, inference instructions are generated using a large language model based on the aggregation context and preset meta-hints, including:

[0018] Convert the aggregation context into the corresponding tag table format string;

[0019] Input the preset meta-hints and the marked table format strings into the large language model to generate inference instructions; the meta-hints include role definitions, data background, task instructions and thought chain constraints; the data background is used to insert each marked table format string.

[0020] In one embodiment, preset meta-hints and tagged table format strings are input into a large language model to generate inference instructions, including:

[0021] Based on the string type of the marked table format string, select the corresponding meta-hint instruction from the preset meta-hint instruction library; the meta-hint instruction library includes preset meta-hint instructions corresponding to various string types;

[0022] Input the tagged table format string and the corresponding meta-hint instruction into the large language model to generate inference instructions.

[0023] In one embodiment, inference instructions are generated using a large language model, including:

[0024] Based on preset temperature coefficient adjustment parameters and repetition penalty parameters, inference instructions are generated using a large language model; the temperature coefficient adjustment parameters are used to adjust the diversity of inference instructions, and the repetition penalty parameters are used to adjust the repetition of inference instructions.

[0025] In one embodiment, the inference instructions are validated and formatted to generate standard structured training data, including:

[0026] Using regular expressions and field format templates, key entity information is extracted from inference instructions;

[0027] Compare the key entity information with the corresponding field values ​​in the aggregation context;

[0028] The inference instructions that pass the comparison are converted into a standard structured format to obtain standard structured training data.

[0029] In one embodiment, the raw structured tabular data is preprocessed, including:

[0030] Identify the header information of the original structured tabular data as metadata;

[0031] Semantic matching is performed between metadata and a pre-defined mapping library to obtain semantic matching results;

[0032] Analyze and infer the data type corresponding to each column of data;

[0033] Perform a consistency check between the data type and the semantic matching results to obtain a consistent result;

[0034] The original structured tabular data is cleaned based on the consistency results.

[0035] Secondly, this application also provides a structured training data construction apparatus, comprising:

[0036] The acquisition module is used to acquire the original structured tables of the target business;

[0037] The processing module is used to preprocess the original structured tables;

[0038] The aggregation module is used to perform context aggregation on the preprocessed original structured table to generate at least one aggregation context; the aggregation context includes multiple rows of related table data;

[0039] The reasoning module is used to generate reasoning instructions based on the aggregated context and preset meta-hints using a large language model; the reasoning instructions include reasoning questions, thought processes, and answers;

[0040] The production module is used to verify and format inference instructions, generating standard structured training data; the standard structured training data is used to optimize the target business management model.

[0041] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0042] Obtain the original structured tables for the target business;

[0043] Preprocess the original structured table;

[0044] Perform context aggregation on the preprocessed original structured table to generate at least one aggregation context; the aggregation context includes multiple rows of related table data;

[0045] Based on the aggregated context and preset meta-hints, inference instructions are generated using a large language model; the inference instructions include inference questions, thought processes, and answers.

[0046] The inference instructions are validated and formatted to generate standard structured training data; this standard structured training data is used to optimize the target business management model.

[0047] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0048] Obtain the original structured tables for the target business;

[0049] Preprocess the original structured table;

[0050] Perform context aggregation on the preprocessed original structured table to generate at least one aggregation context; the aggregation context includes multiple rows of related table data;

[0051] Based on the aggregated context and preset meta-hints, inference instructions are generated using a large language model; the inference instructions include inference questions, thought processes, and answers.

[0052] The inference instructions are validated and formatted to generate standard structured training data; this standard structured training data is used to optimize the target business management model.

[0053] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:

[0054] Obtain the original structured tables for the target business;

[0055] Preprocess the original structured table;

[0056] Perform context aggregation on the preprocessed original structured table to generate at least one aggregation context; the aggregation context includes multiple rows of related table data;

[0057] Based on the aggregated context and preset meta-hints, inference instructions are generated using a large language model; the inference instructions include inference questions, thought processes, and answers.

[0058] The inference instructions are validated and formatted to generate standard structured training data; this standard structured training data is used to optimize the target business management model.

[0059] The aforementioned method, apparatus, computer equipment, computer-readable storage medium, and computer program product for constructing structured training data first acquire the original structured table of the target business, perform preprocessing operations on it, and then perform context aggregation processing on the preprocessed table to generate an aggregation context containing multi-row related table data, avoiding the information fragmentation problem caused by single-row data processing. Subsequently, based on the aggregation context and preset meta-hints, a large language model is used to generate inference instructions containing inference questions, thought processes, and answers. Finally, the inference instructions are validated and formatted to obtain standard structured training data for optimizing the target business management model. The entire process of context association aggregation, inference instruction generation, and data validation and formatting does not require a large amount of manual annotation, significantly reducing the cost and cycle of training data construction. At the same time, by introducing thought processes and standardized validation, the data logic rigor and format standardization are ensured. The generated standard structured training data can accurately adapt to the optimization needs of the target business management model, effectively improving the model's understanding, reasoning, and decision-making capabilities in the corresponding business scenarios. Attached Figure Description

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

[0061] Figure 1 This is a diagram illustrating the application environment of a structured training data construction method in one embodiment.

[0062] Figure 2 This is a flowchart illustrating a structured training data construction method in one embodiment;

[0063] Figure 3 Here is a system architecture diagram of a structured training data construction method in one embodiment;

[0064] Figure 4 This is a schematic diagram illustrating the multi-row data sampling principle of a structured training data construction method in another embodiment;

[0065] Figure 5 This is a structural block diagram of a structured training data construction device in one embodiment;

[0066] Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0067] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0068] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.

[0069] The structured training data construction method provided in this application can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or placed on the cloud or other network servers. First, the original structured table of the target business is obtained, and preprocessing operations are performed on it. Then, context aggregation processing is performed on the preprocessed table to generate an aggregation context containing multiple rows of related table data. Subsequently, based on this aggregation context and preset meta-hints, a reasoning instruction containing reasoning questions, thought processes, and answers is generated using a large language model. Finally, the reasoning instruction is verified and formatted to obtain standard structured training data for optimizing the target business management large model.

[0070] Terminal 102 can be, but is not limited to, various personal computers, laptops, tablets, power industry-specific office terminals, industrial data acquisition terminals, and IoT office equipment. IoT office equipment can be data workstations, intelligent acquisition terminals, server consoles, etc. Server 104 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0071] In one exemplary embodiment, such as Figure 2 As shown, a method for constructing structured training data is provided, which can be applied to... Figure 1 Taking server 104 as an example, the explanation includes the following steps 202 to 210. Wherein:

[0072] Step 202: Obtain the original structured table of the target business;

[0073] The target business refers to the business related to power material management, including at least one of the following: material procurement, demand forecasting, framework agreement execution, and material catalog management; the original structured tabular data refers to standardized data organized in rows and columns, containing power material attributes and business indicators, in formats such as .xlsx and .csv.

[0074] Optionally, this can be achieved by reading local storage files, receiving data pushed by the business system, or pulling data from the database. The obtained raw structured table data includes at least one type of business field, such as material code, specifications, purchase quantity, demand time, and execution status.

[0075] Step 204: Preprocess the original structured table;

[0076] Preprocessing refers to the standardized process of cleaning, organizing, and semantically parsing the original structured tabular data, which is used to eliminate invalid data, unify data format, and clarify table structure information.

[0077] Optionally, a core field-meaning mapping library for the power materials field is pre-set; then, the first row of the table header is identified as metadata, and the metadata is semantically matched with the pre-set mapping library; after the matching is completed, the table data is cleaned to remove blank lines and invalid characters, and outlier filtering is performed to remove obviously abnormal or unreasonable values, thus completing the data preprocessing.

[0078] Step 206: Perform context aggregation processing on the preprocessed original structured table to generate at least one aggregation context; the aggregation context includes table data with multiple rows of related data.

[0079] Among them, context aggregation processing refers to the process of selecting multiple rows of data with business or semantic relationships from a structured table according to a preset strategy and combining them into unified context information that can be used for large model reasoning; aggregation context refers to context data composed of multiple rows of related table data, used to support cross-row reasoning and global analysis.

[0080] Optionally, the cosine similarity between rows of data in the preprocessed table is calculated, anchor rows are selected and candidate rows with similarity within a preset range are filtered out, and a specified number of rows of data are selected according to preset rules. The selected rows and anchor rows are aggregated using an aggregation function to obtain an aggregation context containing multiple rows of related data. Alternatively, sliding window sampling or semantic clustering sampling can be used to select multiple rows of related data and convert them into a unified format to form at least one aggregation context.

[0081] Step 208: Based on the aggregated context and preset meta-hints, generate inference instructions using a large language model; the inference instructions include the inference question, the thought process of the thought chain, and the answer;

[0082] Among them, meta-hints refer to pre-set hint templates used to guide the large language model to generate content according to a specified format and logic; reasoning instructions refer to structured instruction data generated based on power material business data, which includes questions, reasoning processes and results; and the thinking chain process refers to the intermediate reasoning steps that the large language model goes through to arrive at the answer based on the tabular data.

[0083] Optionally, the aggregated context and meta-hint instructions are concatenated and input into the large language model. The large language model generates reasoning questions that require cross-row comparison, statistics, filtering, or prediction based on multi-row related table data, and outputs the derivation process and corresponding answers in a thought chain manner to form a complete reasoning instruction.

[0084] Step 210: Verify and format the inference instructions to generate standard structured training data; the standard structured training data is used to optimize the target business management big model.

[0085] Among them, verification refers to verifying the factual accuracy and logical rationality of inference instructions, and eliminating invalid instructions containing illusions, erroneous values, or irrelevant content; formatting refers to converting the inference instructions that have passed verification into a unified data format that meets the requirements of fine-tuning the large model.

[0086] Optionally, the process first verifies whether the questions, thought processes, and answers in the reasoning instructions are consistent with the corresponding aggregation context, filtering out false or erroneous content. Specifically, key entity information such as numerical values, dates, material codes, and enumeration values ​​are extracted from the reasoning instructions. The extracted key entity information is compared with the values ​​of the corresponding fields in the input aggregation context, and illusion detection is performed using exact matching, numerical range verification, and enumeration value whitelist verification. If there is key entity information that fails the detection, a confidence score is calculated based on the importance of the key entity information. Key entity information below a preset threshold is discarded, while key entity information above a preset threshold is marked and retained. If all key entities pass the detection, all key entity information is retained. Then, the verified instructions are converted into a preset standard format to obtain standard structured training data for optimizing the large-scale model of electric target business management.

[0087] The aforementioned method for constructing structured training data first obtains the original structured tables of the target business, performs preprocessing operations on them, and then performs context aggregation processing on the preprocessed tables to generate an aggregation context containing multi-row related table data, avoiding the information fragmentation problem caused by single-row data processing. Subsequently, based on this aggregation context and preset meta-hints, a large language model is used to generate inference instructions containing inference questions, thought processes, and answers. Finally, the inference instructions are validated and formatted to obtain standard structured training data for optimizing the target business management model. The entire process of context association aggregation, inference instruction generation, and data validation and formatting does not require extensive manual annotation, significantly reducing the cost and cycle of training data construction. At the same time, by introducing thought processes and standardized validation, the data logic rigor and format standardization are ensured. The generated standard structured training data can accurately adapt to the optimization needs of the target business management model, effectively improving the model's understanding, reasoning, and decision-making capabilities in the corresponding business scenarios.

[0088] In one embodiment, the preprocessed original structured table is subjected to context aggregation processing to generate at least one aggregation context, including:

[0089] Randomly select at least one starting row from the preprocessed original structured table;

[0090] For each starting row, select consecutive rows of data according to a preset number of rows to generate at least one aggregation context.

[0091] Specifically, assuming the original structured table dataset is ,in Indicates the first Row data. Define an aggregate function. , used to generate the first The aggregation context of each training sample :

[0092]

[0093] in, For the first The set of row indices selected in the next sampling. , The size of the aggregation context window is also the preset number of rows.

[0094] A sliding window sampling strategy is adopted, which is a random sliding mode: the starting row is randomly selected. Select continuous Okay. The local order characteristics of the original data have been preserved.

[0095] In constructing the aggregation context To avoid the negative impact of duplicate rows on model training, the system employs the following deduplication and fallback mechanism, which mandates that the row index set be specified during the sampling phase. There are no duplicate indexes, ensuring that the same row of data is not reused within the same training sample.

[0096] In the above embodiments, by performing context aggregation processing on the preprocessed original structured table, randomly selecting the starting row and extracting continuous row data according to a preset number of rows, it is possible to efficiently and flexibly extract continuous local data fragments from the table and generate corresponding aggregation contexts. This ensures the consistency and relevance between the aggregation context content and the original table structure, and also improves the diversity and coverage of context generation by randomly selecting the starting row.

[0097] In one embodiment, the preprocessed original structured table is subjected to context aggregation processing to generate at least one aggregation context, including:

[0098] Calculate the similarity between rows in the preprocessed original structured table;

[0099] Select at least one anchor row, and filter out candidate rows corresponding to the anchor row from the preprocessed original structured table based on similarity to generate at least one aggregation context; the similarity between the candidate row and the anchor row meets the preset similarity condition; the aggregation context includes the anchor row and the corresponding candidate row.

[0100] Calculate the cosine similarity between row vectors, and select those that are semantically similar but have subtle differences. Okay, force the model to learn "fine-grained distinctions".

[0101] set up The aggregation context window size is also the preset number of rows. The similarity threshold is set to... and ,in These two thresholds are set based on experience. The system first calculates the cosine similarity between all pairs of rows. The similarity calculation formula is:

[0102]

[0103] in, , The first and Text embedding vectors for row data.

[0104] Select the plotted row For the currently selected anchor row, select the row that satisfies:

[0105]

[0106] Rows that meet the above conditions are selected as candidate rows, and then rows that match the above conditions are selected. The most similar and with some differences between them Lines together constitute the aggregation context. .

[0107] In the above embodiments, by first calculating the similarity of each row of data in the preprocessed original structured table, and then using the anchor row as the benchmark and filtering candidate rows that meet the preset similarity conditions to construct the aggregation context, it is possible to accurately extract continuous or non-continuous row combinations that are highly related to the semantics or data features of the anchor row. This makes the generated aggregation context have stronger semantic relevance and data consistency, effectively improving the relevance and effectiveness of the context content and avoiding interference from irrelevant row data.

[0108] In one embodiment, inference instructions are generated using a large language model based on the aggregation context and preset meta-hints, including:

[0109] Convert the aggregation context into the corresponding tag table format string;

[0110] Input the preset meta-hints and the marked table format strings into the large language model to generate inference instructions; the meta-hints include role definitions, data background, task instructions and thought chain constraints; the data background is used to insert each marked table format string.

[0111] Specifically, the aggregation context is converted into a corresponding markdown table format string. Then, the preset meta-hints containing role definitions, data background, task instructions, and thought chain constraints are input into the large language model along with the markdown table format string. The data background can be automatically inserted into the corresponding markdown table format string, thereby driving the large language model to generate corresponding inference instructions, thus realizing the standardized and controllable generation of inference instructions based on structured table context.

[0112] In the above embodiments, the aggregation context is first converted into a standardized and uniform tagged table format string. Then, the meta-hint instructions, which include role definitions, data background, task instructions, and thought chain constraints, are input together with this string into the large language model to generate inference instructions. This allows the large language model to clearly adapt to the format characteristics of structured table data and task scenarios. The standardized tag format reduces the model's parsing error of table data. At the same time, the meta-hint instructions enable precise constraints on the model's output behavior, significantly improving the standardization, logic, and relevance of inference instruction generation, and ensuring that the output content fits the data background and task requirements.

[0113] In one embodiment, preset meta-hints and tagged table format strings are input into a large language model to generate inference instructions, including:

[0114] Based on the string type of the marked table format string, select the corresponding meta-hint instruction from the preset meta-hint instruction library; the meta-hint instruction library includes preset meta-hint instructions corresponding to various string types;

[0115] Input the tagged table format string and the corresponding meta-hint instruction into the large language model to generate inference instructions.

[0116] Specifically, the system dynamically assembles meta-hint instructions with the following structure:

[0117] 1. Role definition: "You are a data analysis expert."

[0118] 2. Data Background: "The following is a set of relevant business data snippets: [Insert markup table format]"

[0119] 3. Task Instructions: "Based on the table above, design a complex question that requires cross-row comparison, statistical summation, or conditional filtering to answer. Avoid simple single-row queries."

[0120] 4. Key Feature: "Before generating an output, you must first generate a 'thinking process' that explains how you found evidence and reasoned from the table."

[0121] Inputting the above content into the large language model will produce the following output example:

[0122] Instruction: "In the list above, which type of failure occurs most frequently and has an average processing time exceeding 2 hours?"

[0123] Output: "Thinking process: First, count the number of occurrences of each type of fault... then calculate the processing time... final answer: According to the table statistics, 'line short circuit' occurs the most frequently and has an average duration of 2.5 hours."

[0124] In the above embodiments, based on the type of the marked table format string, a corresponding type of meta-hint instruction is selected from a preset meta-hint instruction library, and then both are input into the large language model to generate inference instructions. This enables precise adaptation between meta-hint instructions and table data formats, avoids mismatch problems caused by general hints, improves the efficiency of the large language model in understanding and processing structured table data, and ensures the standardization and applicability of hint content by relying on a typed instruction library, so that the final generated inference instructions are more in line with data characteristics and task requirements, and the output results are more stable and accurate.

[0125] In one embodiment, inference instructions are generated using a large language model, including:

[0126] Based on preset temperature coefficient adjustment parameters and repetition penalty parameters, inference instructions are generated using a large language model; the temperature coefficient adjustment parameters are used to adjust the diversity of inference instructions, and the repetition penalty parameters are used to adjust the repetition of inference instructions.

[0127] Specifically, when generating inference instructions using a large language model, the model generation process is controlled by introducing preset temperature coefficient adjustment parameters and repetition penalty parameters. The temperature coefficient adjustment parameters are used to regulate the diversity of inference instruction output, and the repetition penalty parameters are used to suppress the degree of repetition of inference instructions. This allows for flexible adjustment of the diversity and repetition of inference instructions during the model generation stage, resulting in inference instructions that meet expectations.

[0128] In the above embodiments, during the process of generating inference instructions using a large language model, the diversity of instruction output is controlled by a preset temperature coefficient adjustment parameter, and the duplication penalty parameter is combined to suppress the duplication and redundancy of output content. Under the premise of ensuring that the logic of the inference instructions is reasonable and the content is accurate, the richness and uniqueness of the output results can be flexibly adjusted, effectively avoiding the generation of duplicate and homogeneous inference instructions, while improving the diversity and quality of the output text, making the inference instructions more adaptable to the structured table inference needs of different scenarios.

[0129] In one embodiment, the inference instructions are validated and formatted to generate standard structured training data, including:

[0130] Using regular expressions and field format templates, key entity information is extracted from inference instructions;

[0131] Compare the key entity information with the corresponding field values ​​in the aggregation context;

[0132] The inference instructions that pass the comparison are converted into a standard structured format to obtain standard structured training data.

[0133] Specifically, a combination of regular expressions and field format templates is used to extract key entity information such as numerical values, dates, material codes, and enumeration values ​​from the Output field of the inference instructions generated by the large language model.

[0134] The extracted entities are aggregated with the input context. The values ​​of the corresponding fields are compared, and the verification methods include exact matching, range verification (such as whether the value falls between the minimum and maximum values ​​of the column), and whitelist verification of enumerated values.

[0135] If any key entity information fails validation, a confidence score is calculated based on the importance of the failed entity information (e.g., different weights for core values ​​and auxiliary descriptors). Samples below a set threshold are discarded, while samples above the threshold are marked and retained for manual sampling. If all key entity information passes validation, the sample is retained. Validated inference instructions are then converted into a standard structured format.

[0136] In the above embodiments, key entity information is extracted from the inference instructions using regular expressions and field format templates, and then compared with the corresponding field values ​​of the aggregation context. The inference instructions that pass the verification are then converted into a standard structured format, which can effectively filter out inference instructions with logical errors, field mismatches, or non-standard formats, significantly improve the accuracy, standardization, and reliability of training data, avoid interference from erroneous data on model training, and form unified standard structured training data.

[0137] In one embodiment, the original structured table is preprocessed, including:

[0138] Identify the header information of the original structured tabular data as metadata;

[0139] Semantic matching is performed between metadata and a pre-defined mapping library to obtain semantic matching results;

[0140] Analyze and infer the data type corresponding to each column of data;

[0141] Perform a consistency check between the data type and the semantic matching results to obtain a consistent result;

[0142] The original structured tabular data is cleaned based on the consistency results.

[0143] Specifically, the system reads the original structured table and identifies the header information as metadata. It performs semantic matching with the metadata and a preset mapping library to obtain the semantic matching result. It analyzes and infers the data type corresponding to each column of data, including numeric, text, date, and enumeration types. It performs consistency verification between the data type and the semantic matching result to obtain the consistency result. Based on the consistency result, it cleans the original structured table data to remove blank lines and invalid characters.

[0144] In the above embodiments, the header information of the original structured table data is identified as metadata, semantically matched with a preset mapping library, and the data type corresponding to each column is automatically analyzed and inferred. Then, consistency verification is performed on the data type and semantic matching results, and table data cleaning is completed based on the consistency results. This can accurately identify and correct problems such as mismatch between header semantics and data type, and disordered format, effectively eliminating abnormal, erroneous and invalid data. While improving the standardization and consistency of table data, it also ensures the data quality of subsequent context aggregation and instruction generation stages, providing a clean, reliable and semantically clear data foundation for the entire structured table training data construction process.

[0145] In one embodiment, such as Figure 3 As shown, a structured training data construction method is implemented in a specific embodiment, including:

[0146] S1: Data Preprocessing and Semantic Parsing (Data Ingestion & Schema Parsing)

[0147] The input is a raw structured table of the target business in formats such as .xlsx or .csv. The system reads the raw structured table and identifies the table header information as metadata. It performs semantic matching with the metadata and a preset mapping library to obtain the semantic matching result. It analyzes and infers the data type corresponding to each column of data, including numeric, text, date, and enumeration types. It performs consistency verification between the data type and the semantic matching result to obtain the consistency result. Based on the consistency result, it cleans the raw structured table data to remove blank lines and invalid characters.

[0148] S2: Dynamic Multi-Row Context Aggregation

[0149] To enable the large language model to learn the relationships between lines, this step does not process individual lines. Instead, it employs a "sliding window sampling" or "semantic clustering sampling" strategy to select a group of related lines as the currently generated aggregation context, such as... Figure 4 As shown.

[0150] Sampling algorithm description: Assume the original structured tabular dataset is ,in Indicates the first Row data. Define an aggregate function. , used to generate the first The aggregation context of each training sample :

[0151]

[0152] in, For the first The set of row indices selected in the next sampling. , The size of the aggregation context window is also the preset number of rows.

[0153] The sampling strategy mainly includes two modes: one is the random sliding mode, which randomly selects the starting row. Select continuous Okay. It preserves the local order features of the original data. Another approach is similarity-based clustering: to construct challenging reasoning questions, the system calculates the cosine similarity between row vectors, selecting those that are semantically closest but have subtle differences. Okay, force the model to learn "fine-grained distinctions".

[0154] Similarity calculation formula:

[0155]

[0156] in, , The first and Text embedding vectors for row data.

[0157] Data serialization: Serializes the selected collection Convert it to a Markdown table format string, which will then be used as input for the subsequent large language model.

[0158] S3: Reasoning Instruction Generation Based on the Chain of Thought (CoT)

[0159] The tag table format generated by S2 and the preset meta-prompt are input into the large language model. The in-context learning capability of the large model is then used to perform a reverse generation task.

[0160] The system dynamically assembles meta-hint instructions with the following structure:

[0161] 1. Role definition: "You are a data analysis expert."

[0162] 2. Data Background: "The following is a set of relevant business data snippets: [Insert markup table format]"

[0163] 3. Task Instructions: "Based on the table above, design a complex question that requires cross-row comparison, statistical summation, or conditional filtering to answer. Avoid simple single-row queries."

[0164] 4. Key Feature: "Before generating an output, you must first generate a 'thinking process' that explains how you found evidence and reasoned from the table."

[0165] Inputting the above content into the large language model will produce the following output example:

[0166] Instruction: "In the list above, which type of failure occurs most frequently and has an average processing time exceeding 2 hours?"

[0167] Output: "Thinking process: First, count the number of occurrences of each type of fault... then calculate the processing time... final answer: According to the table statistics, 'line short circuit' occurs the most frequently and has an average duration of 2.5 hours."

[0168] S4: Quality Verification and Formatting

[0169] Hallucination Detection: Since the data is synthetic, it's necessary to prevent the model from fabricating values ​​that don't exist in the table. The system will write a validation script to check whether the numerical entities appearing in the Output actually exist in the input aggregation context. middle.

[0170] Specifically, a combination of regular expressions and field format templates is used to extract key entity information such as numerical values, dates, material codes, and enumeration values ​​from the Output field of the inference instructions generated by the large language model.

[0171] The extracted entities are aggregated with the input context. The values ​​of the corresponding fields are compared, and the verification methods include exact matching, range verification (such as whether the value falls between the minimum and maximum values ​​of the column), and whitelist verification of enumerated values.

[0172] If any key entity information fails validation, a confidence score is calculated based on the importance of the failed entity information (e.g., different weights for core values ​​and auxiliary descriptors). Samples below a set threshold are discarded, while samples above the threshold are marked and retained for manual sampling. If all key entity information passes validation, the sample is retained. Validated inference instructions are then converted into a standard structured format.

[0173] In addition, meta-hints can be managed using structured XML or JSON schemas, and support dynamic switching of template slots based on data type (numerical / text). The large language model includes preset temperature coefficient adjustment parameters and repetition penalty parameters. The temperature coefficient adjustment parameters are used to adjust the diversity of inference instructions, and the repetition penalty parameters are used to adjust the repetition rate of the inference instructions.

[0174] This method can be applied in the following scenarios: Scenario 1: Intelligent shopping assistant. By importing product parameter tables, the fine-tuned model can answer questions requiring comprehensive comparison, such as "Recommend a mobile phone with the best cost performance and more than 10 hours of battery life." Scenario 2: Business operation analysis. By importing sales reports, the model can answer questions such as "Which department had an abnormal growth rate last quarter?".

[0175] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.

[0176] Based on the same inventive concept, this application also provides a structured training data construction apparatus for implementing the structured training data construction method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more embodiments of the structured training data construction apparatus provided below can be found in the limitations of the structured training data construction method described above, and will not be repeated here.

[0177] In one exemplary embodiment, such as Figure 5 As shown, a structured training data construction apparatus is provided, including: an acquisition module 502, a processing module 504, an aggregation module 506, an inference module 508, and a production module 510, wherein:

[0178] Module 502 is used to obtain the original structured table of the target business;

[0179] Processing module 504 is used to preprocess the original structured table;

[0180] The aggregation module 506 is used to perform context aggregation processing on the preprocessed original structured table to generate at least one aggregation context; the aggregation context includes multiple rows of related table data;

[0181] The reasoning module 508 is used to generate reasoning instructions using a large language model based on the aggregated context and preset meta-hints; the reasoning instructions include reasoning questions, thought processes, and answers;

[0182] Production module 510 is used to verify and format inference instructions to generate standard structured training data; the standard structured training data is used to optimize the target business management model.

[0183] In one embodiment, the aggregation module 506 is configured to perform context aggregation processing on the preprocessed original structured table to generate at least one aggregation context, including:

[0184] Randomly select at least one starting row from the preprocessed original structured table;

[0185] For each starting row, select consecutive rows of data according to a preset number of rows to generate at least one aggregation context.

[0186] In one embodiment, the aggregation module 506 is configured to perform context aggregation processing on the preprocessed original structured table to generate at least one aggregation context, including:

[0187] Calculate the similarity between rows in the preprocessed original structured table;

[0188] Select at least one anchor row, and filter out candidate rows corresponding to the anchor row from the preprocessed original structured table based on similarity to generate at least one aggregation context; the similarity between the candidate row and the anchor row meets the preset similarity condition; the aggregation context includes the anchor row and the corresponding candidate row.

[0189] In one embodiment, the inference module 508 is configured to generate inference instructions using a large language model based on the aggregation context and preset meta-hint instructions, including:

[0190] Convert the aggregation context into the corresponding tag table format string;

[0191] Input the preset meta-hints and the marked table format strings into the large language model to generate inference instructions; the meta-hints include role definitions, data background, task instructions and thought chain constraints; the data background is used to insert each marked table format string.

[0192] In one embodiment, the inference module 508 is further configured to input preset meta-hint instructions and a marked table format string into the large language model to generate inference instructions, including:

[0193] Based on the string type of the marked table format string, select the corresponding meta-hint instruction from the preset meta-hint instruction library; the meta-hint instruction library includes preset meta-hint instructions corresponding to various string types;

[0194] Input the tagged table format string and the corresponding meta-hint instruction into the large language model to generate inference instructions.

[0195] In one embodiment, the inference module 508 is used to generate inference instructions using a large language model, including:

[0196] Based on preset temperature coefficient adjustment parameters and repetition penalty parameters, inference instructions are generated using a large language model; the temperature coefficient adjustment parameters are used to adjust the diversity of inference instructions, and the repetition penalty parameters are used to adjust the repetition of inference instructions.

[0197] In one embodiment, the production module 510 is used to verify and format inference instructions to generate standard structured training data, including:

[0198] Using regular expressions and field format templates, key entity information is extracted from inference instructions;

[0199] Compare the key entity information with the corresponding field values ​​in the aggregation context;

[0200] The inference instructions that pass the comparison are converted into a standard structured format to obtain standard structured training data.

[0201] In one embodiment, the processing module 504 is used to preprocess the original structured table, including:

[0202] Identify the header information of the original structured tabular data as metadata;

[0203] Semantic matching is performed between metadata and a pre-defined mapping library to obtain semantic matching results;

[0204] Analyze and infer the data type corresponding to each column of data;

[0205] Perform a consistency check between the data type and the semantic matching results to obtain a consistent result;

[0206] The original structured tabular data is cleaned based on the consistency results.

[0207] Each module in the aforementioned structured training data construction device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0208] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 6 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores raw structured tabular data, a core field-meaning mapping library, aggregation context, inference instructions, and standard structured training data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a method for constructing structured training data.

[0209] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0210] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0211] Obtain the original structured tables for the target business;

[0212] Preprocess the original structured table;

[0213] Perform context aggregation on the preprocessed original structured table to generate at least one aggregation context; the aggregation context includes multiple rows of related table data;

[0214] Based on the aggregated context and preset meta-hints, inference instructions are generated using a large language model; the inference instructions include inference questions, thought processes, and answers.

[0215] The inference instructions are validated and formatted to generate standard structured training data; this standard structured training data is used to optimize the target business management model.

[0216] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0217] Randomly select at least one starting row from the preprocessed original structured table;

[0218] For each starting row, select consecutive rows of data according to a preset number of rows to generate at least one aggregation context.

[0219] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0220] Calculate the similarity between rows in the preprocessed original structured table;

[0221] Select at least one anchor row, and filter out candidate rows corresponding to the anchor row from the preprocessed original structured table based on similarity to generate at least one aggregation context; the similarity between the candidate row and the anchor row meets the preset similarity condition; the aggregation context includes the anchor row and the corresponding candidate row.

[0222] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0223] Convert the aggregation context into the corresponding tag table format string;

[0224] Input the preset meta-hints and the marked table format strings into the large language model to generate inference instructions; the meta-hints include role definitions, data background, task instructions and thought chain constraints; the data background is used to insert each marked table format string.

[0225] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0226] Based on the string type of the marked table format string, select the corresponding meta-hint instruction from the preset meta-hint instruction library; the meta-hint instruction library includes preset meta-hint instructions corresponding to various string types;

[0227] Input the tagged table format string and the corresponding meta-hint instruction into the large language model to generate inference instructions.

[0228] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0229] Based on preset temperature coefficient adjustment parameters and repetition penalty parameters, inference instructions are generated using a large language model; the temperature coefficient adjustment parameters are used to adjust the diversity of inference instructions, and the repetition penalty parameters are used to adjust the repetition of inference instructions.

[0230] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0231] Using regular expressions and field format templates, key entity information is extracted from inference instructions;

[0232] Compare the key entity information with the corresponding field values ​​in the aggregation context;

[0233] The inference instructions that pass the comparison are converted into a standard structured format to obtain standard structured training data.

[0234] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0235] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0236] Obtain the original structured tables for the target business;

[0237] Preprocess the original structured table;

[0238] Perform context aggregation on the preprocessed original structured table to generate at least one aggregation context; the aggregation context includes multiple rows of related table data;

[0239] Based on the aggregated context and preset meta-hints, inference instructions are generated using a large language model; the inference instructions include inference questions, thought processes, and answers.

[0240] The inference instructions are validated and formatted to generate standard structured training data; this standard structured training data is used to optimize the target business management model.

[0241] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:

[0242] Obtain the original structured tables for the target business;

[0243] Preprocess the original structured table;

[0244] Perform context aggregation on the preprocessed original structured table to generate at least one aggregation context; the aggregation context includes multiple rows of related table data;

[0245] Based on the aggregated context and preset meta-hints, inference instructions are generated using a large language model; the inference instructions include inference questions, thought processes, and answers.

[0246] The inference instructions are validated and formatted to generate standard structured training data; this standard structured training data is used to optimize the target business management model.

[0247] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0248] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0249] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0250] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for constructing structured training data, characterized in that, The method includes: Obtain the original structured tables for the target business; The original structured table is preprocessed; The preprocessed original structured table is subjected to context aggregation processing to generate at least one aggregation context; the aggregation context includes multiple rows of related table data; Based on the aggregated context and preset meta-hints, a large language model is used to generate inference instructions; the inference instructions include inference questions, thought processes, and answers. The inference instructions are validated and formatted to generate standard structured training data; the standard structured training data is used to optimize the target business management model.

2. The method according to claim 1, characterized in that, The step of performing context aggregation processing on the preprocessed original structured table to generate at least one aggregation context includes: At least one starting row is randomly selected from the preprocessed original structured table; For each starting row, consecutive rows of data are selected according to a preset number of rows to generate at least one aggregation context.

3. The method according to claim 1, characterized in that, The step of performing context aggregation processing on the preprocessed original structured table to generate at least one aggregation context includes: Calculate the similarity between rows in the preprocessed original structured table; At least one anchor row is selected, and candidate rows corresponding to the anchor row are filtered from the preprocessed original structured table according to the similarity to generate at least one aggregation context; the similarity between the candidate row and the anchor row satisfies a preset similarity condition; the aggregation context includes the anchor row and the corresponding candidate row.

4. The method according to claim 1, characterized in that, The step of generating inference instructions using a large language model based on the aggregated context and preset meta-hints includes: Convert the aggregation context into the corresponding tag table format string; The preset meta-hints and the marked table format strings are input into the large language model to generate the inference instructions; the meta-hints include role definitions, data backgrounds, task instructions, and thought chain constraints; the data backgrounds are used to insert each of the marked table format strings.

5. The method according to claim 4, characterized in that, The step of inputting the preset meta-hint instruction and the marked table format string into the large language model to generate the inference instruction includes: Based on the string type of the marked table format string, a corresponding meta prompt instruction is selected from a preset meta prompt instruction library; the meta prompt instruction library includes preset meta prompt instructions corresponding to various string types. The marked table format string and the corresponding meta-hint instruction are input into the large language model to generate the inference instruction.

6. The method according to claim 1, characterized in that, The generation of inference instructions using a large language model includes: Based on preset temperature coefficient adjustment parameters and repetition penalty parameters, the inference instructions are generated using the large language model; the temperature coefficient adjustment parameters are used to adjust the diversity of the inference instructions, and the repetition penalty parameters are used to adjust the repetition of the inference instructions.

7. The method according to claim 1, characterized in that, The step of verifying and formatting the inference instructions to generate standard structured training data includes: Key entity information is extracted from the inference instructions using regular expressions and field format templates. The key entity information is compared with the corresponding field values ​​in the aggregation context; The inference instructions that pass the comparison are converted into a standard structured format to obtain the standard structured training data.

8. The method according to claim 1, characterized in that, The preprocessing of the original structured table includes: Identify the header information of the original structured table data as metadata; Based on the metadata, semantic matching is performed with a preset mapping library to obtain semantic matching results; Analyze and infer the data type corresponding to each column of data; The data type is matched with the semantic matching result for consistency verification to obtain a consistency result. The original structured tabular data is cleaned based on the consistency results.

9. A structured training data construction device, characterized in that, The device includes: The acquisition module is used to acquire the original structured tables of the target business; The processing module is used to preprocess the original structured table; The aggregation module is used to perform context aggregation processing on the preprocessed original structured table to generate at least one aggregation context; the aggregation context includes multiple rows of related table data; The reasoning module is used to generate reasoning instructions using a large language model based on the aggregated context and preset meta-hints; the reasoning instructions include reasoning questions, thought processes, and answers; The production module is used to verify and format the inference instructions to generate standard structured training data; the standard structured training data is used to optimize the target business management model.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 8.