Method and device for generating visual data stories based on large language model
The method of generating visual data stories through large language models solves the problem of poor performance of large language models in data analysis. By generating and displaying data stories, the analysis effect and efficiency are improved.
Patent Information
- Application Number
- CN202410961796.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-17
AI Technical Summary
Large language models are less effective in data analysis, and the communication model is cumbersome. It relies on technical personnel's high level of analysis and questioning, and it is impossible to obtain complete inference analysis results at one time.
Through the method of generating visual data stories based on the large language model, determine the parent node data facts and expand the intermediate data facts, filter the target data facts, repeat the execution until the preset stop conditions are met, generate multiple data stories, and determine and display the goals based on the analysis scores Data stories.
It improves the effect of large language models in data analysis, displays data stories in a visual way, enhances the dimensionality and correlation of data, and reduces the analysis burden of technical personnel.
Smart Images

Figure CN118503410B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence large language models and prompt word engineering technology, and specifically to a method and device for generating visual data stories based on a large language model. Background Art
[0002] "Large language model" refers to a large language model (LLM), which is a language model with a large parameter scale. It is designed to understand and generate human language. It is trained with a large amount of text data and can perform a wide range of tasks including text summarization, translation, sentiment analysis, etc. The rapid development of large language model technology has brought new opportunities for economic and social development. How to realize the application of large language models is an issue that needs to be studied urgently.
[0003] At present, chat applications of large language models are usually in a question-and-answer mode, that is, a message is input, and the large language model outputs a corresponding reply message after processing. The communication mode is like squeezing toothpaste, and it is impossible to get a complete reasoning and analysis result at one time.
[0004] In the scenario of processing and analyzing large amounts of data, technicians usually use large language models and chat applications to generate analytical information of the data to be analyzed. Based on the analytical information, they manually think and then use the large model for the next step of analysis. This is repeated many times to obtain the expected trend of the data to be analyzed or the inference results obtained based on the analysis of the data to be analyzed. This process is not only cumbersome, but also depends on the technician's analysis and questioning level. Otherwise, the effect of data analysis based on the large language model is poor. Summary of the invention
[0005] The embodiments of the present application provide a method and device for generating a visual data story based on a large language model, so as to solve the problem in the related art that the effect of data analysis based on a large language model is poor.
[0006] To solve the above problems, this application is implemented as follows:
[0007] In a first aspect, an embodiment of the present application provides a method for generating a visual data story based on a large language model, including:
[0008] Step S1, determining a parent node data fact, and generating a plurality of intermediate data facts corresponding to the parent node data fact through a large language model, wherein the parent node data fact is a target data fact obtained by expanding the large language model, and the plurality of intermediate data facts have a logical relationship with the parent node data fact;
[0009] Step S2: screening the plurality of intermediate data facts by using the large language model to obtain a target data fact and an analysis score corresponding to the target data fact;
[0010] Step S3, repeatedly executing step S1 and step S2 until a preset stop condition is met, and obtaining multiple data stories, each of which includes at least two target data facts;
[0011] Step S4: determine a target data story based on the analysis scores corresponding to at least two target data facts included in each data story, and display the target data story.
[0012] Optionally, the step S1 includes:
[0013] Step S11, determining the parent node data fact;
[0014] Step S12: obtaining an extension prompt, and instructing the large language model to extend the parent node data fact through the extension prompt to obtain the multiple intermediate data facts.
[0015] Optionally, step S2 includes:
[0016] Step S21, acquiring all upper-level data facts of the plurality of intermediate data facts through the large language model, wherein all upper-level data facts are at least one target data fact expanded by the large language model;
[0017] Step S22, calculating the analysis score corresponding to the target intermediate data fact based on all the upper-level data facts and the target intermediate data fact through the large language model to obtain the analysis scores corresponding to all the intermediate data facts, wherein the target intermediate data fact is one of the multiple intermediate data facts;
[0018] Step S23: Set the intermediate data fact with the highest corresponding analysis score as the target data fact.
[0019] Optionally, the preset stop condition includes:
[0020] The number of target data facts included in the data story with the highest analysis score corresponding to the last data fact is equal to the first set number threshold; or,
[0021] The number of all target data facts obtained by expanding the large language model is equal to a second set number threshold.
[0022] Optionally, before step S1, the method further includes:
[0023] Step S4, obtaining a data set to be iterated and an initial prompt, and instructing the large language model to expand the data set to be iterated through the initial prompt to obtain an initial data fact;
[0024] The step S11 comprises:
[0025] Step S111: when the target data fact obtained by expanding the large language model only includes the initial data fact, determine the initial data fact as the parent node data fact.
[0026] Optionally, the step S11 further includes:
[0027] Step S112: when the target data fact obtained by expanding the large language model is a plurality of target data facts, obtaining the access times and analysis scores corresponding to the plurality of target data facts;
[0028] Step S113, calculating the upper confidence limit value of each target data fact based on the corresponding number of accesses and the analysis score;
[0029] Step S114: setting the target data fact with the highest confidence upper limit value among the multiple target data facts as the parent node data fact.
[0030] Optionally, the step S12 includes:
[0031] Step S121, obtaining an initial prompt, and generating the extended prompt based on the parent node data fact and the initial prompt through the large language model;
[0032] Step S122: instructing the large language model to expand the parent node data fact through the expansion prompt to obtain the multiple intermediate data facts.
[0033] Optionally, the step S22 includes:
[0034] Step S221, obtaining an initial prompt, and generating an evaluation prompt based on the initial prompt and the target intermediate data fact;
[0035] Step S222: instructing the large language model to calculate, based on all the superior data facts and the target intermediate data facts, an analysis score corresponding to the target intermediate data fact through the evaluation prompt.
[0036] Optionally, the step S222 specifically includes:
[0037] Instructing the large language model to calculate the analysis score corresponding to the target intermediate data fact based on the data fact type of the target intermediate data fact and the data fact types of all the upper-level data facts through the evaluation prompt; or
[0038] Instructing the large language model to calculate the analysis score corresponding to the target intermediate data fact based on the coverage of the target intermediate data fact relative to the data set to be iterated and the coverage of all the upper-level data facts relative to the data set to be iterated through the evaluation prompt; or
[0039] The evaluation prompt instructs the large language model to analyze the target intermediate data fact and all the upper-level data facts to obtain the target relationship types of the target intermediate data fact and all the upper-level data facts, and queries the relationship type mapping table based on the target relationship type to obtain the analysis score corresponding to the target intermediate data fact, wherein the relationship type mapping table includes analysis scores corresponding to different relationship types.
[0040] Optionally, before step S3, the method further includes:
[0041] Step S5, setting the access count corresponding to the target data fact obtained by the latest expansion to 1, and adding 1 to the access count corresponding to each target data fact in all parent data facts of the target data fact obtained by the latest expansion;
[0042] Step S6: Obtain the analysis scores corresponding to all the superior data facts, and when the analysis score corresponding to the target data fact obtained by the latest expansion is greater than or equal to the analysis scores corresponding to all the superior data facts, update the analysis scores corresponding to all the superior data facts to the analysis scores corresponding to the target data fact obtained by the latest expansion.
[0043] Optionally, step S4 includes:
[0044] Step S41, obtaining the analysis score corresponding to the target data fact at the end of each data story;
[0045] Step S42: setting the data story with the highest analysis score corresponding to the last target data fact as the target data story;
[0046] Step S43: display the target data story.
[0047] Optionally, the step S43 includes:
[0048] Step S431, generating a visualization chart corresponding to each of the at least two target data facts included in the target data story;
[0049] Step S432, generating a text analysis result of a coherent expression of at least two target data facts included in the target data story;
[0050] Step S433: display the visualization chart corresponding to each target data fact and the text analysis result.
[0051] In a second aspect, the embodiment of the present application further provides a device for generating a visual data story based on a large language model, including:
[0052] A first expansion module is used to determine a parent node data fact, and generate a plurality of intermediate data facts corresponding to the parent node data fact through a large language model, wherein the parent node data fact is a target data fact obtained by expanding the large language model, and the plurality of intermediate data facts have a logical relationship with the parent node data fact;
[0053] A screening module, configured to screen the plurality of intermediate data facts through the large language model to obtain a target data fact and an analysis score corresponding to the target data fact;
[0054] A second expansion module is used to repeatedly execute step S1 and step S2 until a preset stop condition is met, thereby obtaining a plurality of data stories, each of which includes at least two target data facts;
[0055] A determination module is used to determine a target data story based on the analysis scores corresponding to at least two target data facts included in each data story, and to display the target data story.
[0056] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the method for generating a visual data story based on a large language model as described in the first aspect above are implemented.
[0057] In a fourth aspect, an embodiment of the present application further provides a readable storage medium for storing a program, which, when executed by a processor, implements the steps in the method for generating a visual data story based on a large language model as described in the first aspect above.
[0058] In a fifth aspect, an embodiment of the present application further provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the steps of the method for generating a visual data story based on a large language model as described in the first aspect above.
[0059] In an embodiment of the present invention, a parent node data fact is determined by executing, and multiple intermediate data facts corresponding to the parent node data fact are generated by a large language model, and the multiple intermediate data facts are screened by the large language model to obtain a target data fact and an analysis score corresponding to the target data fact; the execution is repeated until a preset stop condition is met to obtain multiple data stories, each data story includes at least two data facts; then based on each data story including the analysis scores corresponding to at least two target data facts, the target data story is determined, so that the target data story is the data with the most dimensions among the multiple data stories, and then the target data story is displayed, thereby realizing data visualization, thereby effectively improving the effect of the large language model in performing data analysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0061] Figure 1 is a flowchart of a method for generating a visual data story based on a large language model provided in an embodiment of the present application;
[0062] Figure 2 It is a schematic diagram of data fact iteration provided by an embodiment of the present application;
[0063] Figure 3 It is a schematic diagram of data facts of a tree structure provided in an embodiment of the present application;
[0064] Figure 4 It is a schematic diagram of a visualization chart corresponding to the data facts provided in the embodiment of the present application;
[0065] Figure 5 It is a structural diagram of a device for generating a visual data story based on a large language model provided in an embodiment of the present application;
[0066] Figure 6 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0067] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0068] First, the technical terms involved in the present invention are explained below.
[0069] The "large language model" mentioned in the present invention refers to a large language model (LLM), which is a language model with a large parameter scale, which is designed to understand and generate human language, is trained with a large amount of text data, and can perform a wide range of tasks including text summarization, translation, sentiment analysis, etc. Among them, the large language model can be a large language model such as GPT4, GLM-4 or Llama-3.
[0070] The "data facts" described in the present invention refer to the real data information contained in the data set of the data to be analyzed. The data facts in the present invention can be obtained by expanding the data to be analyzed through a large language model, and the expanded data facts are data that conform to the actual situation. Optionally, different data facts can be different types of data facts, such as numerical data facts, difference data facts, extreme value data facts, proportion data facts, ranking data facts, trend data facts, or association data facts, etc.
[0071] Among them, numerical data facts include the exact values of data attributes retrieved under a set of specific conditions; difference data facts are used to characterize the comparison of any two data attributes or the same data attributes in time and space dimensions; extreme value data facts are used to characterize extreme data conditions of data attributes within a certain range; proportion data facts are used to characterize the proportion of selected data attributes in the specified initial data; ranking data facts are used to characterize the sorting of data according to the value of data attributes; trend data facts are used to characterize the overall trend of data over a period of time; and association data facts are used to characterize the relationship between two or more data attributes.
[0072] The "data story" described in the present invention refers to an orderly connection of a series of logically related data facts around a theme. Among them, the data story can be obtained by coherently expressing multiple data facts through pre-set conjunctions or connecting sentences. Through the data story, it is possible to display the data facts obtained by expanding the large language model from multiple dimensions.
[0073] The "dimension" in the present invention refers to the number of data facts and / or the number of types of data facts in the analysis results. It is understandable that the more data facts there are in a data story, the more dimensions the data story has; the more types of data facts there are in a data story, the more dimensions the data story has.
[0074] The "visualization" mentioned in the present invention refers to the display of data facts or data stories in the form of charts, wherein the chart types include tables, bar charts, pie charts, line charts, tree charts, etc., as well as highlighting of extreme values in the charts, etc.
[0075] See also Figure 1 , Figure 1 is a flowchart of a method for generating a visual data story based on a large language model provided in an embodiment of the present application, such as Figure 1 As shown, the following steps are included:
[0076] Step S1, determining a parent node data fact, and generating a plurality of intermediate data facts corresponding to the parent node data fact through a large language model, wherein the parent node data fact is a target data fact obtained by expanding the large language model, and the plurality of intermediate data facts have a logical relationship with the parent node data fact;
[0077] Step S2: screening the plurality of intermediate data facts by using the large language model to obtain a target data fact and an analysis score corresponding to the target data fact;
[0078] Step S3, repeatedly executing step S1 and step S2 until a preset stop condition is met, and obtaining multiple data stories, each of which includes at least two target data facts;
[0079] Step S4: determine a target data story based on the analysis scores corresponding to at least two target data facts included in each data story, and display the target data story.
[0080] In an embodiment of the present invention, a parent node data fact is determined by executing, and multiple intermediate data facts corresponding to the parent node data fact are generated by a large language model, and the multiple intermediate data facts are screened by the large language model to obtain a target data fact and an analysis score corresponding to the target data fact; the execution is repeated until a preset stop condition is met to obtain multiple data stories, each data story includes at least two data facts; then based on each data story including the analysis scores corresponding to at least two target data facts, the target data story is determined, so that the target data story is the data with the most dimensions among the multiple data stories, and then the target data story is displayed, thereby realizing data visualization, thereby effectively improving the effect of the large language model in performing data analysis.
[0081] In an embodiment of the present invention, the parent node data fact is a data fact that needs to be expanded by the large language model, and the multiple intermediate data facts are data facts obtained by the large language model expanding the parent node data fact. It should be noted that since the multiple intermediate data facts are obtained by the large language model expanding the parent node data fact, the multiple intermediate data facts have a logical relationship with the parent node data fact. Among them, the large language model expands the data facts, specifically, by expanding the data facts through preset prompt words to obtain the associated intermediate data facts.
[0082] In the embodiment of the present invention, multiple intermediate data facts can be obtained by expanding the parent node data fact through the large language model. Different intermediate data facts have different logical associations with the parent node data fact. By screening the target data facts from the multiple intermediate data facts, the target data facts that meet the logical association requirements are obtained, and then the data stories that meet the logical association requirements are obtained. The logical association requirements can be determined by pre-set prompt words or by extended prompt words.
[0083] In an embodiment of the present invention, since the parent node data facts expanded each time the large language model is different, after repeatedly executing steps S1 and S2, the logical relationships between the multiple target data facts obtained are also different. The multiple target data facts present a tree structure, and each target data fact has only one data fact at the previous level, but each data fact has one or more data facts at the next level, thereby forming multiple data stories, and each data story includes at least two data facts.
[0084] It should be noted that the data facts included in the same data story have a strong correlation, while the data facts included in different data stories have a weak correlation. Therefore, based on the analysis scores corresponding to at least two target data facts included in each data story, the target data story is determined. The correlation between the data facts in the target data story is higher, thereby improving the accuracy of the obtained target data story.
[0085] In an embodiment of the present invention, the analysis score is used to describe the expansion effect of the target data fact, and may be calculated based on the corresponding target data fact. For example, the analysis score is calculated based on the data coverage of the target data fact. The larger the data coverage, the higher the analysis score.
[0086] In one embodiment, step S1 includes:
[0087] Step S11, determining the parent node data fact;
[0088] Step S12: obtaining an extension prompt, and instructing the large language model to extend the parent node data fact through the extension prompt to obtain the multiple intermediate data facts.
[0089] In the embodiment of the present invention, a parent node data fact is determined, an extension prompt is obtained, and the extension prompt is used to instruct the large language model to extend the parent node data fact, so as to obtain multiple intermediate data facts.
[0090] The parent node data fact can be a data fact selected from multiple existing data facts, or, in the absence of existing data facts, a data fact directly expanded from the data to be analyzed. By selecting a data fact from multiple existing data facts as the parent node data fact, each data fact has one or more next-level data facts, thereby forming multiple data stories.
[0091] In an embodiment of the present invention, the extended prompt is used to describe the relevant information of the intermediate data fact obtained by expanding the parent node data fact, and the extended prompt is used to instruct the large language model to expand the parent node data fact to obtain multiple intermediate data facts. Optionally, the extended prompt includes at least one of the system role, reference information, data information, work objectives and methods, and output requirements.
[0092] Among them, the system role is used to characterize the type of role played by the large language model in the process of expanding the parent node data facts, such as domain analysis experts, etc.; the reference information is used to characterize the relevant information that the large language model will refer to in the process of expanding the parent node data facts, such as professional terms, background knowledge or historical messages, etc., as well as define the components of the intermediate data facts and their structured forms, and / or define the types of intermediate data facts and the corresponding weights of each type; the data information includes the information and sample information in the parent node data facts; the work objectives and methods are used to characterize the tasks of the large language model, such as expanding the parent node data facts to obtain multiple intermediate data facts, and outputting the intermediate data facts in a predefined format; the output requirements are used to define the format or structure of the intermediate data facts, such as using json code to display the intermediate data facts, and the intermediate data facts include at least one of the subject (title), subject description content (description), data fact type (type) of the intermediate data facts, data coverage (subspace), data segmentation level (breakdown), specific data columns (measure) and aggregation method (aggregation).
[0093] For example, the structure of an intermediate data fact is: [
[0095] {
[0096] "title":"xxx",
[0097] "description":"xxx"
[0098] "type":"xxx",
[0099] "subspace": {"xxx":"yyy"},
[0100] "breakdown": {"name":"xxx","period":"xxx"},
[0101] "measure":"xxx",
[0102] "aggregation":"xxx",
[0103] }
[0104] ].
[0105] In the embodiment of the present invention, the description logic of the extended prompt may be a prompt word or prompt sentence obtained based on a Monte Carlo Tree Search (MCTS) algorithm.
[0106] In one embodiment, step S2 includes:
[0107] Step S21, acquiring all upper-level data facts of the plurality of intermediate data facts through the large language model, wherein all upper-level data facts are at least one target data fact expanded by the large language model;
[0108] Step S22, calculating the analysis score corresponding to the target intermediate data fact based on all the upper-level data facts and the target intermediate data fact through the large language model to obtain the analysis scores corresponding to all the intermediate data facts, wherein the target intermediate data fact is one of the multiple intermediate data facts;
[0109] Step S23: Set the intermediate data fact with the highest corresponding analysis score as the target data fact.
[0110] In an embodiment of the present invention, a large language model is used to calculate the analysis score corresponding to the target intermediate data fact based on all the superior data facts and the target intermediate data facts, and then the target data fact is screened according to the analysis score corresponding to each intermediate data fact, thereby obtaining the target data fact that best meets the requirements.
[0111] In the embodiment of the present invention, all upper-level data facts are target data facts that have been expanded from the large language model, and all upper-level data facts have a logical relationship with the target intermediate data fact, for example, the upper-level data fact of the target intermediate data fact is the parent node data fact, the upper-level data fact of the parent node data fact is the parent node data fact of the parent node data fact, and so on. It can be understood that all upper-level data facts are data facts in a data story in the tree structure.
[0112] In an embodiment of the present invention, the analysis score corresponding to the target intermediate data fact is used to characterize the expansion effect of the target intermediate data fact, for example, the analysis score characterizes the correlation between the target intermediate data fact and all the superior data facts, or characterizes the coverage of the target intermediate data fact and all the superior data facts, etc. The target data fact obtained by screening through the analysis score has a stronger correlation with all the superior data facts, or the target intermediate data fact has a larger coverage with all the superior data facts.
[0113] In one embodiment, the preset stop condition includes:
[0114] The number of target data facts included in the data story with the highest analysis score corresponding to the last data fact is equal to the first set number threshold; or,
[0115] The number of all target data facts obtained by expanding the large language model is equal to a second set number threshold.
[0116] In an embodiment of the present invention, the preset stopping condition is set to that the number of target data facts included in the data story with the highest analysis score corresponding to the data fact at the end is equal to a first set quantity threshold; or, the number of all target data facts obtained by expanding the large language model is equal to a second set quantity threshold, so that when the large language model repeatedly executes steps S1 and S2 until the preset stopping condition is met, the target data facts obtained by expanding the large language model meet the quantity requirements, and data stories that meet the requirements can be screened.
[0117] In an embodiment of the present invention, the data story with the highest analysis score corresponding to the final data fact is the required data story, and the number of target data facts included in the data story is equal to the first set quantity threshold, so that the number of target data facts of the data story finally output meets the quantity requirement.
[0118] In an embodiment of the present invention, when there is no requirement for the number of target data facts in the data story corresponding to the final output, the number of all target data facts obtained by expanding the large language model can be equal to the second set quantity threshold, and then the target data story can be selected from the multiple data stories that have been obtained.
[0119] In one embodiment, before step S1, the method further includes:
[0120] Step S4, obtaining a data set to be iterated and an initial prompt, and instructing the large language model to expand the data set to be iterated through the initial prompt to obtain an initial data fact;
[0121] The step S11 comprises:
[0122] Step S111: when the target data fact obtained by expanding the large language model only includes the initial data fact, determine the initial data fact as the parent node data fact.
[0123] In an embodiment of the present invention, a data set to be iterated and an initial prompt are obtained, and the large language model is instructed through the initial prompt to expand the data set to be iterated to obtain initial data facts; when the target data facts obtained by expanding the large language model only include the initial data facts, the initial data facts are determined to be the parent node data facts, thereby obtaining the first parent node data facts.
[0124] In the embodiment of the present invention, the data set to be iterated is a data set that needs to be analyzed by a large language model. The data set to be iterated is expanded based on an initial prompt by the large language model to obtain the first target data fact.
[0125] In the embodiment of the present invention, the initial prompt is the same as the extended prompt, and is used to instruct the large language model to be extended. The initial prompt may be a prompt word or a prompt sentence, and the initial prompt includes at least one of a system role, reference information, data information, a work goal and method, and an output requirement.
[0126] It can be understood that the initial data fact is the data fact of the first node expanded by the large language model. When the target data fact obtained by expanding the large language model only includes the initial data fact, the initial data fact needs to be used as the parent node data fact to expand the new target data fact.
[0127] In the embodiment of the present invention, an extended prompt is generated based on the parent node data fact and the initial prompt by the large language model. Specifically, the large language model is used to expand the iterated data set based on the initial prompt to obtain multiple data facts, and one data is randomly selected from the multiple data facts as the initial data fact; or,
[0128] Presetting a preferred data fact type for an initial data fact, and selecting a data fact that matches the preferred data fact type from multiple data facts as the initial data fact; or,
[0129] Add the analysis subject's preferences in advance when setting the work objectives and methods in the initial prompt, so as to select the data facts that meet the preferences from multiple data facts as the initial data facts.
[0130] Furthermore, for the initial data fact, since there are no other data facts and the initial data fact is the starting point of each data story, there is no need to calculate the analysis score corresponding to the initial data fact after obtaining the initial data fact. Instead, the analysis score of the data fact can be updated by updating. See the subsequent embodiments for details.
[0131] In one embodiment, the step S11 further includes:
[0132] Step S112: when the target data fact obtained by expanding the large language model is a plurality of target data facts, obtaining the access times and analysis scores corresponding to the plurality of target data facts;
[0133] Step S113, calculating the upper confidence limit value of each target data fact based on the corresponding number of accesses and the analysis score;
[0134] Step S114: setting the target data fact with the highest confidence upper limit value among the multiple target data facts as the parent node data fact.
[0135] In an embodiment of the present invention, when the target data facts obtained by expanding a large language model are multiple target data facts, it is necessary to calculate an upper confidence limit value based on the number of visits and analysis scores corresponding to the multiple target data facts, and determine the parent node data fact through the upper confidence limit value, so that the breadth and depth of the multiple target data facts obtained based on the expansion of the parent node data fact are balanced.
[0136] Among them, breadth refers to the number of data stories, and depth refers to the number of data facts in a data story. The more data facts there are in a data story, the deeper the data story is.
[0137] In an embodiment of the present invention, the number of visits corresponding to the target data fact is used to characterize the number of times the target data fact and the subordinate data facts of the target data fact are visited by the large language model and used as parent node data facts in the data story. For example, the number of visits corresponding to the first target data fact (i.e., the initial data fact) is the current number of expansions, and the number of visits corresponding to the last target data fact in the branch is 1. For example, before the third iteration, the number of visits corresponding to the data fact at the starting point in the data story is 2, and the number of visits corresponding to the second data fact is 1; after the third iteration, the number of visits corresponding to the data fact at the starting point in the data story is 3, the number of visits corresponding to the second data fact is 2, and the number of visits corresponding to the third data fact is 1.
[0138] In an embodiment of the present invention, the analysis score (reward) is calculated based on at least one of the type of data fact, the coverage of the target intermediate data fact and all upper-level data facts, and the target relationship type between the target intermediate data fact and all upper-level data facts. The analysis score corresponding to all upper-level data facts is the maximum analysis score corresponding to the data facts in the branch.
[0139] In the embodiment of the present invention, the upper confidence limit value is used to balance the number of visits and the analysis score, and the target data fact with the highest upper confidence limit value is set as the parent node data fact, so that the breadth and depth of the expanded multiple target data facts are balanced.
[0140] In an embodiment of the present invention, the upper confidence limit value can be calculated by an upper confidence limit (UCB) algorithm. For example, in the case of the nth expansion, the number of accesses and analysis scores of all target data facts are obtained, and the upper confidence limit value is calculated by the following formula:
[0141] .
[0142] In the formula, UCB is the upper confidence limit, v i is the mean of all analysis scores of the target data fact, is the number of visits to the target data fact as the parent node data fact, T i is the number of visits to the target data fact, and c is the coefficient. This formula can be used to quickly calculate the confidence upper limit value of each target data fact during this expansion.
[0143] In one embodiment, step S12 includes:
[0144] Step S121, obtaining an initial prompt, and generating the extended prompt based on the parent node data fact and the initial prompt through the large language model;
[0145] Step S122: instructing the large language model to expand the parent node data fact through the expansion prompt to obtain the multiple intermediate data facts.
[0146] In an embodiment of the present invention, an initial prompt is obtained, and an extended prompt is generated by a large language model based on the parent node data fact and the initial prompt. Then, the extended prompt is used to instruct the large language model to expand the parent node data fact to obtain multiple intermediate data facts, so that the target data fact obtained by the large language model expanding the parent node data fact based on the extended prompt has a good correlation with the parent node data fact.
[0147] In the embodiment of the present invention, the initial prompt is a preset prompt, including the prompt template, and an extended prompt can be generated through the prompt template. It should be noted that the initial prompt may include at least one of the system role, reference information, data information, work objectives and methods, and output requirements, and in the embodiment of the present invention, the initial prompt includes at least the prompt template, reference information, and work objectives and methods.
[0148] In an embodiment of the present invention, the prompt template includes at least one of the system role, data information and output requirements. The prompt template is pre-set and does not need to be adjusted; the work objectives and methods are adjusted according to the parent node data facts, specifically, the content of the work objectives and methods can be replaced with the target relationship type between the node data facts and the parent node data facts The upper-level data facts; the reference information is adjusted according to the parent node data facts, specifically, the content of the reference information is replaced with the content of the parent node data facts.
[0149] In one embodiment, step S22 includes:
[0150] Step S221, obtaining an initial prompt, and generating an evaluation prompt based on the initial prompt and the target intermediate data fact;
[0151] Step S222: instructing the large language model to calculate, based on all the superior data facts and the target intermediate data facts, an analysis score corresponding to the target intermediate data fact through the evaluation prompt.
[0152] In an embodiment of the present invention, an analysis score corresponding to a target intermediate data fact is calculated by a large language model based on all superior data facts and target intermediate data facts. Specifically, a pre-set evaluation prompt may be input into the large language model. The evaluation prompt includes a method for calculating the analysis score, such as calculation by the type of data fact, calculation based on coverage, or calculation based on relationship type, etc. In the case where multiple intermediate data facts are obtained each time they are expanded, the large language model calculates the analysis score corresponding to each intermediate data based on the evaluation prompt.
[0153] The evaluation prompts can be adjusted according to the needs, and the large language model can output target data facts that meet the needs through evaluation prompts, thereby obtaining data stories that meet the needs. Requirements can be understood as the degree of coverage of data facts or the correlation between data facts.
[0154] In one embodiment, step S222 specifically includes:
[0155] Instructing the large language model to calculate the analysis score corresponding to the target intermediate data fact based on the data fact type of the target intermediate data fact and the data fact types of all the upper-level data facts through the evaluation prompt; or
[0156] Instructing the large language model to calculate the analysis score corresponding to the target intermediate data fact based on the coverage of the target intermediate data fact relative to the data set to be iterated and the coverage of all the upper-level data facts relative to the data set to be iterated through the evaluation prompt; or
[0157] The evaluation prompt instructs the large language model to analyze the target intermediate data fact and all the upper-level data facts to obtain the target relationship types of the target intermediate data fact and all the upper-level data facts, and queries the relationship type mapping table based on the target relationship type to obtain the analysis score corresponding to the target intermediate data fact, wherein the relationship type mapping table includes analysis scores corresponding to different relationship types.
[0158] In an embodiment of the present invention, an evaluation prompt is used to instruct a large language model to calculate an analysis score based on the data fact type of the data facts, the coverage of the data facts relative to the data set to be iterated, and the target relationship type between the data facts, so as to obtain a data story with rich data fact types, wide coverage, or strong correlation between data facts.
[0159] In an embodiment of the present invention, an evaluation prompt indicates that a large language model calculates an analysis score corresponding to the target intermediate data fact based on the data fact type of the target intermediate data fact and the data fact types of all upper-level data facts. The analysis score is used to characterize the number of data fact types of the target intermediate data fact and all upper-level data facts. The larger the analysis score, the greater the number of data fact types of the target intermediate data fact and all upper-level data facts.
[0160] The analysis score may be the numerical value of the number of data fact types of the target intermediate data fact and all the upper-level data facts. For example, the analysis score includes a data fact type field, and the data fact type of the data fact may be a numerical type, a difference type, a proportion type, an extreme value type, a trend type, a correlation type, or an abnormal type, etc. The analysis score corresponding to the target intermediate data fact is obtained by counting the numerical values of the number of data fact type fields of the target intermediate data fact and all the upper-level data facts.
[0161] In an embodiment of the present invention, the large language model is instructed by evaluation prompts to calculate the analysis score corresponding to the target intermediate data fact based on the coverage of the target intermediate data fact relative to the data set to be iterated, and the coverage of all superior data facts relative to the data set to be iterated. The analysis score is used to characterize the coverage of the target intermediate data fact and all superior data facts. The larger the analysis score, the wider the coverage of the target intermediate data fact and all superior data facts, and the wider the coverage of the data story finally obtained.
[0162] The analysis score can be the ratio of the target intermediate data fact to the data included in all the upper-level data facts in the data set to be iterated. It should be noted that the extended target data fact can include a field for data coverage (such as a measure field), and the analysis score corresponding to the target intermediate data fact is determined based on the measure fields of the target intermediate data fact and all the upper-level data facts.
[0163] In an embodiment of the present invention, an evaluation prompt instructs a large language model to analyze the target intermediate data fact and all the upper-level data facts to obtain the target relationship type of the target intermediate data fact and all the upper-level data facts, and based on the target relationship type, a relationship type mapping table is queried to obtain an analysis score corresponding to the target intermediate data fact. The analysis score is used to characterize the correlation between the target intermediate data fact and all the upper-level data facts. The larger the analysis score, the stronger the correlation between the target intermediate data fact and all the upper-level data facts.
[0164] Among them, the target intermediate data facts and all the superior data facts are analyzed, specifically, the target intermediate data facts and all the superior data facts are analyzed through a large language model to obtain the target relationship type between the target intermediate data and all the superior data facts. The above target relationship type can be a similarity relationship, a contrast relationship, a causal relationship, or a spatiotemporal relationship, etc. The above relationship type mapping table includes analysis scores corresponding to different relationships, for example, the analysis score corresponding to the causal relationship is 9, and the analysis score corresponding to the similarity relationship is 7. The higher the analysis score, the stronger the logical correlation between the target intermediate data and all the superior data facts.
[0165] Furthermore, the analysis score may also be calculated by at least two of the number of data fact types, the coverage of the target intermediate data fact and all upper-level data facts, and the target relationship type between the target intermediate data fact and all upper-level data facts.
[0166] Specifically, a first sub-score corresponding to the number of data fact types, a second sub-score corresponding to the coverage of the target intermediate data fact and all upper-level data facts, and / or a third sub-score corresponding to the target relationship type between the target intermediate data fact and all upper-level data facts are calculated respectively, and then the weighted values of the first sub-score, the second sub-score and / or the third sub-score are set as the analysis score corresponding to the data fact.
[0167] For example, the data set to be iterated is population-related data, the data fact at the starting point of the branch is the average population growth rate of each country, and the parent node data fact selected from the target data fact is the ranking of the total population of each country in 2023. The parent node data fact is expanded to obtain three intermediate data facts. Among them, the analysis score of the first intermediate data fact is 8.5, the analysis score of the second intermediate data fact is 7.5, and the analysis score of the third intermediate data fact is 8. At this time, the analysis score of the first intermediate data fact is the highest, and the first intermediate data fact is set as the target data fact.
[0168] In one embodiment, after step S2 and before step S3, the method further includes:
[0169] Step S5, setting the access count corresponding to the target data fact obtained by the latest expansion to 1, and adding 1 to the access count corresponding to each target data fact in all parent data facts of the target data fact obtained by the latest expansion;
[0170] Step S6: Obtain the analysis scores corresponding to all the superior data facts, and when the analysis score corresponding to the target data fact obtained by the latest expansion is greater than or equal to the analysis scores corresponding to all the superior data facts, update the analysis scores corresponding to all the superior data facts to the analysis scores corresponding to the target data fact obtained by the latest expansion.
[0171] In an embodiment of the present invention, the number of visits and analysis scores corresponding to the target data fact are updated so that the upper confidence limit value corresponding to the target data fact changes after each expansion, thereby realizing the back propagation of the number of visits and analysis scores of the target data fact in the data story, so as to adjust the number of visits and analysis scores of other data facts in the data story, avoid a target data fact being repeatedly selected as a parent node data fact too many times, and balance the breadth and depth of the expansion.
[0172] In an embodiment of the present invention, when the analysis score corresponding to the target data fact is greater than the analysis scores corresponding to all the upper-level data facts, the analysis scores corresponding to all the upper-level data facts are updated; and when the target data fact is less than the analysis scores corresponding to all the upper-level data facts, the analysis scores corresponding to all the upper-level data facts are not updated, so that the analysis scores of the data facts in the data story are all maximum values.
[0173] In one embodiment, step S4 includes:
[0174] Step S41, obtaining the analysis score corresponding to the target data fact at the end of each data story;
[0175] Step S42: setting the data story with the highest analysis score corresponding to the last target data fact as the target data story;
[0176] Step S43: display the target data story.
[0177] In an embodiment of the present invention, a target data story is determined by the analysis score corresponding to the target data fact at the end of each data story. The target data story is a data story with rich data fact types, wide coverage, or strong correlation between data facts among multiple data stories, so as to obtain a data story that meets the requirements.
[0178] In an embodiment of the present invention, since the analysis score corresponding to the data fact is updated after each expansion, the analysis score corresponding to the target data fact at the end of each data story can reflect the data fact type, coverage or correlation between data facts in each data story. By setting the data story with the highest analysis score corresponding to the target data fact at the end as the target data story, it is ensured that the marked data story is a data story with rich data fact types, wide coverage or strong correlation between data facts among multiple data stories.
[0179] In one embodiment, step S43 includes:
[0180] Step S431, generating a visualization chart corresponding to each of the at least two target data facts included in the target data story;
[0181] Step S432, generating a text analysis result of a coherent expression of at least two target data facts included in the target data story;
[0182] Step S433: display the visualization chart corresponding to each target data fact and the text analysis result.
[0183] In an embodiment of the present invention, a visualization chart corresponding to each of the at least two target data facts included in the target data story is generated, and a text analysis result of a coherent expression of the at least two target data facts included in the target data story is generated, thereby improving the presentation effect of the target data story.
[0184] Exemplarily, the embodiment of the present invention also provides a specific example of generating analysis results, in which the initial data is the world urban population data in 2022 and 2023, as shown in the following table:
[0185] ;
[0186] Multiple data facts can be obtained from the above table, such as the numerical data fact 'The population of Tokyo, Japan in 2023 is 37194104', which can be directly queried in the table for analysis; another example is the difference data fact 'The difference between the population of Tokyo, Japan in 2022 and 2023 is 79896', which is obtained by comparing the two data attributes '2023 population' and '2022 population', and the code needs to be executed to get the accurate value. There are also some data facts with more complicated processing procedures, such as the ranking data fact 'The top three Asian countries in terms of urban population in 2023 are China, India and Japan', which needs to group and sum the '2023 population' data by the 'country' and 'region' attributes, and then sort the quantity, and finally get the data facts including the top three countries.
[0187] Specifically, in a process of generating a data story, we hope that the analysis result will be generated with "population growth rate" as the theme, so the theme is written into the "work objectives and methods" part of the initial prompt. The initial data is analyzed based on the initial prompt through the large language model to obtain 3 different types of data facts related to the theme, and then a data fact is randomly selected as the initial data fact.
[0188] Among them, three data facts are as follows:
[0189] Data Fact 1:
[0190] {
[0191] "title":"Average population growth rate in Asian countries",
[0192] "description":"By calculating the average population growth rate of Asian countries, we can understand the population growth trend of Asian countries, which helps us predict future population changes."
[0193] "type":"Trend",
[0194] "subspace": {"Continent":"Asia"},
[0195] "breakdown": {"name":"Country","period":""},
[0196] "measure":"growthRate",
[0197] "aggregation":"mean",
[0198] },
[0199] Data Fact 2:
[0200] {
[0201] "title":"Average population growth rate of each country",
[0202] "description":"By calculating the average population growth rate of each country, we can understand the population growth of each country, which helps us predict future population changes."
[0203] "type":"Association",
[0204] "subspace": {},
[0205] "breakdown": {"name":"Country","period":""},
[0206] "measure":"growthRate",
[0207] "aggregation":"mean",
[0208] },
[0209] Data Fact 3:
[0210] {
[0211] "title":"Tokyo's Population in 2023",
[0212] "description":"By looking up the data, we can find out the population of Tokyo in 2023, which helps us understand the population changes in Tokyo."
[0213] "type":"Value",
[0214] "subspace": {"City":"Tokyo"},
[0215] "breakdown": {},
[0216] "measure":"Pop2023",
[0217] "aggregation":"",
[0218] }.
[0219] Data fact 2 is randomly selected from the above three data facts as the initial data fact.
[0220] After obtaining the initial data fact, iterations (including selection, expansion, evaluation, and back propagation) are performed to obtain multiple target data facts. Assuming that the maximum number of iterations is set to 20, the first round of iterations only has one data fact at the starting point, so expansion is performed based on this data fact. In the case of non-first round iterations, multiple data facts are included, and the parent node data fact needs to be determined from the multiple data facts. For example, Figure 2 As shown in the figure, before the third iteration, there are two data facts, 'average population growth rate of countries' and 'ranking of total population of countries in 2023'. First, the confidence upper limit value of each data fact is calculated to determine the parent node data fact to be iterated this time, and then determine whether to perform deep iteration or breadth iteration. As a result, the confidence upper limit value of the second data fact visit: 1, reward: 8 is higher, so the second data fact is selected as the parent node data fact. At this time, it is a deep iteration to expand the number of data facts on a data story; if the initial data fact is selected as the parent node data fact, it is a breadth iteration at this time to obtain more data stories.
[0221] After selecting the parent node data fact, it is necessary to instruct the large language model to generate multiple intermediate data facts that are logically related to the parent node data fact. Therefore, an extended prompt is generated based on the parent node data fact and the prompt template, and then the parent node data fact is extended by the large language model based on the extended prompt to obtain the three extended intermediate data facts shown in the figure.
[0222] The three extended intermediate data facts generated by the expansion and the parent node data facts form three branches. In the evaluation phase, it is necessary to instruct the large language model to conduct a comprehensive evaluation of different branches from at least one of the data fact type diversity, data coverage, and logical relevance, and obtain corresponding analysis scores, which are counted as 'reward'. As shown in the figure, the branch where the first intermediate data '2023 population distribution' is located has the highest score of 8.5, so this branch is retained as the target data fact obtained in this iteration.
[0223] Furthermore, the analysis score corresponding to the data fact obtained by this expansion is higher than the evaluation score of the parent node data fact. Therefore, during backpropagation, the analysis scores corresponding to all data facts in the data story are updated to the highest score, and the number of visits increases by one.
[0224] After that, the parent node data facts are repeatedly selected, and expansion, evaluation and back propagation are performed (that is, one iteration includes selecting the data to be iterated, and expansion, evaluation and back propagation are performed). After the set number of iterations (20 times), the iteration is stopped, and 20 target data facts are obtained. Figure 3 The tree structure shown in the figure is shown in the figure. The analysis score of the last data fact in each data story in the tree structure is calculated in turn to determine the target data story, such as Figure 3 The data story that includes 9 target data facts is the data story with the highest analysis score for the final data fact, and this data story is the target data story.
[0225] In an embodiment of the present invention, a visualization chart corresponding to each of at least two target data facts included in the target data story is generated, and specifically, a visualization chart corresponding to each target data fact is generated by generating an extended prompt based on an initial prompt through a large language model. The format of the visualization chart required to be generated is set in the extended prompt generated by the initial prompt, and the visualization chart is generated according to the subject, type, and data information of the data fact during conversion.
[0226] Among them, the initial prompt and extended prompt can add common chart types corresponding to different data facts, such as direct display of single-value facts, line charts corresponding to trend facts, pie charts corresponding to proportion facts, and bar charts corresponding to ranking facts. Figure 4 As shown, after obtaining the target data story, the data facts (data fact 1 to data fact 9) included in the target data story are converted into 9 visualization charts.
[0227] In the embodiment of the present invention, a text analysis result of a coherent expression of at least two target data facts included in the target data story is generated, specifically, each data fact is coherently expressed by summary text to form a complete text analysis result.
[0228] It should be noted that the expressiveness of charts exceeds that of codes and text. By using the code language model that is good at analysis and drawing, data facts are obtained and charts corresponding to the data facts are drawn. Auxiliary annotations such as labels, instructions, and highlights are added according to the data fact type of the data facts to enrich the content of the data facts and enhance the expressiveness of the visual charts.
[0229] See also Figure 5 , Figure 5 is a structural diagram of a device for generating a visual data story based on a large language model provided in an embodiment of the present application, such as Figure 5 As shown, the device 500 for generating a visual data story based on a large language model includes:
[0230] The first expansion module 501 is used to determine a parent node data fact, and generate multiple intermediate data facts corresponding to the parent node data fact through a large language model, wherein the parent node data fact is a target data fact obtained by expanding the large language model, and the multiple intermediate data facts have a logical relationship with the parent node data fact;
[0231] A screening module 502 is used to screen the plurality of intermediate data facts by using the large language model to obtain a target data fact and an analysis score corresponding to the target data fact;
[0232] The second expansion module 503 is used to repeatedly determine the parent node data fact, generate multiple intermediate data facts corresponding to the parent node data fact through the large language model, and screen the multiple intermediate data facts through the large language model to obtain a target data fact and an analysis score corresponding to the target data fact, until a preset stop condition is met, and obtain multiple data stories, each of which includes at least two target data facts;
[0233] The determination module 504 is configured to determine a target data story based on the analysis scores corresponding to at least two target data facts included in each data story, and to display the target data story.
[0234] In one embodiment, the first expansion module 501 includes:
[0235] A first determination submodule, used to determine the parent node data fact;
[0236] The expansion submodule is used to obtain an expansion prompt, and instruct the large language model to expand the parent node data fact through the expansion prompt to obtain the multiple intermediate data facts.
[0237] In one embodiment, the screening module 502 includes:
[0238] A first acquisition submodule, configured to acquire all upper-level data facts of the plurality of intermediate data facts through the large language model, wherein all upper-level data facts are at least one target data fact obtained by expanding the large language model;
[0239] a calculation submodule, configured to calculate, through the large language model, based on all the upper-level data facts and the target intermediate data fact, an analysis score corresponding to the target intermediate data fact, so as to obtain analysis scores corresponding to all the intermediate data facts, wherein the target intermediate data fact is one of the multiple intermediate data facts;
[0240] The second determination submodule is used to set the intermediate data fact with the highest corresponding analysis score as the target data fact.
[0241] In one embodiment, the preset stop condition includes:
[0242] The number of target data facts included in the data story with the highest analysis score corresponding to the last data fact is equal to the first set number threshold; or,
[0243] The number of all target data facts obtained by expanding the large language model is equal to a second set number threshold.
[0244] In one embodiment, the apparatus 500 for generating a visual data story based on a large language model further includes:
[0245] An acquisition module, used to acquire a data set to be iterated and an initial prompt, and instruct the large language model to expand the data set to be iterated through the initial prompt to obtain an initial data fact;
[0246] The first determining submodule includes:
[0247] The first determining unit is configured to determine that the initial data fact is the parent node data fact when the target data fact obtained by expanding the large language model only includes the initial data fact.
[0248] In one embodiment, the first determining submodule further includes:
[0249] A first acquisition unit is used to acquire, when the target data fact obtained by expanding the large language model is a plurality of target data facts, the number of accesses and the analysis scores corresponding to the plurality of target data facts;
[0250] A first calculation unit, configured to calculate an upper confidence limit value of each target data fact based on the corresponding number of accesses and the analysis score;
[0251] The second determining unit is configured to set the target data fact having the highest confidence upper limit value among the multiple target data facts as the parent node data fact.
[0252] In one embodiment, the expansion submodule includes:
[0253] A second acquisition unit, configured to acquire an initial prompt, and generate the extended prompt based on the parent node data fact and the initial prompt through the large language model;
[0254] An expansion unit is used to instruct the large language model to expand the parent node data fact through the expansion prompt to obtain the multiple intermediate data facts.
[0255] In one embodiment, the calculation submodule includes:
[0256] a third acquisition unit, configured to acquire an initial prompt, and generate an evaluation prompt based on the initial prompt and the target intermediate data fact;
[0257] The second calculation unit is used to instruct the large language model to calculate the analysis score corresponding to the target intermediate data fact based on all the upper-level data facts and the target intermediate data facts through the evaluation prompt.
[0258] In one embodiment, the second computing unit is specifically configured to:
[0259] Instructing the large language model to calculate the analysis score corresponding to the target intermediate data fact based on the data fact type of the target intermediate data fact and the data fact types of all the upper-level data facts through the evaluation prompt; or
[0260] Instructing the large language model to calculate the analysis score corresponding to the target intermediate data fact based on the coverage of the target intermediate data fact relative to the data set to be iterated and the coverage of all the upper-level data facts relative to the data set to be iterated through the evaluation prompt; or
[0261] The evaluation prompt instructs the large language model to analyze the target intermediate data fact and all the upper-level data facts to obtain the target relationship types of the target intermediate data fact and all the upper-level data facts, and queries the relationship type mapping table based on the target relationship type to obtain the analysis score corresponding to the target intermediate data fact, wherein the relationship type mapping table includes analysis scores corresponding to different relationship types.
[0262] In one embodiment, the apparatus 500 for generating a visual data story based on a large language model further includes:
[0263] A first updating module is used to set the number of accesses corresponding to the target data fact obtained by the latest expansion to 1, and to increase the number of accesses corresponding to each target data fact in all parent data facts of the target data fact obtained by the latest expansion by 1;
[0264] The second updating module is used to obtain the analysis scores corresponding to all the superior data facts, and when the analysis score corresponding to the target data fact obtained by the latest expansion is greater than or equal to the analysis scores corresponding to all the superior data facts, the analysis scores corresponding to all the superior data facts are updated to the analysis scores corresponding to the target data facts obtained by the latest expansion.
[0265] In one embodiment, the acquisition module includes:
[0266] A first acquisition submodule is used to acquire an analysis score corresponding to the target data fact at the end of each data story;
[0267] A third determination submodule is used to set the data story with the highest analysis score corresponding to the last target data fact as the target data story;
[0268] The display submodule is used to display the target data story.
[0269] In one embodiment, the display submodule includes:
[0270] A first generating unit, configured to generate a visualization chart corresponding to each of at least two target data facts included in the target data story;
[0271] A second generating unit, configured to generate a text analysis result of a coherent expression of at least two target data facts included in the target data story;
[0272] The display unit is used to display the visual chart corresponding to each target data fact and the text analysis result.
[0273] The data analysis device provided in the embodiment of the present application is capable of implementing each process of each embodiment of the above-mentioned method for generating a visual data story based on a large language model. The technical features correspond one to one and can achieve the same technical effect. To avoid repetition, they will not be described here.
[0274] It should be noted that the data analysis device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in an electronic device.
[0275] The present application also provides an electronic device, see Figure 6 , Figure 6 601, a processor 602, and a program or instruction stored in the memory 601 and executed by the processor 602. Figure 1 Any steps in the corresponding embodiment of the method for generating a visual data story based on a large language model and achieving the same beneficial effects will not be repeated here.
[0276] The processor 602 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or a complex programmable logic device (CPLD).
[0277] A person skilled in the art can understand that all or part of the steps of the method for generating a visual data story based on a large language model in the above embodiment can be completed by hardware related to program instructions, and the program can be stored in a readable medium.
[0278] The present application also provides a readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the above-mentioned Figure 1 Any steps in the corresponding embodiment of the method for generating a visual data story based on a large language model can achieve the same technical effect, and will not be repeated here to avoid repetition. The storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0279] The terms "first", "second" etc. in the embodiments of the present application are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. In addition, the terms "include" and "have" and any variation thereof are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising a series of steps or units need not be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or equipment. In addition, "and / or" is used in the present application to represent at least one of connected objects, such as A and / or B and / or C, representing comprising independent A, independent B, independent C, and A and B all exist, B and C all exist, A and C all exist, and 7 situations that A, B and C all exist.
[0280] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0281] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a second terminal device, etc.) to execute the methods of each embodiment of the present application.
[0282] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A method for generating visual data stories based on a large language model, characterized in that: include: Step S1, determining a parent node data fact, and generating a plurality of intermediate data facts corresponding to the parent node data fact through a large language model, wherein the parent node data fact is a target data fact obtained by expanding the large language model, and the plurality of intermediate data facts have a logical relationship with the parent node data fact; Step S2: screening the plurality of intermediate data facts by using the large language model to obtain a target data fact and an analysis score corresponding to the target data fact; Step S3, repeatedly executing step S1 and step S2 until a preset stop condition is met, and obtaining multiple data stories, each of which includes at least two target data facts; Step S4: determining a target data story based on the analysis scores corresponding to at least two target data facts included in each data story, and displaying the target data story; The step S2 comprises: Step S21, acquiring all upper-level data facts of the plurality of intermediate data facts through the large language model, wherein all upper-level data facts are at least one target data fact expanded by the large language model; Step S22, calculating the analysis score corresponding to the target intermediate data fact based on all the upper-level data facts and the target intermediate data fact through the large language model to obtain the analysis scores corresponding to all the intermediate data facts, wherein the target intermediate data fact is one of the multiple intermediate data facts; Step S23, setting the intermediate data fact with the highest corresponding analysis score as the target data fact; The step S1 comprises: Step S11, determining the parent node data fact; The step S11 further includes: Step S112: when the target data fact obtained by expanding the large language model is a plurality of target data facts, obtaining the access times and analysis scores corresponding to the plurality of target data facts; Step S113, calculating the upper confidence limit value of each target data fact based on the corresponding number of accesses and the analysis score; Step S114: setting the target data fact with the highest confidence upper limit value among the multiple target data facts as the parent node data fact.
2. The method according to claim 1, characterized in that The step S1 further comprises: Step S12: obtaining an extension prompt, and instructing the large language model to extend the parent node data fact through the extension prompt to obtain the multiple intermediate data facts.
3. The method according to claim 1, characterized in that The preset stop conditions include: The number of target data facts included in the data story with the highest analysis score corresponding to the last data fact is equal to the first set number threshold; or, The number of all target data facts obtained by expanding the large language model is equal to a second set number threshold.
4. The method according to claim 1, characterized in that Before step S1, the method further includes: Step S4, obtaining a data set to be iterated and an initial prompt, and instructing the large language model to expand the data set to be iterated through the initial prompt to obtain an initial data fact; The step S11 comprises: Step S111: when the target data fact obtained by expanding the large language model only includes the initial data fact, determine the initial data fact as the parent node data fact.
5. The method according to claim 2, characterized in that The step S12 comprises: Step S121, obtaining an initial prompt, and generating the extended prompt based on the parent node data fact and the initial prompt through the large language model; Step S122: instructing the large language model to expand the parent node data fact through the expansion prompt to obtain the multiple intermediate data facts.
6. The method according to claim 1, characterized in that The step S22 comprises: Step S221, obtaining an initial prompt, and generating an evaluation prompt based on the initial prompt and the target intermediate data fact; Step S222: instructing the large language model to calculate, based on all the superior data facts and the target intermediate data facts, an analysis score corresponding to the target intermediate data fact through the evaluation prompt.
7. The method according to claim 6, characterized in that The step S222 specifically includes: Instructing the large language model to calculate the analysis score corresponding to the target intermediate data fact based on the data fact type of the target intermediate data fact and the data fact types of all the upper-level data facts through the evaluation prompt; or Instructing the large language model to calculate the analysis score corresponding to the target intermediate data fact based on the coverage of the target intermediate data fact relative to the data set to be iterated and the coverage of all the upper-level data facts relative to the data set to be iterated through the evaluation prompt; or The evaluation prompt instructs the large language model to analyze the target intermediate data fact and all the upper-level data facts to obtain the target relationship types of the target intermediate data fact and all the upper-level data facts, and queries the relationship type mapping table based on the target relationship type to obtain the analysis score corresponding to the target intermediate data fact, wherein the relationship type mapping table includes analysis scores corresponding to different relationship types.
8. The method according to claim 1, characterized in that After step S2 and before step S3, the method further includes: Step S5, setting the access count corresponding to the target data fact obtained by the latest expansion to 1, and adding 1 to the access count corresponding to each target data fact in all parent data facts of the target data fact obtained by the latest expansion; Step S6: Obtain the analysis scores corresponding to all the superior data facts, and when the analysis score corresponding to the target data fact obtained by the latest expansion is greater than or equal to the analysis scores corresponding to all the superior data facts, update the analysis scores corresponding to all the superior data facts to the analysis scores corresponding to the target data fact obtained by the latest expansion.
9. The method according to claim 1, characterized in that The step S4 comprises: Step S41, obtaining the analysis score corresponding to the target data fact at the end of each data story; Step S42: setting the data story with the highest analysis score corresponding to the last target data fact as the target data story; Step S43: display the target data story.
10. The method according to claim 9, characterized in that The step S43 comprises: Step S431, generating a visualization chart corresponding to each of the at least two target data facts included in the target data story; Step S432, generating a text analysis result of a coherent expression of at least two target data facts included in the target data story; Step S433: display the visualization chart corresponding to each target data fact and the text analysis result.
11. A device for generating visual data stories based on a large language model, applied to a large language model, characterized in that: include: A first expansion module is used to determine a parent node data fact, and generate a plurality of intermediate data facts corresponding to the parent node data fact through a large language model, wherein the parent node data fact is a target data fact obtained by expanding the large language model, and the plurality of intermediate data facts have a logical relationship with the parent node data fact; A screening module, configured to screen the plurality of intermediate data facts through the large language model to obtain a target data fact and an analysis score corresponding to the target data fact; A second expansion module is used to repeatedly determine a parent node data fact, generate multiple intermediate data facts corresponding to the parent node data fact through a large language model, and screen the multiple intermediate data facts through the large language model to obtain a target data fact and an analysis score corresponding to the target data fact, until a preset stop condition is met, and obtain multiple data stories, each of which includes at least two target data facts; A determination module, configured to determine a target data story based on the analysis scores corresponding to at least two target data facts included in each data story, and to display the target data story; The screening module comprises: A first acquisition submodule, configured to acquire all upper-level data facts of the plurality of intermediate data facts through the large language model, wherein all upper-level data facts are at least one target data fact obtained by expanding the large language model; a calculation submodule, configured to calculate, through the large language model, based on all the upper-level data facts and the target intermediate data fact, an analysis score corresponding to the target intermediate data fact, so as to obtain analysis scores corresponding to all the intermediate data facts, wherein the target intermediate data fact is one of the multiple intermediate data facts; The second determination submodule is used to set the corresponding intermediate data fact with the highest analysis score as the target data fact; The first expansion module comprises: A first determination submodule, used to determine the parent node data fact; The first determining submodule further includes: A first acquisition unit is used to acquire, when the target data fact obtained by expanding the large language model is a plurality of target data facts, the number of accesses and the analysis scores corresponding to the plurality of target data facts; A first calculation unit, configured to calculate an upper confidence limit value of each target data fact based on the corresponding number of accesses and the analysis score; The second determining unit is configured to set the target data fact having the highest confidence upper limit value among the multiple target data facts as the parent node data fact.
Citation Information
Patent Citations
Visual data narration method, medium, and electronic equipment
CN114077636A
