A sample enhancement method and device for a long-tail distribution of data and a storage medium
By employing a latent Dirichlet distribution topic model and an online sparse query strategy, combined with dual-path retrieval and thought chain sample generation, the efficiency and accuracy issues of sample augmentation under long-tailed data distribution are addressed, achieving efficient identification of sparse topic regions and improved sample quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA MOBILE INFORMATION TECHNOLOGY CO LTD
- Filing Date
- 2026-03-03
- Publication Date
- 2026-07-21
Smart Images

Figure CN122432312A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, specifically to a sample augmentation method, apparatus, and storage medium for long-tailed data distribution. Background Technology
[0002] In the field of artificial intelligence, long-tail distribution refers to a statistical phenomenon where the frequency of categories or topics in a dataset is highly imbalanced. This manifests as a few categories having a large number of samples (the "head"), while a large number of categories have very few samples (the "tail"). Long-tail distribution is common in practical applications such as product sales, word usage frequency, and user behavior, making it difficult for traditional statistical models or machine learning methods to learn and generalize effectively, especially resulting in poor predictive performance for tail categories.
[0003] Current technical solutions for handling long-tailed data distribution problems mainly include the following well-known and closest technical solutions: Data Augmentation, commonly used methods include image rotation, cropping, and flipping, as well as text techniques such as synonym replacement, random insertion, deletion, or word replacement, to improve the generalization performance of the model; Data Resampling, including oversampling and undersampling methods; Topic Modeling (such as Latent Dirichlet Allocation (LDA)): Topic modeling can effectively analyze and understand the inherent structure of unstructured text data by automatically identifying the latent topic distribution in a document collection. However, when dealing with sparse regions or sparse topics, existing solutions generally use simple pre-set model methods (such as LDA models with a fixed number of topics) to model data within a fixed range, lacking efficient online adaptive analysis capabilities, resulting in low efficiency, relevance, and accuracy of sample augmentation under long-tailed data distributions. Summary of the Invention
[0004] At least one embodiment of this application provides a sample augmentation method, apparatus, and storage medium for long-tailed data distribution, which addresses the problem in the prior art of how to improve the efficiency, relevance, and accuracy of sample augmentation under long-tailed data distribution.
[0005] To solve the above-mentioned technical problems, this application is implemented as follows:
[0006] In a first aspect, embodiments of this application provide a sample augmentation method for long-tailed data distributions, including:
[0007] The text data in the business dataset is preprocessed to obtain at least one potential Dirichlet distribution topic model and the corresponding result parameters.
[0008] Based on the processed latent Dirichlet distribution principal model and the result parameters, an online sparse query strategy corresponding to the query type input by the user is executed to obtain the target topic words and target subset range corresponding to the user input. The online sparse query strategy includes: a subset-based sparse topic identification strategy and a topic word-based sparse subset identification strategy.
[0009] Based on the target subset range and the target keywords, a dual-path retrieval enhancement generation is performed to obtain the corresponding target style samples and target topic samples;
[0010] Based on the target style sample and the target topic sample, a thought chain sample is generated to obtain the enhanced target sample.
[0011] Specifically, the sample augmentation method for long-tail data distribution described above, wherein the first preprocessing of the business dataset to obtain at least one preprocessed potential Dirichlet distribution topic model and corresponding result parameters includes:
[0012] Determine the reference query conditions based on historical query information or business experience;
[0013] Based on the reference query conditions, at least one corresponding first reference data subset is selected from the business dataset;
[0014] At least one process of latent Dirichlet distribution topic modeling is performed on at least one subset of the first reference data to obtain at least one corresponding latent Dirichlet distribution topic model and result parameters, which are then stored in a structured form.
[0015] Preferably, in the sample augmentation method for long-tailed data distributions as described above, the step of performing at least one process of latent Dirichlet distribution topic modeling on at least one first reference data subset to obtain at least one corresponding latent Dirichlet distribution topic model and result parameters includes:
[0016] The text data in the first reference data subset is preprocessed to obtain the processed text data;
[0017] The text data is trained based on the processed data and the preset number of topics to obtain the corresponding latent Dirichlet distribution topic model and the result parameters. The result parameters include the initialization parameters required for modeling, including the document-topic distribution and topic-word distribution matrix.
[0018] Preferably, in the sample augmentation method for long-tail data distribution described above, when the user-input query type is a query subset range, the step of executing an online sparse query strategy corresponding to the user-input query type based on the processed latent Dirichlet distribution principal model and the result parameters to obtain the target keywords and target subset range corresponding to the user input includes:
[0019] Matching is performed based on the range of the query subset and the first reference data subset;
[0020] If there exists a first reference data subset that matches the range of the query subset, then the topic word with the lowest distribution probability in the potential Dirichlet distribution topic model of the matched first reference data subset is determined as the target topic word, and the range of the matched query subset is determined as the target subset range;
[0021] If there is no first reference data subset that matches the range of the query subset, then at least one second reference data subset is obtained from the first reference data subset based on a constrained greedy selection algorithm.
[0022] Based on the incremental topic modeling algorithm, the second reference data subset is processed to obtain the target potential Dirichlet distribution topic model;
[0023] Based on the target potential Dirichlet distribution topic model, the topic word with the lowest distribution probability is determined as the target topic word, and the range of the query subset is determined as the target subset range.
[0024] Specifically, in the sample augmentation method for long-tailed data distribution described above, the constraint-based greedy selection algorithm for obtaining at least one second reference data subset from the first reference data subset includes:
[0025] Based on the first reference data subset, a plurality of first subset combinations are determined, wherein each first subset combination includes at least one of the first reference data subsets;
[0026] Based on the marginal contribution, at least one second subset combination is determined from multiple combinations of the first subset combinations, where the data coverage rate is greater than a first preset value and the data overflow rate is less than a second preset value;
[0027] From at least one of the second subset combinations, determine a third subset combination that has the highest data coverage and the lowest data overage, and determine the first reference data subset in the third subset combination as the second reference data subset.
[0028] Specifically, in the sample augmentation method for long-tailed data distribution described above, the step of processing the second reference data subset according to the incremental topic modeling algorithm to obtain the target latent Dirichlet distribution topic model includes:
[0029] Determine the third reference data subset with the largest data volume from the second reference data subset, and use the potential Dirichlet distribution topic model corresponding to the third reference data subset as the base model;
[0030] The other second reference data subsets, excluding the third reference data subset, are used as incremental data and input into the base model in batches. The base model is then updated using an online variational Bayes algorithm to obtain the target latent Dirichlet distribution topic model.
[0031] Preferably, in the sample augmentation method for long-tail data distribution described above, when the user input query type is a query topic term, the step of executing an online sparse query strategy corresponding to the user input query type based on the processed latent Dirichlet distribution principal model and the result parameters to obtain the target topic terms and target subset range corresponding to the user input includes:
[0032] Obtain the similarity between the query keywords and the first reference data subset;
[0033] A hierarchical tree structure is constructed based on the business dataset and preset data dimensions, where each leaf node of the tree structure corresponds to a subset of data.
[0034] Starting with the leaf node whose similarity is lower than a preset threshold, explore the adjacent leaf nodes at the same level in a loop, and determine all leaf nodes that are not related to the query topic.
[0035] Aggregate the states of all unrelated leaf nodes upwards, and determine the relevance of the nodes at the next higher level in turn according to the veto rule, until the relevance of the root node is obtained.
[0036] The subset range corresponding to the root node whose relevance is determined to be unrelated is the target subset range, and the query keyword is determined to be the target keyword.
[0037] Specifically, the sample augmentation method for long-tail data distribution described above, wherein the step of performing dual-path retrieval augmentation generation based on the target subset range and the target topic terms to obtain corresponding target style samples and target topic samples includes:
[0038] The business dataset is subjected to a second preprocessing step to construct a vector database. Each database record in the vector database includes: text content, metadata, and vector representation.
[0039] Target style samples that match the target subset range are selected from the vector database by metadata filtering.
[0040] Using the target keyword as the query vector, perform a full-database semantic search to obtain the target topic sample with the highest relevance to the target keyword.
[0041] Specifically, the sample augmentation method for long-tail data distribution described above, wherein generating thought chain samples based on the target style sample and the target topic sample to obtain the augmented target sample includes:
[0042] The basic parameters of the large language model are pre-defined, including: identity information, responsibility information, and sample generation requirements;
[0043] Guided by the thought chain, the large language model performs a preset inference process on the target style sample and the target topic sample to obtain the inference result.
[0044] The target sample is generated based on the reasoning result.
[0045] Secondly, this application provides a control device, comprising:
[0046] The first preprocessing module is used to perform first preprocessing on the text data in the business dataset to obtain at least one potential Dirichlet distribution topic model and corresponding result parameters after preprocessing.
[0047] The sparse query module is used to execute an online sparse query strategy corresponding to the query type input by the user based on the processed latent Dirichlet distribution subject model and the result parameters, so as to obtain the target topic words and target subset range corresponding to the user input. The online sparse query strategy includes: a subset-based sparse topic identification strategy and a topic word-based sparse subset identification strategy.
[0048] The retrieval module is used to perform a dual-path parallel retrieval based on the target subset range and the target topic words to obtain the corresponding target style samples and target topic samples;
[0049] The sample generation module is used to generate thought chain samples based on the target style sample and the target topic sample to obtain the enhanced target sample.
[0050] Thirdly, this application provides an electronic device, including: a processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the sample augmentation method for long-tailed data distribution as described above.
[0051] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the sample augmentation method for long-tailed data distribution as described above.
[0052] Fifthly, this application provides a computer program product including computer instructions that, when executed by a processor, implement the steps of the sample augmentation method for long-tailed data distributions as described above.
[0053] Compared with existing technologies, the sample augmentation method, apparatus, and storage medium for long-tail data distribution provided in this application, through an architecture of "offline preprocessing + online adaptation," achieves rapid and accurate identification of long-tail topics in data subsets under arbitrary dimensional combinations. Simultaneously, it can identify sparse ranges based on topic reverse localization, improving the targeting and coverage completeness of data augmentation. Furthermore, by effectively integrating structured metadata retrieval and semantic content retrieval through dual-path retrieval enhancement generation and thought chain sample generation, it ensures that the contextual information provided to the large model possesses both the business style of the target subset and is rich in professional content of the core topic, greatly improving the quality, relevance, and authenticity of the generated samples. Attached Figure Description
[0054] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0055] Figure 1 This is one of the flowcharts illustrating the sample augmentation method for long-tailed data distribution proposed in this application;
[0056] Figure 2 This is the second flowchart illustrating the sample augmentation method for long-tailed data distribution proposed in this application.
[0057] Figure 3 This is the third flowchart illustrating the sample augmentation method for long-tailed data distribution proposed in this application;
[0058] Figure 4 This is the fourth flowchart illustrating the sample augmentation method for long-tailed data distribution proposed in this application.
[0059] Figure 5 This is the fifth flowchart illustrating the sample augmentation method for long-tailed data distribution proposed in this application.
[0060] Figure 6 This is the sixth flowchart illustrating the sample augmentation method for long-tailed data distribution proposed in this application.
[0061] Figure 7 This is the seventh flowchart illustrating the sample augmentation method for long-tailed data distribution proposed in this application.
[0062] Figure 8 This is the eighth flowchart illustrating the sample augmentation method for long-tailed data distribution proposed in this application.
[0063] Figure 9 This is the ninth flowchart illustrating the sample augmentation method for long-tailed data distribution proposed in this application;
[0064] Figure 10 This is a schematic diagram of the control device of this application;
[0065] Figure 11 This is a schematic diagram of the electronic device of this application. Detailed Implementation
[0066] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the present application to those skilled in the art.
[0067] The terms “first,” “second,” etc., used in the specification and claims of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus. The terms “and / or” in the specification and claims indicate at least one of the connected objects.
[0068] Please refer to Figure 1 This application provides a sample augmentation method for long-tailed data distribution, including:
[0069] Step S101: Perform a first preprocessing on the text data in the business dataset to obtain at least one preprocessed potential Dirichlet distribution topic model and corresponding result parameters.
[0070] Step S102: Based on the processed latent Dirichlet distribution subject model and the result parameters, execute an online sparse query strategy corresponding to the query type input by the user to obtain the target topic words and target subset range corresponding to the user input. The online sparse query strategy includes: a subset-based sparse topic identification strategy and a topic word-based sparse subset identification strategy.
[0071] Step S103: Based on the target subset range and the target topic words, perform dual-path retrieval enhancement generation to obtain the corresponding target style samples and target topic samples;
[0072] Step S104: Based on the target style sample and the target topic sample, generate a thought chain sample to obtain an enhanced target sample.
[0073] In this embodiment, to address the issue of long-tail data distribution and to perform data augmentation (i.e., sample augmentation), the textual data in the business dataset undergoes initial preprocessing to obtain at least one latent Dirichlet distribution topic model and its corresponding parameters. Subsequent processing can then use this latent Dirichlet distribution topic model and parameters as a basis for retrieval, avoiding costly real-time modeling and thus improving query efficiency and saving resources. Upon receiving user input, an online sparse query strategy (either subset-based sparse topic identification or keyword-based sparse subset identification) is executed based on the processed latent Dirichlet distribution topic model and parameters to obtain the target keywords and target subset range corresponding to the user input. This achieves accurate positioning of long-tail demands. Furthermore, keyword-based sparse subset identification facilitates reverse identification between topics and subsets, effectively locating areas with missing topics in the dataset, thereby improving the targeting and coverage completeness of data augmentation.
[0074] After obtaining the target keywords and target subset range based on user needs, a dual-path retrieval enhancement generation is performed based on both keywords and the target subset range. This effectively integrates structured metadata retrieval and semantic content retrieval, ensuring that the contextual information provided to the large model possesses both the business style of the target subset and rich professional content of the core topic. Subsequently, thought chain samples are generated based on the retrieval results. By combining thought chain prompts for guidance, the quality, relevance, and authenticity of the generated samples can be greatly improved.
[0075] See Figure 2Specifically, the sample augmentation method for long-tail data distribution described above, wherein the first preprocessing of the business dataset to obtain at least one preprocessed latent Dirichlet distribution topic model and corresponding result parameters includes:
[0076] Step S201: Determine reference query conditions based on historical query information or business experience;
[0077] Step S202: Based on the reference query conditions, at least one corresponding first reference data subset is selected from the business dataset;
[0078] Step S203: Perform at least one process of latent Dirichlet distribution topic modeling on at least one subset of the first reference data to obtain at least one corresponding latent Dirichlet distribution topic model and result parameters, and store them in a structured form.
[0079] In this embodiment, the first preprocessing operation described above is illustrated. Firstly, based on the user's historical query information (historical query logs) or business experience, reference query conditions are determined based on the user's most frequent or most likely queries. These reference query conditions include: dimension combinations and subspace coordinates, such as [Location - Beijing, Year - 2025, Month - 7], [Product Category - Mobile Phone, Customer Type - Retail, Channel - Online], etc. For each subspace, based on the subspace coordinates, all matching text data are filtered from the dataset to form at least one first reference data subset. In another embodiment, a data volume threshold can also be set to avoid meaningless modeling of small samples. For example, a minimum number of documents can be set (e.g., ...). Each document contains matching text data, and if a first reference data subset contains fewer than this threshold of documents, modeling it is abandoned.
[0080] To efficiently train a latent Dirichlet distribution (LDD) topic model on the selected first reference data subset, a separate process is launched for the first reference data subset, and a dedicated Graphics Processing Unit (GPU) is allocated to run the training task. Multiple processes are launched concurrently using multiprocessing or a similar library, each responsible for modeling the LDD for one dataset (i.e., the first reference data subset). Each process internally sets the corresponding environment variable `CUDA_VISIBLE_DEVICES` or device index, ensuring it only requires specifying the GPU. By performing multi-process LDD topic modeling, the LDD topic model and resulting parameters for each first reference data subset can be obtained and stored in a structured format for easy subsequent retrieval.
[0081] See Figure 3 Preferably, in the sample augmentation method for long-tailed data distributions as described above, the step of performing at least one process of latent Dirichlet distribution topic modeling on at least one first reference data subset to obtain at least one corresponding latent Dirichlet distribution topic model and result parameters includes:
[0082] Step S301: Perform data preprocessing on the text data in the first reference data subset to obtain the processed text data;
[0083] Step S302: Train the model based on the processed text data and the preset number of topics to obtain the corresponding latent Dirichlet distribution topic model and the result parameters. The result parameters include the initialization parameters required for modeling, including the document-topic distribution and topic-word distribution matrix.
[0084] In this embodiment, the latent Dirichlet distribution topic modeling process described above is illustrated. First, the text data of the first reference data subset undergoes preprocessing, including word segmentation, stop word removal, lexical reconstruction / stemming, etc. Then, a latent Dirichlet distribution model is trained based on the processed text data and a preset number of topics. This yields the required latent Dirichlet distribution topic model and its parameters. The preset number of topics can be an empirical value, such as k=10, or it can be optimized by performing consistency score tests on a subset of sample data. For each trained model, the output of the latent Dirichlet distribution topic model includes document-topic distribution, a K x W "topic-word distribution" matrix, and other parameters required for incremental modeling.
[0085] See Figure 4 Preferably, in the sample augmentation method for long-tail data distribution described above, when the user-input query type is a query subset range, the step of executing an online sparse query strategy corresponding to the user-input query type based on the processed latent Dirichlet distribution principal model and the result parameters to obtain the target keywords and target subset range corresponding to the user input includes:
[0086] Step S401: Match the query subset range with the first reference data subset;
[0087] Step S402: If there exists a first reference data subset that matches the range of the query subset, then the topic word with the lowest distribution probability in the potential Dirichlet distribution topic model of the matched first reference data subset is determined as the target topic word, and the range of the matched query subset is determined as the target subset range.
[0088] Step S403: If there is no first reference data subset that matches the range of the query subset, then at least one second reference data subset is obtained from the first reference data subset based on a constrained greedy selection algorithm.
[0089] Step S404: The second reference data subset is processed according to the incremental topic modeling algorithm to obtain the target potential Dirichlet distribution topic model.
[0090] Step S405: Determine the topic word with the lowest distribution probability as the target topic word based on the target potential Dirichlet distribution topic model, and determine the query subset range as the target subset range.
[0091] In this embodiment, the steps for performing online sparse query when the user input is a range of query subsets are exemplified. Since some latent Dirichlet distribution topic models have been performed beforehand, it is first determined whether there exists a subset in the modeled first reference data subset that matches the input query self-check range. If so, the topic word with the lowest distribution probability in the latent Dirichlet distribution topic model of the matching first reference data subset is directly determined as the desired target topic word. The target subset range at this point is the range of the input query subset. If not, at least one second reference data subset is obtained from the first reference data subset based on a constrained greedy selection algorithm. This second reference data subset is a selected first reference data subset, ensuring it covers the user's query target subset range to the greatest extent possible.
[0092] Then, based on the incremental topic modeling algorithm, online incremental topic modeling is performed on the latent Dirichlet distribution topic model corresponding to the second reference data subset, i.e., merging the latent Dirichlet distribution topic models to obtain the required target latent Dirichlet distribution topic model. Further, the topic words with the lowest distribution probability determined based on the target latent Dirichlet distribution topic model are the required target topic words. Similarly, the range of the query subset input by the user is the range of the required target subset. This achieves rapid and accurate identification of "long-tail topics" in data subsets under arbitrary dimensional combinations, ensuring efficient and flexible location of sparse topic regions requiring sample augmentation in big data environments. By combining the greedy covering algorithm with the latent Dirichlet distribution model merging / incremental update technique, rapid and accurate identification of "long-tail topics" in data subsets under arbitrary dimensional combinations is achieved.
[0093] See Figure 5 Specifically, in the sample augmentation method for long-tailed data distribution described above, the constraint-based greedy selection algorithm for obtaining at least one second reference data subset from the first reference data subset includes:
[0094] Step S501: Based on the first reference data subset, determine a plurality of first subset combinations, wherein the first subset combination includes at least one of the first reference data subsets;
[0095] Step S502: Based on the marginal contribution, determine at least one second subset combination from multiple first subset combinations where the data coverage rate is greater than a first preset value and the data overflow rate is less than a second preset value;
[0096] Step S503: Determine a third subset combination from at least one second subset combination that has the highest data coverage and the lowest data overshoot, and determine the first reference data subset in the third subset combination as the second reference data subset.
[0097] In this embodiment, when obtaining the second reference data subset, the first reference data subsets are first combined to obtain multiple first subset combinations, and each first subset combination includes at least one first reference data subset. This combination operation allows the first subset combinations to cover the query subset range to the greatest extent possible. Further, two indicators are obtained: the data coverage rate and the data overflow rate of the first subset combinations relative to the query subset range. These are used as the basis for a greedy decision to ensure maximum coverage while satisfying constraints. Based on marginal contribution, the combination with the highest data coverage rate (greater than a first threshold) and the highest data overflow rate (less than a second threshold) among the first subset combinations is selected as the second subset combination. In a specific embodiment, this involves: first initializing the relevant sets (including but not limited to: uncovered set, covered set, and selected subset set); then continuously selecting the first reference data subset that brings the greatest "marginal contribution" (i.e., the subset with the most uncovered parts in the uncovered set) until the coverage rate meets the requirements. Specifically, this can be... Furthermore, by comparing the data coverage and data overflow rates in different combinations of the second subsets, the combination with the highest data coverage (e.g., closest to 100%) and the lowest data overflow rate is determined as the third subset combination. The first reference data subset in this third subset combination is then determined as the required second reference data subset. This achieves optimal approximate coverage of the user query while ensuring accuracy.
[0098] It should be noted that, in a specific embodiment, a weighted sum can be calculated based on the data coverage and data excess rate corresponding to the same second subset combination, and a judgment can be made based on the sum value, for example, determining the second subset combination with the largest sum value as the third subset combination.
[0099] See Figure 6 Specifically, in the sample augmentation method for long-tailed data distribution described above, the step of processing the second reference data subset according to the incremental topic modeling algorithm to obtain the target latent Dirichlet distribution topic model includes:
[0100] Step S601: Determine the third reference data subset with the largest data volume from the second reference data subset, and use the potential Dirichlet distribution topic model corresponding to the third reference data subset as the base model;
[0101] Step S602: Take the other second reference data subsets besides the third reference data subset as incremental data and input them into the base model in batches. Use the online variational Bayes algorithm to update the base model to obtain the target latent Dirichlet distribution topic model.
[0102] In this embodiment, the steps for obtaining the target latent Dirichlet distribution topic model based on the incremental topic modeling algorithm are illustrated. First, based on the data volume of each second reference data subset, the second reference data subset with the largest data volume is determined as the third reference data subset and used as the base model for incremental topic modeling. Then, the other second reference data subsets besides the third reference data subset are used as incremental data. By inputting the incremental data in batches, the incremental data is divided into small batches and gradually input into the base model for training. The topic-word distribution in the base model is updated using an online variational Bayes algorithm. Thus, the target latent Dirichlet distribution topic model that can characterize the merged dataset, i.e., all second reference data subsets, is obtained.
[0103] It should be noted that, in another embodiment, if the second subset combination described above does not exist, online modeling is performed to obtain the target latent Dirichlet distribution topic model. Since the method of online modeling has been disclosed in the prior art, it will not be described in detail here.
[0104] See Figure 7 Preferably, in the sample augmentation method for long-tail data distribution described above, when the user input query type is a query topic term, the step of executing an online sparse query strategy corresponding to the user input query type based on the processed latent Dirichlet distribution principal model and the result parameters to obtain the target topic terms and target subset range corresponding to the user input includes:
[0105] Step S701: Obtain the similarity between the query keywords and the first reference data subset;
[0106] Step S702: Construct a hierarchical tree structure based on the business dataset and preset data dimensions, where each leaf node of the tree structure corresponds to a subset of data.
[0107] Step S703: Starting from the leaf node whose similarity is lower than a preset threshold, explore the adjacent leaf nodes at the same level in a loop, and determine all leaf nodes that are not related to the query topic.
[0108] Step S704: Aggregate the states of all unrelated leaf nodes upwards, and determine the correlation of the nodes at the next higher level in turn according to the veto rule, until the correlation of the root node is obtained.
[0109] Step S705: Determine the subset range corresponding to the root node whose relevance is not relevant as the target subset range, and determine the query keyword as the target keyword.
[0110] In this embodiment, the steps of performing online sparse query when the user input is a query keyword are exemplified. Through topic alignment and a light sampling algorithm of "boundary exploration and verification", all subset ranges in the dataset that are not related to the keyword can be systematically and completely found.
[0111] First, the similarity between the input query terms and the first reference data subset is obtained. This involves aligning the query terms with the terms in the first reference subset to determine the relevance between each first reference data subset and the query terms. At this point, the first reference data subset can be divided into relevant and irrelevant subsets. In one specific embodiment, this involves comparing the query terms with all topic-word distributions in each potential Dirichlet distribution topic model one by one. By calculating the cosine similarity, the relevance between the topic of each first reference data subset and the query terms is evaluated. If the similarity is less than a preset similarity threshold (e.g., 0.4), the corresponding first reference data subset is determined to be irrelevant to the query terms; otherwise, the corresponding first reference data subset is determined to be relevant to the query terms.
[0112] Furthermore, through "boundary exploration and verification," leveraging the hierarchical structure of dimensions and the "seed" role of unrelated first reference data subsets, all data regions unrelated to the query keywords can be effectively identified and expanded. Specifically, a hierarchical tree structure is constructed based on business data subsets and preset data dimensions, with each leaf node corresponding to a first reference data subset. In a specific embodiment, for example, a table (business dataset) contains four dimensions: region, product category, customer type, and channel. First, a fixed order of data dimensions is determined. For example, the chosen order is: region, product category, customer type, channel. Based on this order, a tree structure is constructed. Root node (Level 0): Represents the entire dataset. First-level nodes (Level 1): Represent subsets divided by the first dimension (region). For example: {region: Europe}, {region: Asia Pacific}, {region: North America}. Second-level nodes (Level 2): Based on the first level, further divided by the second dimension (product category). For example, the node {Region: Asia Pacific} has child nodes: {Region: Asia Pacific, Product: Home Appliances}, {Region: Asia Pacific, Product: Electronics}, {Region: Asia Pacific, Product: Apparel}. This continues down to the bottom-level leaf nodes, which represent the finest-grained subsets (all dimensions are specified).
[0113] Then, starting with the leaf nodes whose similarity is below a preset threshold (i.e., the irrelevant first reference data subset), the system iteratively explores adjacent leaf nodes at the same level and identifies all leaf nodes that are irrelevant to the query keywords. Specifically, during the exploration process, if an unvisited neighbor node (adjacent leaf node) is encountered, its relevance to the query keywords is quickly verified through incremental modeling or lightweight word frequency statistics. If it is still irrelevant, the system continues to expand; otherwise, the expansion is terminated. At this point, some lightweight samples can be selected at a certain granularity near the already modeled subset. Lightweight samples are small batches of data samples that can be processed with low computational overhead and provide effective information for constructing a potential Dirichlet distribution model.
[0114] Then, all unrelated leaf nodes are aggregated upwards, and the relevance of the nodes at the next higher level is determined according to the veto rule until the relevance of the root node is obtained. Finally, based on the relevance of the root node, the subset range corresponding to the unrelated root node is determined as the target subset range, and the query keyword is determined as the target keyword.
[0115] The aforementioned reverse lookup mechanism is lacking in existing technologies. It traces back to the "inapplicable scope" from the perspective of "topic", providing a new dimension for data augmentation. It is especially suitable for scenarios that need to supplement negative samples or generate data in specific business blind spots, significantly improving the targeting and coverage completeness of data augmentation.
[0116] See Figure 8 Specifically, the sample augmentation method for long-tail data distribution described above, wherein the step of performing dual-path retrieval augmentation generation based on the target subset range and the target topic terms to obtain corresponding target style samples and target topic samples includes:
[0117] Step S801: Perform a second preprocessing on the business dataset to construct a vector database. Each database record in the vector database includes: text content, metadata, and vector representation.
[0118] Step S802: Target style samples matching the target subset range are selected from the vector database through metadata filtering.
[0119] Step S803: Perform a full-database semantic search using the target keyword as the query vector to obtain the target topic sample with the highest relevance to the target keyword.
[0120] In this embodiment, the steps for dual-path retrieval enhancement are illustrated, specifically including: performing a second preprocessing on the business dataset to construct a vector database. That is, by performing a second preprocessing on the raw data in the business dataset, each market review text and its corresponding dimensional information (such as region, year, product category, etc.) are treated as an independent knowledge document. This document is then converted into a high-dimensional vector using a high-quality text embedding model (such as Bidirectional Encoder Representations from Transformers (BERT) or Sentence-BERT) and stored in a vector database (such as Pinecone, Faiss, etc.). Each database record simultaneously contains text content, metadata, and vector representation, thereby constructing a structured, semantically efficient "subset knowledge base" that provides a foundation for subsequent intelligent retrieval.
[0121] Then, a two-pronged parallel retrieval strategy is employed using Retrieval-Augmented Generation (RAG): one path uses metadata filtering to precisely select real samples (i.e., target style samples) from the knowledge base (i.e., vector database) that perfectly match the target subset, capturing the writing style and expression habits of the target business unit; the other path uses the target keyword as the query vector to perform a full-database semantic search, extracting the most relevant market commentary texts (i.e., topic samples) to help the large language model learn the actual expression of the keyword within the enterprise. By combining these two sample paths, rich materials that are both contextually relevant and topic-specific can be provided for downstream sample generation.
[0122] See Figure 9 Specifically, the sample augmentation method for long-tail data distribution described above, wherein generating thought chain samples based on the target style sample and the target topic sample to obtain the augmented target sample includes:
[0123] Step S901: Pre-set the basic parameters of the large language model, including: identity information, responsibility information, and sample generation requirements;
[0124] Step S902: Guided by the thought chain, the large language model performs a preset inference process on the target style sample and the target topic sample to obtain the inference result;
[0125] Step S903: Generate the target sample based on the reasoning result.
[0126] This embodiment illustrates the steps for generating thought chain samples. Applying thought chains to sample generation ensures that the generated results not only conform to the context and style and are closely related to the topic, but also possess high quality and logical rigor. It provides a clear thinking path and checklist for the large language model, enabling it to reason step-by-step like a human, thereby generating more accurate and reliable samples. Specifically, firstly, the basic parameters of the large language model are pre-set through the role setting model and task goal module, such as identity information, responsibility information, and sample generation requirements. Then, the target style sample and target topic sample obtained above are structured input as the basis for reasoning through the input loading module. Finally, the core thought chain reasoning instruction module guides the large language model to execute a pre-set reasoning process of style extraction, content understanding, content conception, and self-verification, and to perform step-by-step reasoning, thereby significantly improving sample quality. Finally, the expected format and quantity of the generated results defined by the output specification module are used to generate target samples based on the reasoning results, ensuring the standardization and usability of the target samples.
[0127] The above describes the processing flow for textual data. Since multidimensional datasets also include numerical data, the processing flow for numerical data is illustrated in another embodiment of this application.
[0128] First, list all the categorical dimensions in the business dataset used to filter subsets (such as region, product category, customer type, channel), and identify the numerical data dimensions whose distribution you might want to analyze (e.g., meaningful numerical data such as sales, sales volume, or profit).
[0129] Then, the continuous values are discretized by using equal-width binning or equal-frequency binning, and converted into a finite number of bins.
[0130] Next, each row of the original dataset is traversed. For each row, its coordinates in the data cube are determined based on the data storage location (e.g., data bucket) where its values for each dimension fall, and the value of the cell corresponding to that coordinate is incremented by one. Since users may query by any combination of dimensions, the aggregation results need to be pre-calculated for all possible dimension combinations. Therefore, in each traversal, logic similar to the GROUP BY CUBE syntax in Structured Query Language (SQL) used to generate multidimensional data cube aggregations is also used to calculate the aggregations at all levels, generating a large table containing the aggregation results of all subsets. This table is then serialized and stored in a file, thus constructing the data cube.
[0131] When a user enters a query condition (e.g., subset range), the user's query condition is converted into coordinates or indices in the data cube. The numerical distribution vector corresponding to this subset range is extracted directly from the pre-calculated data cube, and the numerical range of the data storage location (data bucket) corresponding to the minimum count value is returned to the user as the result.
[0132] The various methods of the embodiments of this application have been described above. Apparatus for implementing the above methods will now be provided.
[0133] Please refer to Figure 10 Another embodiment of this application provides a control device, including:
[0134] The first preprocessing module 1001 is used to perform first preprocessing on the text data in the business dataset to obtain at least one potential Dirichlet distribution topic model and corresponding result parameters after preprocessing.
[0135] The sparse query module 1002 is used to obtain the target topic words and target subset range corresponding to the user input by adopting the corresponding online sparse query strategy according to the query type input by the user. The online sparse query strategy includes: a subset-based sparse topic identification strategy and a topic word-based sparse subset identification strategy.
[0136] The retrieval module 1003 is used to execute an online sparse query strategy corresponding to the query type input by the user based on the processed latent Dirichlet distribution subject model and the result parameters, so as to obtain the target topic words and target subset range corresponding to the user input. The online sparse query strategy includes: a subset-based sparse topic identification strategy and a topic word-based sparse subset identification strategy.
[0137] The sample generation module 1004 is used to generate thought chain samples based on the target style sample and the target topic sample to obtain the enhanced target sample.
[0138] Specifically, in the control device described above, the first preprocessing module includes:
[0139] The first sub-processing module is used to determine reference query conditions based on historical query information or business experience;
[0140] The second sub-processing module is used to filter at least one corresponding first reference data subset from the business dataset according to the reference query conditions;
[0141] The third sub-processing module is used to perform at least one process of latent Dirichlet distribution topic modeling on at least one subset of the first reference data to obtain at least one corresponding latent Dirichlet distribution topic model and result parameters, and store them in a structured form.
[0142] Preferably, in the control device described above, the third sub-processing module is used to include:
[0143] The first processing unit is used to preprocess the text data in the first reference data subset to obtain the processed text data.
[0144] The second processing unit is used to train the corresponding latent Dirichlet distribution topic model and the result parameters based on the processed text data and the preset number of topics. The result parameters include the initialization parameters required for modeling, including the document-topic distribution and the topic-word distribution matrix.
[0145] Preferably, in the control device described above, when the user input is a range of query subsets, the sparse query module includes:
[0146] The fourth sub-processing module is used to match the query subset range with the first reference data subset;
[0147] The fifth sub-processing module is used to determine the topic word with the lowest distribution probability in the potential Dirichlet distribution topic model of the first reference data subset that matches the query subset range as the target topic word if there exists a first reference data subset that matches the query subset range; and to determine the query subset range that matches the first reference data subset as the target subset range.
[0148] The sixth sub-processing module is used to obtain at least one second reference data subset from the first reference data subset based on a constrained greedy selection algorithm if there is no first reference data subset that matches the range of the query subset.
[0149] The seventh sub-processing module is used to process the second reference data subset according to the incremental topic modeling algorithm to obtain the target potential Dirichlet distribution topic model;
[0150] The eighth sub-processing module is used to determine the topic word with the lowest distribution probability as the target topic word based on the target potential Dirichlet distribution topic model, and to determine the query subset range as the target subset range.
[0151] Specifically, in the control device described above, the sixth sub-processing module includes:
[0152] The third processing unit is configured to determine multiple combinations of first subsets based on the first reference data subset, wherein the first subset combination includes at least one of the first reference data subsets.
[0153] The fourth processing unit is configured to determine, based on marginal contribution, at least one second subset combination from multiple combinations of the first subset combinations, where the data coverage rate is greater than a first preset value and the data overflow rate is less than a second preset value;
[0154] The fifth processing unit is configured to determine, from at least one of the second subset combinations, a third subset combination that has the highest data coverage and the lowest data overage rate, and to determine the first reference data subset in the third subset combination as the second reference data subset.
[0155] Specifically, in the control device described above, the seventh sub-processing module includes:
[0156] The sixth processing unit is used to determine the third reference data subset with the largest data volume from the second reference data subset, and to use the potential Dirichlet distribution topic model corresponding to the third reference data subset as the base model;
[0157] The seventh processing unit is used to take the other second reference data subsets besides the third reference data subset as incremental data and input them into the base model in batches, and update the base model using an online variational Bayes algorithm to obtain the target latent Dirichlet distribution topic model.
[0158] Preferably, in the control device described above, when the user input is a query keyword, the sparse query module includes:
[0159] The ninth sub-processing module is used to obtain the similarity between the query topic words and the first reference data subset;
[0160] The tenth sub-processing module is used to construct a hierarchical tree structure based on the business dataset and preset data dimensions, wherein each leaf node of the tree structure corresponds to a data subset;
[0161] The eleventh sub-processing module is used to explore adjacent leaf nodes at the same level in a loop, starting from the leaf nodes whose similarity is lower than a preset threshold, and to determine all leaf nodes that are not related to the query topic.
[0162] The twelfth sub-processing module is used to aggregate the states of all unrelated leaf nodes upwards and determine the relevance of the upper-level nodes in turn according to the veto rule until the relevance of the root node is obtained.
[0163] The thirteenth sub-processing module is used to determine the subset range corresponding to the root node whose relevance is not relevant as the target subset range, and to determine the query keyword as the target keyword.
[0164] Specifically, in the control device described above, the retrieval module includes:
[0165] The fourteenth sub-processing module is used to perform a second preprocessing on the business dataset and construct a vector database. Each database record in the vector database includes: text content, metadata, and vector representation.
[0166] The fifteenth sub-processing module is used to filter target style samples that match the target subset range from the vector database through metadata filtering;
[0167] The sixteenth sub-processing module is used to perform a full-database semantic search using the target keyword as the query vector to obtain the target keyword sample with the highest relevance to the target keyword.
[0168] Specifically, in the control device described above, the sample generation module includes:
[0169] The seventeenth sub-processing module is used to pre-set the basic parameters of the large language model. The basic parameters include: identity information, responsibility information, and sample generation requirements.
[0170] The eighteenth sub-processing module is used to guide the large language model to perform a preset reasoning process on the target style sample and the target topic sample according to the thinking chain, and obtain the reasoning result;
[0171] The nineteenth sub-processing module is used to generate the target sample based on the reasoning result.
[0172] The apparatus embodiments of this application are apparatuses corresponding to the embodiments of the methods described above. All implementation means in the method embodiments described above are applicable to the apparatus embodiments and can achieve the same technical effects. The apparatus provided in this application embodiments can implement all the method steps implemented in the method embodiments described above and can achieve the same technical effects. Therefore, the parts and beneficial effects that are the same as those in the method embodiments in this embodiment will not be described in detail here.
[0173] See Figure 11 Preferably, another embodiment of this application provides an electronic device 11, including: a processor 1101, a memory 1102 and a program stored in the memory 1102 and executable on the processor 1101. When the program is executed by the processor 1101, it implements the steps of the sample augmentation method for data long-tail distribution as described above and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0174] Preferably, another embodiment of this application provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the steps of the sample augmentation method for long-tailed data distribution described above, achieving the same technical effect. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0175] Preferably, another embodiment of this application provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the sample augmentation method for long-tailed data distribution as described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0176] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0177] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0178] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A sample augmentation method for long-tailed data distribution, characterized in that, include: The text data in the business dataset is preprocessed to obtain at least one potential Dirichlet distribution topic model and the corresponding result parameters. Based on the processed latent Dirichlet distribution principal model and the result parameters, an online sparse query strategy corresponding to the query type input by the user is executed to obtain the target topic words and target subset range corresponding to the user input. The online sparse query strategy includes: a subset-based sparse topic identification strategy and a topic word-based sparse subset identification strategy. Based on the target subset range and the target keywords, a dual-path retrieval enhancement generation is performed to obtain the corresponding target style samples and target topic samples; Based on the target style sample and the target topic sample, a thought chain sample is generated to obtain the enhanced target sample.
2. The sample augmentation method for long-tailed data distribution according to claim 1, characterized in that, The first preprocessing of the business dataset yields at least one preprocessed potential Dirichlet distribution topic model and corresponding result parameters, including: Determine the reference query conditions based on historical query information or business experience; Based on the reference query conditions, at least one corresponding first reference data subset is selected from the business dataset; At least one process of latent Dirichlet distribution topic modeling is performed on at least one subset of the first reference data to obtain at least one corresponding latent Dirichlet distribution topic model and result parameters, which are then stored in a structured form.
3. The sample augmentation method for long-tailed data distribution according to claim 2, characterized in that, The step of performing at least one process of latent Dirichlet distribution topic modeling on at least one subset of the first reference data to obtain at least one corresponding latent Dirichlet distribution topic model and result parameters includes: The text data in the first reference data subset is preprocessed to obtain the processed text data; The text data is trained based on the processed data and the preset number of topics to obtain the corresponding latent Dirichlet distribution topic model and the result parameters. The result parameters include the initialization parameters required for modeling, including the document-topic distribution and topic-word distribution matrix.
4. The sample augmentation method for long-tailed data distribution according to claim 2, characterized in that, When the user-input query type is a query subset range, the online sparse query strategy corresponding to the user-input query type is executed based on the processed latent Dirichlet distribution principal model and the result parameters to obtain the target keywords and target subset range corresponding to the user input, including: Matching is performed based on the range of the query subset and the first reference data subset; If there exists a first reference data subset that matches the range of the query subset, then the topic word with the lowest distribution probability in the potential Dirichlet distribution topic model of the matched first reference data subset is determined as the target topic word, and the range of the matched query subset is determined as the target subset range; If there is no first reference data subset that matches the range of the query subset, then at least one second reference data subset is obtained from the first reference data subset based on a constrained greedy selection algorithm. Based on the incremental topic modeling algorithm, the second reference data subset is processed to obtain the target potential Dirichlet distribution topic model; Based on the target potential Dirichlet distribution topic model, the topic word with the lowest distribution probability is determined as the target topic word, and the range of the query subset is determined as the target subset range.
5. The sample augmentation method for long-tailed data distribution according to claim 4, characterized in that, The constrained greedy selection algorithm obtains one or more second reference data subsets from the first reference data subset, including: Based on the first reference data subset, a plurality of first subset combinations are determined, wherein each first subset combination includes at least one of the first reference data subsets; Based on the marginal contribution, at least one second subset combination is determined from multiple combinations of the first subset combinations, where the data coverage rate is greater than a first preset value and the data overflow rate is less than a second preset value; From at least one of the second subset combinations, determine a third subset combination that has the highest data coverage and the lowest data overage, and determine the first reference data subset in the third subset combination as the second reference data subset.
6. The sample augmentation method for long-tailed data distribution according to claim 4, characterized in that, The step of processing the second reference data subset according to the incremental topic modeling algorithm to obtain the target potential Dirichlet distribution topic model includes: Determine the third reference data subset with the largest data volume from the second reference data subset, and use the potential Dirichlet distribution topic model corresponding to the third reference data subset as the base model; The other subsets of the second reference data, excluding the third reference data subset, are used as incremental data and input into the base model in batches. The base model is then updated using an online variational Bayesian algorithm to obtain the target latent Dirichlet distribution topic model.
7. The sample augmentation method for long-tailed data distribution according to claim 2, characterized in that, When the user-input query type is a query keyword, the online sparse query strategy corresponding to the user-input query type is executed based on the processed latent Dirichlet distribution principal model and the result parameters to obtain the target keyword and target subset range corresponding to the user input, including: Obtain the similarity between the query keywords and the first reference data subset; A hierarchical tree structure is constructed based on the business dataset and preset data dimensions, where each leaf node of the tree structure corresponds to a subset of data. Starting with the leaf node whose similarity is lower than a preset threshold, explore the adjacent leaf nodes at the same level in a loop, and determine all leaf nodes that are not related to the query topic. Aggregate the states of all unrelated leaf nodes upwards, and determine the relevance of the nodes at the next higher level in turn according to the veto rule, until the relevance of the root node is obtained. The subset range corresponding to the root node whose relevance is determined to be unrelated is the target subset range, and the query keyword is determined to be the target keyword.
8. The sample augmentation method for long-tailed data distribution according to claim 1, characterized in that, The step of performing dual-path retrieval enhancement generation based on the target subset range and the target topic terms to obtain corresponding target style samples and target topic samples includes: The business dataset is subjected to a second preprocessing step to construct a vector database. Each database record in the vector database includes: text content, metadata, and vector representation. Target style samples that match the target subset range are selected from the vector database by metadata filtering. Using the target keyword as the query vector, perform a full-database semantic search to obtain the target topic sample with the highest relevance to the target keyword.
9. The sample augmentation method for long-tailed data distribution according to claim 1, characterized in that, The step of generating thought chain samples based on the target style sample and the target topic sample to obtain enhanced target samples includes: The basic parameters of the large language model are pre-defined, including: identity information, responsibility information, and sample generation requirements; Guided by the thought chain, the large language model performs a preset inference process on the target style sample and the target topic sample to obtain the inference result. The target sample is generated based on the reasoning result.
10. A control device, characterized in that, include: The first preprocessing module is used to perform first preprocessing on the text data in the business dataset to obtain at least one potential Dirichlet distribution topic model and corresponding result parameters after preprocessing. The sparse query module is used to execute an online sparse query strategy corresponding to the query type input by the user based on the processed latent Dirichlet distribution subject model and the result parameters, so as to obtain the target topic words and target subset range corresponding to the user input. The online sparse query strategy includes: a subset-based sparse topic identification strategy and a topic word-based sparse subset identification strategy. The retrieval module is used to perform a dual-path parallel retrieval based on the target subset range and the target topic words to obtain the corresponding target style samples and target topic samples; The sample generation module is used to generate thought chain samples based on the target style sample and the target topic sample to obtain the enhanced target sample.
11. An electronic device, characterized in that, include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the sample augmentation method for long-tailed data distributions as described in any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the sample augmentation method for long-tailed data distributions as described in any one of claims 1 to 9.
13. A computer program product, characterized in that, Includes computer instructions that, when executed by a processor, implement the steps of the sample augmentation method for long-tailed data distributions as described in any one of claims 1 to 9.