Market index data query method, system and terminal based on large language model
By using a market index data query method based on a large language model, the problem of inconsistent user query results in traditional technologies has been solved. This method achieves accurate identification of user intent and generation of answers, thereby improving the query experience and accuracy.
Patent Information
- Application Number
- CN202510684040.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-26
- Publication Date
- 2025-10-28
AI Technical Summary
In existing technologies, traditional database queries and simple search engines lack natural language processing capabilities, resulting in market indicator data query results that do not match user needs and lead to a poor user experience.
A market index data query method based on a large language model is adopted. By collecting user input data, the query industry is determined, a query model is established, user intent is identified, and a matching answer is generated. This includes retrieving industry vocabulary, expanding the vocabulary and output header, performing low-rank adaptive fine-tuning, and combining knowledge graph and autoregressive sampling to improve accuracy.
It achieves accurate understanding of users' natural language queries, improving the experience and accuracy of market indicator data queries.
Smart Images

Figure CN120849475A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method, system and terminal for querying market index data based on a large language model. Background Technology
[0002] Data processing refers to a series of operations and processes performed on raw data, aiming to transform disordered, messy, or difficult-to-use data into valuable information that can be used for decision-making or application.
[0003] Market data refers to derived data indicators calculated using specific algorithms or models based on raw market data (such as price, volume, and turnover) from financial markets (e.g., stocks, futures, forex, cryptocurrencies). These indicators are used to analyze market trends, price fluctuations, buy and sell signals, and investor sentiment, supporting decision-making or quantitative strategies. Real-time acquisition and analysis of market data are crucial for investment decisions in financial markets. Currently, the acquisition of market data primarily relies on traditional database query techniques and simple search engines.
[0004] When using traditional database query techniques and simple search engines to obtain market indicator data, the lack of natural language processing capabilities in these techniques makes it difficult for existing systems to accurately understand users' natural language queries. This results in returned data that does not match user needs, leading to a poor user experience. Summary of the Invention
[0005] To improve users' experience in querying market index data, this invention provides a method, system, and terminal for querying market index data based on a large language model.
[0006] Firstly, this invention provides a method for querying market indicator data based on a large language model, employing the following technical solution:
[0007] A method for querying market indicator data based on a large language model includes:
[0008] S1: Collect query data input by the user;
[0009] S2: Determine the industry to be queried based on the query data;
[0010] S3: Establish a query model based on the aforementioned industry;
[0011] S4: Identify the user's intent based on the query data and input it into the query model to generate the answer to the user's needs, and output the answer to the user's needs.
[0012] Optionally, step S3 includes the following steps:
[0013] S31: Retrieve industry-specific terms based on the query industry;
[0014] S32: Determine the expanded vocabulary and expanded output head based on the industry terminology;
[0015] S33: Based on the expanded vocabulary and the expanded output head, the data is injected into the base model to form an industry model;
[0016] S34: Perform low-rank adaptive fine-tuning based on the industry model to form the query model.
[0017] Optionally, step S34 includes the following steps:
[0018] S341: Retrieve the original weight matrix based on the industry model;
[0019] S342: Select a low-rank adapter based on the original weight matrix;
[0020] S343: The low-rank adapter and the industry model are merged to form the query model.
[0021] Optionally, step S342 includes the following steps:
[0022] S3421: Construct and generate a first low-rank matrix and a second low-rank matrix based on the original weight matrix;
[0023] S3422: Update the original weight matrix based on the first low-rank matrix and the second low-rank matrix, and define the updated original weight matrix as the updated weight matrix;
[0024] S3423: Determine the loss function to be used based on the original weight matrix and the updated weight matrix;
[0025] S3424: Determine the gradient of the low-rank matrix based on the aforementioned loss function;
[0026] S3425: Update the first low-rank matrix and the second low-rank matrix based on the gradient of the low-rank matrix, and define the updated first low-rank matrix as the first adjustment matrix and the updated second low-rank matrix as the second adjustment matrix.
[0027] S3426: Determine the low-rank adapter based on the first adjustment matrix and the second adjustment matrix.
[0028] Optionally, step S3421 includes the following steps:
[0029] S34211: Retrieve the output dimension and input dimension based on the original weight matrix;
[0030] S34212: Calculate the quotient between the output dimension and the preset baseline rank value and use it as the output reference value;
[0031] S34213: Calculate the quotient between the input dimension and the preset baseline rank value and use it as the input reference value;
[0032] S34214: Calculate the sum between the output reference value and the input reference value and use it as a comprehensive reference value;
[0033] S34215: Determine the selected rank value based on the comparison result between the comprehensive reference value and the preset reference benchmark value;
[0034] S34216: Generate the first low-rank matrix based on the selected rank value and the input dimension, and generate the second low-rank matrix based on the selected rank value and the output dimension.
[0035] Optionally, step S3423 includes the following steps:
[0036] S34231: Obtain the initial loss function;
[0037] S34232: Define the identifier result of the instruction part as 0 and the identifier result of the answer part as 1 to form a mask setting;
[0038] S34233: Based on the mask setting and the initial loss function, an adjusted loss function is formed, and the adjusted loss function is used as the applied loss function.
[0039] Optionally, step S4 includes the following steps:
[0040] S41: Extract key text based on the query data;
[0041] S42: Input the key text into the query model to identify user intent and form key intent;
[0042] S43: Based on the key intent, retrieve query results from a preset knowledge graph;
[0043] S44: Retrieve the previous result based on the query result;
[0044] S45: Generate candidate results based on the query results and the previous results;
[0045] S46: Input the candidate results into the query model to obtain a matching answer, and use the matching answer as the answer to the user's needs.
[0046] Optionally, step S46 includes the following steps:
[0047] S461: Generate an approximate model based on the query model;
[0048] S462: Based on the candidate results, autoregressive sampling is performed on the approximate model to generate approximate results;
[0049] S463: Based on the key intent and the approximate result, concatenate them and input them into the query model to obtain the concatenation result;
[0050] S464: Determine whether the splicing result is satisfactory;
[0051] S465: If yes, continue to generate the next splicing result, and combine the obtained splicing results to form the correct answer;
[0052] S466: If not, then based on the approximate result, re-concatenate it with the key intent and input it into the query model to obtain the concatenation result.
[0053] Secondly, this invention provides a market data query system based on a large language model, employing the following technical solution:
[0054] A market data query system based on a large language model includes:
[0055] The acquisition module is used to acquire query data and the initial loss function;
[0056] A memory for storing a market index data query method based on a large language model, as described in any one of the first aspects;
[0057] The processor loads and executes programs from memory.
[0058] Thirdly, the present invention provides a terminal, which adopts the following technical solution:
[0059] A terminal includes a memory and a processor, wherein the memory stores a computer program and is capable of being loaded and executed by the processor as described in any one of the first aspects, a method for querying market index data based on a large language model.
[0060] In summary, the present invention has at least one of the following beneficial technical effects:
[0061] 1. By collecting query data and determining the query industry, a query model is established. Then, based on the query data, the user's intent is identified and input into the query model to generate and output the answer to the user's needs. This allows for accurate understanding of the user's natural language query and output of a matching answer, thereby improving the user's query experience for market indicator data.
[0062] 2. By retrieving industry terms from the query industry and determining the expanded terminology and expanded output head, and then injecting the expanded terminology and expanded output head into the base model to form an industry model, the industry model is then subjected to low-rank adaptive fine-tuning to form a query model, thereby improving the accuracy of the obtained query model.
[0063] 3. Extract key text from query data and input it into the query model to identify user intent and form key intent. Then, retrieve query results from the preset knowledge graph. Use the query results to retrieve the previous results to generate candidate results. Input the candidate results into the query model to obtain the answer that matches the user's needs and use it as the answer to the user's needs, thereby improving the accuracy of the answer to the user's needs. Attached Figure Description
[0064] Figure 1 This is a flowchart of a method for querying market index data based on a large language model according to an embodiment of this application;
[0065] Figure 2 This is a flowchart illustrating the method for establishing a query model according to an embodiment of this application;
[0066] Figure 3 This is a flowchart of a method for generating user requirement answers according to an embodiment of this application. Detailed Implementation
[0067] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments.
[0068] A method for querying market index data based on a large language model is proposed. The method establishes a query model by querying data and an initial loss function. Then, the user's intent is identified based on the query data and input into the query model to generate the answer to the user's needs and output it. This method can accurately understand the user's natural language query and output the corresponding answer, thereby improving the user's query experience for market index data.
[0069] Reference Figure 1 This invention discloses a method for querying market indicator data based on a large language model, comprising:
[0070] S1: Collect query data input by the user.
[0071] Among them, query data refers to the text, voice, and other data entered by the user when making a query, and the query data is obtained after input.
[0072] S2: Determine the industry to be queried based on the query data.
[0073] The query industry refers to the industry that the user needs to search for based on the data entered. By matching the query data with preset industry benchmark data, the industry corresponding to the match is selected as the query industry for convenient subsequent use. Industry benchmark data refers to the text or audio corresponding to relevant terms in different industries, which is obtained after pre-input.
[0074] Furthermore, in order to improve the accuracy of the obtained query industry, the specific steps for determining the query industry also include the following steps.
[0075] S21: Retrieve the number of industries based on the industry query.
[0076] The number of industries refers to the number of industries that need to be involved in the query. By counting the number of industries that need to be queried, this number can be used as the number of industries for later use.
[0077] S22: Determine if the number of industries is one. If yes, proceed to S23; otherwise, proceed to S24.
[0078] The system determines whether the number of industries listed is one to decide whether adjustments to the queried industries are needed.
[0079] S23: Continue outputting the query industry.
[0080] When the number of industries is one, it means that no adjustment is needed to the query industry, so the query industry continues to be output.
[0081] S24: Retrieve industry data from the query data based on the industry query.
[0082] Industry data refers to query data related to the industry being queried. When there is more than one industry, it means that the query industry needs to be adjusted. Therefore, data related to the query industry is retrieved from the query data and used as industry data for convenient subsequent use.
[0083] S25: Determine combined data and individual data based on industry data.
[0084] Here, "combined data" refers to data that can be combined, while "single data" refers to data that cannot be combined. By combining data from various industries and matching the combined data with preset industry benchmark data, successfully matched data is used as combined data, and unmatched data is used as single data, facilitating subsequent use.
[0085] S26: Determine the portfolio industry based on portfolio data.
[0086] Here, "industry combination" refers to the industry to which the combined data belongs; different combinations of data correspond to different industries. The industry corresponding to the successfully matched benchmark data is retrieved from the combined data and used as the industry combination for subsequent use.
[0087] S27: Identify a single industry based on a single set of data.
[0088] Here, "single industry" refers to the industry to which a single data point belongs; different single data points correspond to different single industries. By retrieving the industry corresponding to a previously successfully matched data point and using it as the single industry, it facilitates subsequent use.
[0089] S28: Generate a comprehensive industry based on the combination of industries and single industries, and replace the query industry with the comprehensive industry.
[0090] Among them, the comprehensive industry refers to the industry corresponding to the combination of multiple industries. By analyzing the combined industries and single industries, the comprehensive industry is generated and replaced with the query industry to improve the accuracy of the obtained query industry.
[0091] Furthermore, in order to improve the accuracy of the obtained comprehensive industry data, the specific steps for generating comprehensive industry data are as follows.
[0092] S281: Determine the upper-level industries of the portfolio based on the portfolio industries.
[0093] Here, "upper-level industries" refers to the industries corresponding to those above the combined industries. Different combined industries correspond to different upper-level industries. The upper-level industries are obtained by inputting the combined industries into a pre-set upper-level database for matching, facilitating subsequent use. The upper-level database pre-stores a lookup table of different combined industries and their corresponding upper-level industries, which is retrieved after pre-input.
[0094] S282: Identify a single related industry based on a single industry.
[0095] Here, a single related industry refers to the industries that are related to a single industry. Different single industries correspond to different single related industries. By inputting a single industry into a pre-set single-related database, matching it with other related industries is obtained, facilitating subsequent use. The single-related database pre-stores a lookup table of different single industries and their corresponding single-related industries, which is retrieved after pre-input.
[0096] S283: Determine if there is a consistency between the upper-level industry of the portfolio and a single related industry. If yes, proceed to S284; if no, proceed to S285.
[0097] In this process, it is determined whether the consistent industry can be directly adopted by judging whether there is consistency between the upper-level industry of the combination and the single related industry.
[0098] S284: Industries that share a common upper-level industry with a single related industry are considered as integrated industries.
[0099] When the combined upper-level industry is consistent with a single related industry, it means that the consistent industry can be directly used. Therefore, the industry that is consistent with the single related industry is taken as the comprehensive industry, thereby improving the accuracy of the obtained comprehensive industry.
[0100] S285: Retrieve query time points based on query data.
[0101] The query time point refers to the time when the user inputs the query data. By retrieving the time corresponding to the input of the query data and using it as the query time point, it is convenient for subsequent use.
[0102] S286: Determine the portfolio time period based on the portfolio industry.
[0103] The combined time period refers to the commonly used time periods when a user queries a combination of industries. Different industries correspond to different combined time periods. The combined time periods are obtained by inputting the industry combination into a pre-set combined time database for convenient subsequent use. The combined time database pre-stores a lookup table of different industries and their corresponding combined time periods, which is retrieved after pre-input.
[0104] S287: Determine the combined time deviation value based on the query time point and the combined time period.
[0105] The combined time deviation value refers to the deviation when there is a discrepancy between the query time and the time of the combined industries. It is calculated by taking the midpoint of the combined time period, then calculating the difference between the midpoint and the query time, and using this difference as the combined time deviation value for subsequent use.
[0106] S288: Determine a single time period based on a single industry.
[0107] This section provides data on commonly used time periods for users querying a single industry. Different industries correspond to different time periods. Users input a single industry into a pre-defined time database to obtain the corresponding time period, facilitating subsequent use. The time database pre-stores a lookup table of different industries and their corresponding time periods, which is retrieved after pre-input.
[0108] S289: Determine the single time deviation value based on the query time point and a single time period.
[0109] The single time deviation value refers to the deviation value when there is a discrepancy between the query time and the query time for a single industry. It is calculated by taking the midpoint of a single time period, then calculating the difference between the midpoint and the query time, and using this difference as the single time deviation value for convenient subsequent use.
[0110] S28A: Based on the comparison results of the combined time deviation value and the single time deviation value, select the combined industry or the single industry as the comprehensive industry.
[0111] Specifically, by comparing the combined time deviation value with the individual time deviation value, if the combined time deviation value is greater than the individual time deviation value, the individual industry is treated as the composite industry. If the combined time deviation value is not greater than the individual time deviation value, the combined industry is treated as the composite industry, thereby improving the accuracy of the obtained composite industry.
[0112] S3: Build a query model based on the query industry.
[0113] The query model refers to a model used to query user-input data to obtain query results. It is established by analyzing the query industry to facilitate subsequent use. The specific method for establishing the query model is described in S31 to S34.
[0114] S4: Identify user intent based on query data and input it into the query model to generate the answer to the user's needs, and output the answer to the user's needs.
[0115] The user-defined answer refers to the result corresponding to the user's input data after querying. By identifying the user's intent in the query data and inputting the identified intent into the query model, a user-defined answer is generated and output. This allows for accurate understanding of the user's natural language query and output of a matching answer, thereby improving the user's experience in querying market indicator data. The specific steps for identifying user intent and generating user-defined answers are described in S41 to S46.
[0116] In step S3, in order to further ensure the rationality of the query model, it is necessary to perform further separate analysis and calculation on the query model, which will be explained in detail through the following steps.
[0117] Reference Figure 2 The method for building a query model includes the following steps:
[0118] S31: Retrieve industry-specific terms based on industry queries.
[0119] Industry-specific terms refer to the vocabulary used within a particular industry. Different industries require different terms. By inputting the query industry into a pre-defined industry term database, matching and retrieving relevant terms, the database facilitates subsequent use. The industry term database pre-stores different query industries and their corresponding terms, and is retrieved after pre-input.
[0120] S32: Determine the expanded vocabulary and expanded output header based on industry terminology.
[0121] The expanded vocabulary refers to a collection of all possible words or characters created by converting the text corresponding to industry-specific terms into a computer-processable format. The expanded output head refers to the part that converts the model's output into the format required for a specific task based on the industry-specific vocabulary. This is achieved by segmenting the industry-specific vocabulary into words, using methods such as character-based segmentation, word-based segmentation, or sub-word-based segmentation, depending on the specific needs. After segmentation, the words are added to the expanded vocabulary to obtain the expanded vocabulary, and each word in the expanded vocabulary is unique. The number of expanded output heads is determined by the number of words expanded in the expanded vocabulary, and these are combined with preset output tasks to form the expanded output heads. Output tasks include classification, generation, and translation tasks. Output tasks are obtained through pre-input; in this embodiment, the output task is a generation task.
[0122] S33: Based on the expanded vocabulary and expanded output head, the base model is injected to form an industry model.
[0123] The base model refers to a general-purpose artificial intelligence model pre-trained on large-scale data. Base models can be Llama2, GPT-4, PaLM2, etc. In this embodiment, Llama2 is used. The industry model refers to a model corresponding to the query industry. This model is trained by injecting an expanded vocabulary and expanded output header into the base model to obtain an industry model corresponding to the query industry, facilitating subsequent use.
[0124] S34: Perform low-rank adaptive fine-tuning based on the industry model to form a query model.
[0125] In this process, a query model is formed by performing low-rank adaptive fine-tuning on the industry model, thereby improving the accuracy of the obtained query model.
[0126] In step S34, in order to further ensure the rationality of the query model, it is necessary to perform further separate analysis and calculation on the query model, which will be explained in detail through the following steps.
[0127] The process of performing low-rank adaptive fine-tuning based on an industry model to form a query model includes the following steps:
[0128] S341: Retrieve the original weight matrix based on the industry model.
[0129] The original weight matrix refers to the initial weight matrix during model training. It is obtained by retrieving the original weight matrix during the pre-training of the industry model for convenient subsequent use.
[0130] S342: Select a low-rank adapter based on the original weight matrix.
[0131] Among them, the low-rank adapter is an adapter used for fine-tuning large pre-trained language models. The low-rank adapter is selected by analyzing the original weight matrix, which facilitates its subsequent use.
[0132] S343: Merge the low-rank adapter with the industry model to form a query model.
[0133] Specifically, by merging the low-rank adapter with the industry model, the original weight matrix in the industry model is slightly adjusted, resulting in a new model that serves as the query model, thereby improving the accuracy of the obtained query model.
[0134] In step S342, in order to further ensure the rationality of the low-rank adapter, it is necessary to perform further separate analysis and calculation on the low-rank adapter, which will be explained in detail through the following steps.
[0135] Selecting a low-rank adapter based on the original weight matrix includes the following steps:
[0136] S3421: Construct the first low-rank matrix and the second low-rank matrix based on the original weight matrix.
[0137] Here, the first low-rank matrix refers to the first matrix with a relatively small rank, and the second low-rank matrix refers to the second matrix with a relatively small rank. The first and second low-rank matrices are generated by analyzing the construction of the original weight matrix, facilitating subsequent use.
[0138] S3422: Update the original weight matrix based on the first low-rank matrix and the second low-rank matrix, and define the updated original weight matrix as the updated weight matrix.
[0139] The updated weight matrix refers to the weight matrix corresponding to the updated original weight matrix. It is obtained by calculating the product between the first low-rank matrix and the second low-rank matrix, and then calculating the sum of the product with the original weight matrix, which is used as the updated weight matrix for convenient subsequent use.
[0140] S3423: Determine the loss function to use based on the original weight matrix and the updated weight matrix.
[0141] The loss function refers to the difference between the updated matrix and the adjusted matrix. The loss function is obtained by analyzing and calculating the original weight matrix and the updated weight matrix, which facilitates its subsequent use.
[0142] S3424: Determine the gradient of the low-rank matrix based on the use of a loss function.
[0143] The low-rank matrix gradient refers to the gradient obtained by backpropagation using the loss function. The backpropagation formula is: Low-rank matrix gradient = ▽L(A,B), where L is the loss function, A is the first low-rank matrix, and B is the second low-rank matrix.
[0144] S3425: Update the first low-rank matrix and the second low-rank matrix based on the gradient of the low-rank matrix, and define the updated first low-rank matrix as the first adjustment matrix and the updated second low-rank matrix as the second adjustment matrix.
[0145] Specifically, a preset gradient update formula is used to calculate and update the first and second low-rank matrices. The updated first low-rank matrix is then defined as the first adjustment matrix, and the updated second low-rank matrix is defined as the second adjustment matrix, for convenient subsequent use. The gradient update formula for adjusting the first low-rank matrix is A. new =A old -η▽L(A old B old The gradient update formula for adjusting the second low-rank matrix is B. new =B old -η▽L(A old B old A new B is the first adjustment matrix. new For the second adjustment matrix, A old B is the first low-rank matrix that has not been updated. old Let η be the first low-rank matrix that has not been updated, and let η be the preset learning rate. The learning rate is the magnitude value used to control each update. The learning rate is preset according to the actual situation.
[0146] S3426: Determine the low-rank adapter based on the first adjustment matrix and the second adjustment matrix.
[0147] Specifically, low-rank adapters are obtained by inputting the first and second adjustment matrices into a preset adapter selection database, thereby improving the accuracy of the obtained low-rank adapters. The adapter selection database pre-stores a lookup table of different first and second adjustment matrices and their corresponding low-rank adapters, and is obtained by inputting and storing the data into the database beforehand.
[0148] In step S3421, in order to further ensure the rationality of the first low-rank matrix and the second low-rank matrix, it is necessary to perform further separate analysis and calculation on the first low-rank matrix and the second low-rank matrix, which will be explained in detail through the following steps.
[0149] The steps to construct and generate the first low-rank matrix and the second low-rank matrix based on the original weight matrix are as follows:
[0150] S34211: Retrieve the output and input dimensions based on the original weight matrix.
[0151] In this context, the output dimension refers to the number of features or the dimension of the feature space corresponding to the output of the original weight matrix, while the input dimension refers to the number of features or the dimension of the feature space corresponding to the input of the original weight matrix. The original weight matrix includes both output and input dimensions. The number of features corresponding to the output is retrieved from the original weight matrix and used as the output dimension, and the number of features corresponding to the input is retrieved from the original weight matrix and used as the input dimension, thus facilitating subsequent use.
[0152] S34212: Calculate the quotient between the output dimension and the preset baseline rank value and use it as the output reference value.
[0153] The baseline rank value refers to the minimum rank value used during training, which is obtained through pre-input. The output reference value refers to the reference value corresponding to the rank value to be selected based on the output dimension. It is calculated by the quotient between the output dimension and the preset baseline rank value and used as the output reference value for subsequent use.
[0154] S34213: Calculate the quotient between the input dimension and the preset baseline rank value and use it as the input reference value.
[0155] The input reference value refers to the reference value corresponding to the rank value to be selected based on the input dimension. It is calculated by the quotient between the input dimension and the preset benchmark rank value and used as the input reference value for convenient subsequent use.
[0156] S34214: Calculate the sum of the output reference value and the input reference value and use it as the comprehensive reference value.
[0157] The comprehensive reference value refers to the comprehensive value used when selecting a reference for the rank value. It is calculated by summing the output reference value and the input reference value and used as the comprehensive reference value for convenient subsequent use.
[0158] S34215: Determine the selected rank value based on the comparison result between the comprehensive reference value and the preset reference benchmark value.
[0159] The reference benchmark value refers to the benchmark value used when employing a benchmark rank value. This reference benchmark value is obtained after pre-input. By analyzing the comparison results between the comprehensive reference value and the preset reference benchmark value, when the comprehensive reference value is less than the reference benchmark value, the benchmark rank value is directly used as the selected rank value. When the comprehensive reference value is not less than the reference benchmark value, the difference between the comprehensive reference value and the reference benchmark value is calculated and used as the reference deviation value. This reference deviation value is then input into a preset reference deviation multiple database to obtain a matching reference deviation multiple value. Finally, the product of the reference deviation multiple value and the benchmark rank value is calculated and used as the selected rank value, thereby improving the accuracy of the obtained selected rank value. The reference deviation multiple value refers to the multiple value corresponding to the multiple adjustment required for the benchmark rank value. The reference deviation multiple database pre-stores a lookup table of different reference deviation value input values and their corresponding reference deviation multiple values, and is obtained after pre-input.
[0160] S34216: Generate a first low-rank matrix based on the selected rank value and input dimension, and generate a second low-rank matrix based on the selected rank value and output dimension.
[0161] Specifically, a first low-rank matrix is formed by using the input dimension as the row values of the first low-rank matrix and selecting the rank values as the column values of the first low-rank matrix. Then, a second low-rank matrix is formed by using the output dimension as the row values of the second low-rank matrix and selecting the rank values as the column values of the second low-rank matrix, thereby improving the accuracy of the obtained first and second low-rank matrices.
[0162] In step S3423, in order to further ensure the reasonableness of the loss value, it is necessary to perform a further separate analysis and calculation on the loss value, which will be explained in detail through the following steps.
[0163] Determining the loss value based on the original weight matrix and the updated weight matrix includes the following steps:
[0164] S34231: Obtain the initial loss function.
[0165] Here, the initial loss function refers to the loss function initially used, which is the cross-entropy loss, specifically L = -∑ i y i log(p i L is the initial loss function, y i p represents the actual labels of the dataset in the industry model. i y represents the probability predicted by the industry model. i Generated through manual annotation or preset rules, p i It is formed by transforming the raw scores output from the industry model without activation function transformation into single-label or multi-label data.
[0166] S34232: Define the identifier result of the instruction part as 0 and the identifier result of the answer part as 1 to form a mask setting.
[0167] The instruction section refers to the specific question, request, or task description corresponding to the query data entered by the user that requires an answer. The answer section refers to the response content corresponding to the user's instruction. Masking is the process of selectively overriding, hiding, filtering, or manipulating specific areas. By defining the identifier result of the instruction section as 0 and the identifier result of the answer section as 1, a mask is formed for convenient subsequent use.
[0168] S34233: Based on the mask setting and the initial loss function, an adjusted loss function is formed, and the adjusted loss function is used as the loss function.
[0169] The adjusted loss function refers to the loss function obtained after adjusting the initial loss function. This adjusted loss function is formed by using a mask to adjust the initial loss function and then using it as the applied loss function to improve the accuracy of the obtained applied loss function. When the initial loss function is L=-∑ i y i log(p i When this happens, the loss function is adjusted to... m i Set the mask.
[0170] In step S4, in order to further ensure the rationality of the answer to the user's request, it is necessary to perform further separate analysis and calculation on the answer to the user's request, which will be explained in detail through the following steps.
[0171] Reference Figure 3 The method for generating answers to user needs includes the following steps:
[0172] S41: Extract key text based on query data.
[0173] Here, key words refer to the words or phrases that best represent the content of the user's query input. Matching the query data with a pre-defined basic text database yields matching text, and the remaining data (excluding matching text) is extracted as key words for later use. The basic text database stores a list of words that don't have meaning in everyday use, including commonly used words such as "I," "of," "data," and "query."
[0174] S42: Input key text into the query model to identify user intent and form key intent.
[0175] Among them, key intent refers to the user intent identified based on the words or phrases that best represent the content. By inputting key text into the query model, the user intent is identified to obtain key intent, which is convenient for subsequent use.
[0176] S43: Retrieve query results from a pre-defined knowledge graph based on key intents.
[0177] In this context, a knowledge graph refers to a semantic knowledge base used to represent different semantics or concepts and the relationships between them. Knowledge graphs are acquired through pre-input. By inputting key intents into the knowledge graph, the semantics or concepts associated with those key intents are retrieved as query results, facilitating subsequent use.
[0178] S44: Retrieve the previous result based on the query result.
[0179] The previous result refers to the result when the user made the last query. The previous query result is retrieved from the current query result and used as the previous result for convenient use in the future.
[0180] S45: Generate candidate results based on the query results and the previous results.
[0181] Candidate results refer to the results of the current query and the previous query. The query results are semantically combined with the previous results to form candidate results, which are convenient for subsequent use.
[0182] S46: Input the candidate results into the query model to obtain the matching answer, and use the matching answer as the answer required by the user.
[0183] Among them, the matching answer refers to the answer that matches the user's current intent. By inputting candidate results into the query model and analyzing them, the matching answer is obtained and used as the answer that meets the user's needs, thereby improving the accuracy of the answer obtained that meets the user's needs.
[0184] In step S46, in order to further ensure the rationality of the answer, it is necessary to perform further separate analysis and calculation on the answer, which will be explained in detail in the following steps.
[0185] The steps involved in inputting candidate results into the query model to obtain a matching answer are as follows:
[0186] S461: Generate an approximate model based on the query model.
[0187] Among them, the approximate model refers to a small language model with similar functions to the query model. The query model retrieves the query function and trains the approximate model based on the query function and the preset small language benchmark model to facilitate subsequent use.
[0188] S462: Autoregressive sampling is performed based on the candidate results input into the approximate model to generate approximate results.
[0189] Among them, the approximate result refers to the initial result with high confidence and easy to generate after analyzing the candidate results. By inputting the candidate results into the approximate model and performing autoregressive sampling, the final result is used as the approximate result, which is convenient for subsequent use.
[0190] S463: Based on the key intent and approximate results, concatenate them and input them into the query model to obtain the concatenated result.
[0191] The splicing result refers to the result formed after generating a large model from a small model and verifying it. It is obtained by splicing the key intent with the approximate result and then inputting the spliced content into the query model for verification, so as to facilitate subsequent use.
[0192] S464: Determine if the splicing result is satisfactory.
[0193] The concatenation result is input into the query model to retrieve the corresponding confidence level. The satisfaction of the concatenation result is judged by whether the confidence level is greater than the preset benchmark confidence level.
[0194] S465: If yes, continue to generate the next splicing result and combine the obtained splicing results to form a matching answer.
[0195] When the splicing result is unsatisfactory, the next splicing result is generated, and all the splicing results are combined as the correct answer, thereby improving the accuracy of the correct answer.
[0196] S466: If not, then re-concatenate the approximate result with the key intent and input it into the query model to obtain the concatenated result.
[0197] If the splicing result is unsatisfactory, the approximate result is re-sponsored with the key intent, and the spliced data is input into the query model to obtain a new splicing result. Then, the process jumps back to execute S464 until the result is satisfactory.
[0198] Based on the same inventive concept, embodiments of the present invention provide a market index data query system based on a large language model, comprising:
[0199] The acquisition module is used to acquire query data and the initial loss function;
[0200] The memory is used to store the market indicator data query method based on the large language model, as described above.
[0201] The processor loads and executes programs from memory.
[0202] Based on the same inventive concept, embodiments of the present invention provide a terminal, including a memory and a processor, wherein the memory stores a computer program that can be loaded and executed by the processor, as described above, the method for querying market index data based on a large language model.
[0203] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0204] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A method for querying market indicator data based on a large language model, characterized in that, include: S1: Collect query data input by the user; S2: Determine the industry to be queried based on the query data; S3: Establish a query model based on the aforementioned industry; S4: Identify the user's intent based on the query data and input it into the query model to generate the answer to the user's needs, and output the answer to the user's needs.
2. The method for querying market indicator data based on a large language model according to claim 1, characterized in that, Step S3 includes the following steps: S31: Retrieve industry-specific terms based on the query industry; S32: Determine the expanded vocabulary and expanded output head based on the industry terminology; S33: Based on the expanded vocabulary and the expanded output head, the data is injected into the base model to form an industry model; S34: Perform low-rank adaptive fine-tuning based on the industry model to form the query model.
3. The method for querying market indicator data based on a large language model according to claim 1, characterized in that, Step S34 includes the following steps: S341: Retrieve the original weight matrix based on the industry model; S342: Select a low-rank adapter based on the original weight matrix; S343: The low-rank adapter and the industry model are merged to form the query model.
4. The method for querying market indicator data based on a large language model according to claim 3, characterized in that, S342 includes the following steps: S3421: Construct and generate a first low-rank matrix and a second low-rank matrix based on the original weight matrix; S3422: Update the original weight matrix based on the first low-rank matrix and the second low-rank matrix, and define the updated original weight matrix as the updated weight matrix; S3423: Determine the loss function to be used based on the original weight matrix and the updated weight matrix; S3424: Determine the gradient of the low-rank matrix based on the aforementioned loss function; S3425: Update the first low-rank matrix and the second low-rank matrix based on the gradient of the low-rank matrix, and define the updated first low-rank matrix as the first adjustment matrix and the updated second low-rank matrix as the second adjustment matrix. S3426: Determine the low-rank adapter based on the first adjustment matrix and the second adjustment matrix.
5. The method for querying market index data based on a large language model according to claim 4, characterized in that, Step S3421 includes the following steps: S34211: Retrieve the output dimension and input dimension based on the original weight matrix; S34212: Calculate the quotient between the output dimension and the preset baseline rank value and use it as the output reference value; S34213: Calculate the quotient between the input dimension and the preset baseline rank value and use it as the input reference value; S34214: Calculate the sum between the output reference value and the input reference value and use it as a comprehensive reference value; S34215: Determine the selected rank value based on the comparison result between the comprehensive reference value and the preset reference benchmark value; S34216: Generate the first low-rank matrix based on the selected rank value and the input dimension, and generate the second low-rank matrix based on the selected rank value and the output dimension.
6. The method for querying market indicator data based on a large language model according to claim 3, characterized in that, Step S3423 includes the following steps: S34231: Obtain the initial loss function; S34232: Define the identifier result of the instruction part as 0 and the identifier result of the answer part as 1 to form a mask setting; S34233: Based on the mask setting and the initial loss function, an adjusted loss function is formed, and the adjusted loss function is used as the applied loss function.
7. The method for querying market indicator data based on a large language model according to claim 1, characterized in that, Step S4 includes the following steps: S41: Extract key text based on the query data; S42: Input the key text into the query model to identify user intent and form key intent; S43: Based on the key intent, retrieve query results from a preset knowledge graph; S44: Retrieve the previous result based on the query result; S45: Generate candidate results based on the query results and the previous results; S46: Input the candidate results into the query model to obtain a matching answer, and use the matching answer as the answer to the user's needs.
8. The method for querying market indicator data based on a large language model according to claim 7, characterized in that, Step S46 includes the following steps: S461: Generate an approximate model based on the query model; S462: Based on the candidate results, autoregressive sampling is performed on the approximate model to generate approximate results; S463: Based on the key intent and the approximate result, concatenate them and input them into the query model to obtain the concatenation result; S464: Determine whether the splicing result is satisfactory; S465: If yes, continue to generate the next splicing result, and combine the obtained splicing results to form the correct answer; S466: If not, then based on the approximate result, re-concatenate it with the key intent and input it into the query model to obtain the concatenation result.
9. A market index data query system based on a large language model, characterized in that, include: The acquisition module is used to acquire query data and the initial loss function; A memory for storing the market index data query method based on the large language model as described in any one of claims 1 to 8; The processor loads and executes programs from memory.
10. A terminal, characterized in that, It includes a memory and a processor, wherein the memory stores a computer program and can be loaded and executed by the processor as described in any one of claims 1 to 8, which is a method for querying market index data based on a large language model.
Citation Information
Patent Citations
Industrial data query method and device based on large model
CN118964388A
Data query method and system based on large language model
CN119557330A
Problem processing method, device and equipment based on artificial intelligence and storage medium
CN119558321A
Intelligent data query method and device, equipment, medium and product
CN119807207A
Data query method and system, computer device, and storage medium
WO2021174871A1