A futures content generation method and system based on a large language model
Patent Information
- Application Number
- CN202610875915.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-17
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2046-06-17
AI Technical Summary
[0004]为了有助于解决现有技术中大语言模型生成的期货分析文本与实时行情数据不一致,且无法根据是否存在趋势偏移选择不同处理路径进行针对性修正的问题,本申请提供一种基于大语言模型的期货内容生成方法和系统
通过提取初步期货分析文本中的多个关键实体并获取每个关键实体对应的实时数值,判断每个关键实体对应的实时数值是否与历史行情数据中的历史数值存在趋势偏移,若不存在趋势偏移则基于预设文本生成模板将初步期货分析文本转换为最终期货内容,若存在趋势偏移则获取发生趋势偏移的目标关键实体以及偏移方向,基于目标关键实体及偏移方向获取修正指令,再基于预设文本生成模板及修正指令对初步期货分析文本进行修正以生成最终期货内容。该方案能够自动检测大语言模型生成的期货分析文本中的关键实体是否与实时行情数据存在趋势偏移,并在不存在偏移时直接进行格式转换、在存在偏移时获取目标关键实体及偏移方向并生成修正指令进行针对性修正,从而有效解决了现有技术中大语言模型生成文本与实时行情数据不一致且缺乏有效检测和修正机制的技术问题,实现了生成与实时市场状态一致的最终期货内容的技术效果。
Smart Images

Figure CN122390782B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method and system for generating futures content based on a large language model. Background Technology
[0002] With the rapid development of the futures market and the continuous expansion of trading volume, market participants have an increasing demand for high-quality and efficient futures analysis content. Traditional methods of generating futures analysis content mainly rely on manual writing. Analysts review market data, technical charts, and macroeconomic information, combining their own experience to form analytical viewpoints and write articles. However, manual writing has significant limitations: firstly, the futures market contains a massive amount of data that is updated very frequently, making it difficult for humans to comprehensively process and analyze data from multiple commodities and timeframes in a short period, resulting in low content generation efficiency; secondly, different analysts have varying experiences and judgment standards, making it difficult to guarantee the objectivity and consistency of the analysis content.
[0003] In recent years, with the development of artificial intelligence technology, especially the powerful capabilities of large language models in natural language understanding and generation, some researchers have begun to explore the use of large language models to automatically generate futures analysis content. Existing technical solutions typically involve directly inputting real-time and historical market data into the large language model, which then generates the analysis text in one go. While this approach improves the efficiency of content generation to some extent, a key technical problem remains: the analysis text generated by the large language model often shows inconsistencies with real-time market data. Because large language models are trained on large-scale corpora, the content they generate is easily influenced by historical patterns in the training data. When the market experiences sudden changes or trends that deviate from historical patterns, the model may still generate analytical conclusions that contradict the current situation based on historical inertia. Current technology lacks an effective detection and correction mechanism for deviations between generated content and real-time data. It cannot automatically determine whether key entities in the generated text deviate from the trend of real-time market data, nor can it execute different processing paths based on the presence of deviations, resulting in inconsistent content being directly output and misleading users. Summary of the Invention
[0004] To help solve the problem that the futures analysis text generated by the large language model in the existing technology is inconsistent with the real-time market data, and cannot be targeted for correction by selecting different processing paths according to the existence of trend deviation, this application provides a futures content generation method and system based on the large language model.
[0005] Firstly, this application provides a futures content generation method based on a large language model, which adopts the following technical solution: A method for generating futures content based on a large language model, comprising: Obtain real-time and historical market data for the futures market; The real-time market data and the historical market data are input into the large language model to generate preliminary futures analysis text. Extract multiple key entities from the preliminary futures analysis text and obtain the real-time value corresponding to each key entity; Determine whether the real-time value corresponding to each key entity deviates from the historical value in the historical market data; If there is no trend deviation between the real-time value corresponding to each key entity and the historical value, then the preliminary futures analysis text is converted into final futures content based on the preset text generation template. If there is a trend deviation between the real-time value corresponding to each key entity and the historical value, then the target key entity where the trend deviation occurred and the direction of deviation are obtained. Based on the target key entity and the offset direction, obtain the correction instruction; Based on the preset text generation template and the correction instructions, the preliminary futures analysis text is corrected to generate the final futures content.
[0006] Optionally, extracting multiple key entities from the preliminary futures analysis text and obtaining the real-time value corresponding to each key entity includes: Identify the futures commodity entity, time entity, and price entity in the preliminary futures analysis text; Associate the futures contract entity with the time entity to generate a contract-time key-value pair; Based on the product-time key-value pair, the corresponding real-time price value is matched from the real-time market data; Alignment verification is performed between the price entity and the real-time price value; If the alignment check passes, the real-time price value will be used as the real-time price value corresponding to the price entity. If the alignment check fails, the extraction process is triggered again until the alignment check passes or the maximum number of retries is reached.
[0007] Optionally, determining whether the real-time value corresponding to each key entity deviates from the historical value in the historical market data includes: Obtain the real-time change slope of the real-time value corresponding to each key entity; Obtain the historical change slope of the historical values corresponding to each key entity; Calculate the slope difference between the real-time change slope and the historical change slope; Determine whether the slope difference exceeds a preset slope threshold; If the slope difference exceeds the preset slope threshold, it is determined that there is a trend deviation; If the slope difference does not exceed the preset slope threshold, the number of consecutive times that it does not exceed the threshold is obtained. When the number of consecutive times that it does not exceed the threshold reaches the preset number of consecutive times, it is determined that there is no trend deviation.
[0008] Optionally, after determining that a trend shift exists if the slope difference exceeds the preset slope threshold, the method further includes: Obtain the length of the continuous time window in which the trend shift occurs; Determine whether the length of the continuous time window exceeds a preset time window threshold; If the length of the continuous time window does not exceed the preset time window threshold, the ratio of the rate of change of the real-time change slope to the rate of change of the historical change slope is obtained, and the temporary offset level is determined based on the ratio of the rate of change. If the length of the continuous time window exceeds the preset time window threshold, the cumulative offset between the real-time change slope and the historical change slope is obtained, and the permanent offset level is determined based on the cumulative offset. The number of times the correction instruction is executed is adjusted based on the temporary offset level or the permanent offset level.
[0009] Optionally, after obtaining the target key entity where the trend shift occurs and the shift direction, the method further includes: Based on the target key entity, obtain the corresponding set of associated entities; Determine whether there exists at least one associated entity in the set of associated entities whose real-time value is in the opposite direction to the historical value; If at least one of the associated entities in the set of associated entities has a real-time value that is offset from the historical value, then the associated entity with the offset is obtained as the offset entity. Based on the target key entity, the offset entity, and the offset direction, a hedging offset marker is generated; The correction strength of the correction command is adjusted based on the hedging offset mark.
[0010] Optionally, obtaining the corresponding set of associated entities based on the target key entity includes: Obtain the entity category label of the target key entity; Based on the entity category labels, retrieve first-level related entities that have a direct connection relationship with the target key entity from the pre-generated futures association map; Obtain the association strength value between each primary related entity and the target key entity; First-level associated entities whose association strength values exceed a preset association strength threshold are selected to form an initial set of associated entities; Determine whether the number of entities in the initial associated entity set is lower than the minimum number threshold; If the number of entities in the initial associated entity set is not less than the minimum number threshold, then the initial associated entity set is used as the associated entity set. If the number of entities in the initial set of associated entities is lower than the minimum threshold, then secondary associated entities that have a direct connection with the primary associated entities are retrieved from the futures association graph. The secondary related entities are added to the initial related entity set until the number of entities reaches the minimum number threshold or there are no more searchable next-level related entities, thus forming the related entity set.
[0011] Optionally, after generating the hedging offset marker based on the target key entity, the offset entity, and the offset direction, the method further includes: Obtain the offset magnitude of the target key entity and the reverse offset magnitude of the offset entity; Determine whether the offset magnitude is greater than the reverse offset magnitude; If the offset magnitude is greater than the reverse offset magnitude, the correction instruction is retained, and the correction intensity is adjusted to the first intensity. If the offset amplitude is not greater than the reverse offset amplitude, then determine whether the offset amplitude is equal to the reverse offset amplitude; If the offset magnitude is equal to the reverse offset magnitude, a cancellation correction instruction is generated; If the offset magnitude is less than the reverse offset magnitude, a reverse correction instruction is generated, which is used to instruct correction according to the reverse offset magnitude.
[0012] Optionally, the correction instructions include upward correction instructions and downward correction instructions; obtaining the correction instructions based on the target key entity and the offset direction includes: Obtain the location and frequency of the target key entity in the preliminary futures analysis text; Determine whether the offset direction is a positive offset; If the offset direction is positive, an upward adjustment instruction is generated. The upward adjustment instruction is used to instruct the numerical representation of the target key entity at the occurrence position to be increased, and the increase magnitude is determined based on the occurrence frequency. If the offset direction is negative, a downward adjustment instruction is generated. The downward adjustment instruction is used to instruct the numerical representation of the target key entity at the occurrence position to be reduced, and the reduction magnitude is determined based on the occurrence frequency.
[0013] Optionally, the step of revising the preliminary futures analysis text based on the preset text generation template and the revision instructions to generate the final futures content includes: The preset text generation template is parsed to obtain multiple fields to be filled and the field type of each field to be filled; Based on the correction instructions, extract the original content that matches each field to be filled from the preliminary futures analysis text; Determine whether the original content conflicts with the correction instruction; If the original content conflicts with the correction instruction, the original content is overwritten according to the correction instruction to generate fill content; If the original content does not conflict with the correction instruction, the original content is retained as the fill content; The filled content is then entered into the corresponding fields to generate the final futures content.
[0014] Secondly, this application also discloses a futures content generation system based on a large language model, which adopts the following technical solution: A futures content generation system based on a large language model includes: The data acquisition module is used to acquire real-time and historical market data in the futures market. The initial generation module is used to input the real-time market data and the historical market data into the large language model to generate preliminary futures analysis text. The entity extraction module is used to extract multiple key entities from the preliminary futures analysis text and obtain the real-time value corresponding to each key entity. The offset judgment module is used to determine whether the real-time value corresponding to each key entity has a trend offset from the historical value in the historical market data. If the real-time value corresponding to each key entity does not deviate from the historical value in terms of trend, the first execution module is used to convert the preliminary futures analysis text into final futures content based on a preset text generation template. The anomaly detection module is used to detect the target key entity and the direction of the trend deviation if the real-time value corresponding to each key entity deviates from the historical value. The correction acquisition module is used to acquire correction instructions based on the target key entity and the offset direction; The second execution module is used to revise the preliminary futures analysis text based on the preset text generation template and the revision instructions, and generate the final futures content.
[0015] In summary, this application includes the following beneficial technical effects: By extracting multiple key entities from the preliminary futures analysis text and obtaining the corresponding real-time values for each key entity, the system determines whether there is a trend deviation between the real-time values corresponding to each key entity and the historical values in the historical market data. If no trend deviation exists, the preliminary futures analysis text is converted into final futures content based on a preset text generation template. If a trend deviation exists, the system obtains the target key entity and the direction of the deviation, generates correction instructions based on the target key entity and the direction of the deviation, and then corrects the preliminary futures analysis text based on the preset text generation template and the correction instructions to generate the final futures content. This solution can automatically detect whether the key entities in the futures analysis text generated by the large language model have a trend deviation from the real-time market data. When no deviation exists, it directly performs format conversion; when a deviation exists, it obtains the target key entity and the direction of the deviation and generates correction instructions for targeted correction. This effectively solves the technical problem in existing technologies where the text generated by the large language model is inconsistent with the real-time market data and lacks an effective detection and correction mechanism, achieving the technical effect of generating final futures content consistent with the real-time market state. Attached Figure Description
[0016] Figure 1 This is a main flowchart of a futures content generation method based on a large language model according to an embodiment of this application; Figure 2 This is a flowchart of steps S201 to S206; Figure 3 This is a flowchart of steps S301 to S306; Figure 4 This is a flowchart of steps S401 to S405; Figure 5 This is a flowchart of steps S501 to S505; Figure 6 This is a flowchart of steps S601 to S608; Figure 7 This is a flowchart of steps S701 to S706; Figure 8 This is a flowchart of steps S801 to S804; Figure 9 This is a flowchart of steps S901 to S906; Figure 10This is a module diagram of a futures content generation system based on a large language model, according to an embodiment of this application.
[0017] Explanation of reference numerals in the attached figures: 1. Data acquisition module; 2. Preliminary generation module; 3. Entity extraction module; 4. Offset judgment module; 5. First execution module; 6. Anomaly acquisition module; 7. Correction acquisition module; 8. Second execution module. Detailed Implementation
[0018] Firstly, this application discloses a method for generating futures content based on a large language model.
[0019] Reference Figure 1 A method for generating futures content based on a large language model, comprising steps S101 to S108: Step S101: Obtain real-time and historical market data from the futures market.
[0020] Specifically, real-time market data generated in the futures market at any given moment is obtained through data interfaces or market terminals. This includes the latest transaction price, bid and ask prices, trading volume, and open interest—instantaneous information reflecting the current market state. Simultaneously, historical market data from the past period is acquired, such as daily and minute-by-minute data from the past week, month, or quarter. These stored past market records are used to identify trends and patterns. Real-time and historical market data together serve as the foundation for subsequent analysis.
[0021] Step S102: Input real-time market data and historical market data into the large language model to generate preliminary futures analysis text.
[0022] Specifically, the acquired real-time and historical market data are organized into prompts according to a preset input format and then input into a large-scale pre-trained language model based on deep learning technology (i.e., a large language model, such as the GPT series models, which can understand and generate natural language text). Based on the input data and its built-in financial domain knowledge, the model generates a raw analysis text without any post-processing, called preliminary futures analysis text. This text includes judgments on the current market trend, analysis of key price levels, and views on future market trends.
[0023] Step S103: Extract multiple key entities from the preliminary futures analysis text and obtain the real-time value corresponding to each key entity.
[0024] Specifically, natural language processing is performed on the generated preliminary futures analysis text to identify core words or phrases with specific semantic meanings, i.e., key entities, such as futures contract names, time points, and price values. After identification, for each key entity, the real-time market data for that entity is retrieved from real-time market data, i.e., the real-time value, such as the latest price of rebar, which is used to subsequently determine whether the text content is consistent with the real market data.
[0025] Step S104: Determine whether the real-time value corresponding to each key entity deviates from the historical value in the historical market data.
[0026] Specifically, the real-time values of each key entity are compared with the historical values in the corresponding historical market data to determine whether there is a trend deviation. That is, whether the direction, magnitude, or rate of change of the real-time value differs significantly from the typical performance of the historical value under the same or similar conditions. For example, historically, rebar prices usually show a slow upward trend at 10:00 AM, but today at the same time, they have fallen rapidly, which is considered a trend deviation.
[0027] Step S105: If there is no trend deviation between the real-time value and the historical value corresponding to each key entity, the preliminary futures analysis text is converted into the final futures content based on the preset text generation template.
[0028] Specifically, if there is no trend deviation between the real-time values and historical values of all key entities, it indicates that the content of the preliminary futures analysis text is basically consistent with the current market performance. At this point, a pre-built structured document framework with a defined final output format is obtained, i.e., a preset text generation template, which contains multiple fields to be filled and the logical relationships between the fields. The content in the preliminary futures analysis text is mapped and filled according to the template requirements, converting it into formal analysis text that has been formatted and standardized and can be directly used for publication or push to users; this is called the final futures content.
[0029] Step S106: If there is a trend deviation between the real-time value and the historical value corresponding to each key entity, then obtain the target key entity where the trend deviation occurred and the direction of the deviation.
[0030] Specifically, if there is a trend deviation between the real-time value and the historical value of at least one key entity, the first step is to identify which key entity has deviated. This entity is called the target key entity, and it is the core factor causing the trend deviation. Simultaneously, the direction of the deviation is determined, i.e., a positive or negative deviation. A positive deviation indicates that the real-time value's trend is stronger or more positive than the historical trend, such as a faster rate of price increase; a negative deviation indicates that the real-time value's trend is weaker or more negative than the historical trend, such as a faster rate of price decrease than historically normal.
[0031] Step S107: Obtain correction instructions based on the target key entity and offset direction.
[0032] Specifically, based on the obtained target key entities and their offset directions, a structured operation command, namely a correction instruction, is generated to indicate how to adjust the relevant content in the preliminary futures analysis text. If the offset direction is positive, an upward correction instruction is generated to increase the numerical representation of the entity or strengthen its viewpoint; if the offset direction is negative, a downward correction instruction is generated to decrease its numerical representation or weaken its viewpoint.
[0033] Step S108: Based on the preset text generation template and correction instructions, correct the preliminary futures analysis text to generate the final futures content.
[0034] Specifically, by combining a preset text generation template with generated correction instructions, the initial futures analysis text is revised. This includes replacing numerical values, adjusting the strength of adjectives or adverbs, and adding or deleting certain analytical statements. After revision, the final futures content is generated according to the template's format requirements, conforming to the format specifications and accurately reflecting the current real-time market trends.
[0035] Reference Figure 2 In one embodiment of this example, extracting multiple key entities from the preliminary futures analysis text and obtaining the real-time value corresponding to each key entity includes steps S201 to S206: Step S201: Identify the futures commodity entity, time entity, and price entity in the preliminary futures analysis text.
[0036] Specifically, the preliminary futures analysis text is segmented and named entity recognition is performed to identify three types of key entities: futures commodity entities (i.e., specific futures contract names or commodity names, such as iron ore, PTA, gold, etc.), time entities (i.e. time-related words in the text, such as today, yesterday, 14:30, closing time, etc.), and price entities (i.e. specific values and their units, such as 3850 yuan / ton, up 2.5%, breaking through 4000 points, etc.).
[0037] Step S202: Associate the futures contract entity with the time entity to generate a contract-time key-value pair.
[0038] Specifically, the identified futures commodity entities and time entities are associated according to their co-occurrence in the text, generating a data structure that binds futures commodities to specific time points, i.e., commodity-time key-value pairs, such as {commodity: rebar, time: after today's opening}. If a futures commodity entity and a time entity appear in the same sentence or adjacent context, they are paired for subsequent matching of corresponding values from market data.
[0039] Step S203: Based on the product-time key-value pair, match the corresponding real-time price value from the real-time market data.
[0040] Specifically, for each generated product-time key-value pair, the system searches the real-time market data for the actual transaction price or quote recorded at a specific time point that matches the product and time conditions; that is, the real-time price value. For example, if the time in the key-value pair is "today's opening", then the price at the opening of the product today is taken; if the time is "14:30", then the transaction price at that moment is taken.
[0041] Step S204: Align and verify the price entity with the real-time price value.
[0042] Specifically, the identified price entities are aligned one-to-one with the matched real-time price values to determine if they match. This verification process, which checks whether the text description matches the actual data, is called alignment verification. Alignment verification includes checking the equality of numerical values (e.g., 3850 to 3850) and the consistency of units (e.g., yuan / ton to yuan / ton). If both the numerical value and the unit match, the alignment verification passes; otherwise, it fails.
[0043] Step S205: If the alignment check passes, the real-time price value is used as the real-time value corresponding to the price entity.
[0044] Specifically, if the alignment check passes, it means that the description of the price entity in the preliminary futures analysis text is consistent with the real-time market data. At this point, the real-time price value is used as the real-time value corresponding to the price entity for subsequent trend deviation judgment.
[0045] Step S206: If the alignment check fails, trigger the re-extraction process until the alignment check passes or the maximum number of retries is reached.
[0046] Specifically, if the alignment check fails, it indicates that the price entities in the initial futures analysis text do not match the real-time market data, possibly due to identification errors or data delays. In this case, a re-extraction process is triggered, which involves re-executing the identification, association, matching, and alignment check operations to attempt to identify entities and match values again. The system presets a maximum allowed number of retries (e.g., 3 times) to prevent infinite loops. If the check still fails after reaching this number of retries, the retries stop, the exception is recorded, and manual intervention is required.
[0047] Reference Figure 3 In one embodiment of this invention, determining whether the real-time value corresponding to each key entity deviates from the historical value in the historical market data includes steps S301 to S306: Step S301: Obtain the real-time change slope of the real-time value corresponding to each key entity.
[0048] Specifically, for each key entity, its real-time numerical sequence within the most recent continuous time window (e.g., the most recent 5 minutes or 10 sampling points) is taken, and the linear trend of this sequence is calculated to obtain a mathematical index describing the speed and direction of real-time numerical change, namely the real-time change slope. A positive slope indicates that the value is rising, a negative slope indicates that the value is falling, and the larger the absolute value, the faster the change.
[0049] Step S302: Obtain the historical change slope of the historical values corresponding to each key entity.
[0050] Specifically, for the same key entity, historical value sequences with the same time window length and time period type (e.g., both from 10:00 AM to 10:05 AM) are extracted from historical market data, and their slope is calculated, called the historical slope. This slope represents the typical trend of the entity under the same historical conditions and serves as a benchmark for judging whether the current situation is abnormal.
[0051] Step S303: Calculate the slope difference between the real-time slope and the historical slope.
[0052] Specifically, the slope difference is calculated by subtracting the historical slope from the real-time slope, resulting in a quantitative value used to measure the difference between the current trend and the historical trend. A positive value indicates that the real-time slope is greater than the historical slope, while a negative value indicates that the real-time slope is less than the historical slope.
[0053] Step S304: Determine whether the slope difference exceeds the preset slope threshold.
[0054] Specifically, a pre-set empirical or statistical value, i.e., a preset slope threshold, is obtained. This represents the allowable range of slope deviation; anything exceeding this range is considered a significant difference. The absolute value of the calculated slope difference is then determined to be greater than this threshold.
[0055] Step S305: If the slope difference exceeds the preset slope threshold, it is determined that there is a trend deviation.
[0056] Specifically, if the slope difference exceeds the preset slope threshold, it indicates that the real-time change trend of the current key entity has changed significantly compared with the historical typical trend. At this time, it is determined that the key entity has a trend deviation, and the relevant content of the entity needs to be corrected in the future.
[0057] Step S306: If the slope difference does not exceed the preset slope threshold, then obtain the number of consecutive times that it does not exceed the threshold. When the number of consecutive times that it does not exceed the threshold reaches the preset number of consecutive times, it is determined that there is no trend deviation.
[0058] Specifically, if the slope difference does not exceed the preset slope threshold, it indicates that the difference at the current moment is not significant, but it cannot be immediately determined that there is no offset; it may be an occasional fluctuation. In this case, the number of consecutive times the slope difference does not exceed the threshold is obtained for the key entity, meaning that the slope difference does not exceed the threshold for multiple consecutive monitoring periods. The system presets a threshold for stability judgment (e.g., 5 times), called the preset consecutive count, to eliminate the interference of instantaneous noise. Only when the consecutive consecutive count reaches this value is it finally determined that there is no trend offset; otherwise, monitoring continues.
[0059] Reference Figure 4 In one embodiment of this example, if the slope difference exceeds a preset slope threshold, after determining that a trend shift exists, steps S401 to S405 are further included: Step S401: Obtain the length of the continuous time window in which the trend shift occurs.
[0060] Specifically, for key target entities that have been identified as having a trend deviation, the duration of this deviation is recorded, known as the continuous time window length. This length is calculated from the first time the slope difference is detected to exceed the threshold until the current moment, in minutes or sampling periods, and is used to distinguish whether the deviation is temporary or persistent.
[0061] Step S402: Determine whether the length of the continuous time window exceeds the preset time window threshold.
[0062] Specifically, a pre-set time value is obtained to distinguish the boundary between temporary and permanent offsets, i.e., a preset time window threshold, such as 10 minutes or 20 sampling periods. It is then determined whether the length of the continuous time window is greater than this threshold.
[0063] Step S403: If the length of the continuous time window does not exceed the preset time window threshold, obtain the ratio of the rate of change of the real-time change slope to the rate of change of the historical change slope, and determine the temporary offset level based on the ratio of the rate of change.
[0064] Specifically, if the length of the continuous time window does not exceed a preset time window threshold, the rate of change ratio is calculated, which is the absolute value of the real-time change slope divided by the absolute value of the historical change slope. This ratio reflects the severity of the current offset relative to the historical typical trend. Different temporary offset levels are defined based on the magnitude of this ratio; for example, a ratio between 1 and 1.5 is level one, and between 1.5 and 2 is level two, used to indicate the intensity of the offset.
[0065] Step S404: If the length of the continuous time window exceeds the preset time window threshold, obtain the cumulative offset of the real-time change slope and the historical change slope, and determine the permanent offset level based on the cumulative offset.
[0066] Specifically, if the length of the continuous time window exceeds a preset time window threshold, the cumulative deviation between the real-time values and the historical trend prediction values within the entire continuous time window is calculated; this is the cumulative offset, an integral quantity reflecting the overall magnitude of the offset. Different permanent offset levels are determined based on the magnitude of the cumulative offset, indicating that the offset has become long-term and may require more thorough correction.
[0067] Step S405: Adjust the number of times the correction instruction is executed based on the temporary offset level or the permanent offset level.
[0068] Specifically, depending on whether the offset is temporary or permanent, the number of times the adjustment instruction is repeatedly applied, i.e., the number of executions, is determined. For temporary offset levels, only one adjustment or a small adjustment may be required; for permanent offset levels, the adjustment may need to be repeated multiple times, or continuously executed throughout the offset duration, to ensure that the final futures content accurately reflects market changes.
[0069] Reference Figure 5 In one embodiment of this invention, after obtaining the target key entity where the trend shift occurs and the shift direction, steps S501 to S505 are further included: Step S501: Based on the target key entity, obtain the corresponding set of related entities.
[0070] Specifically, taking the target key entity as the center, other entities with related relationships are searched from a graph-structured knowledge base (i.e., a pre-generated futures association graph, where nodes represent futures-related entities and edges represent the relationships between entities). These entities are called associated entities. All associated entities form an associated entity set, including commodities with the same industrial chain links as the target key entity, commodities with substitution or complementarity relationships, or commodities that have historically fluctuated in the same or opposite directions.
[0071] Step S502: Determine whether there is at least one related entity in the set of related entities whose real-time value is offset from its historical value.
[0072] Specifically, for each associated entity in the acquired set of associated entities, the aforementioned method for judging trend deviation is used to determine whether there is a reverse deviation between its real-time value and historical value, that is, whether the deviation direction of the associated entity is opposite to the deviation direction of the target key entity. For example, the target key entity shows a positive deviation (accelerated price increase), while a certain associated entity shows a negative deviation (accelerated price decrease).
[0073] Step S503: If at least one related entity in the related entity set has a real-time value that is offset from its historical value, then the related entity with the offset is obtained as the offset entity.
[0074] Specifically, if at least one related entity exhibits a reverse offset, these related entities that have reversed offsets and whose market performance is opposite to that of the target key entity are extracted and called offsetting entities. Offsetting entities may have a hedging effect on the overall market assessment.
[0075] Step S504: Generate hedging offset markers based on the target key entity, the offset entity, and the offset direction.
[0076] Specifically, the target key entity, the offset entity, and the offset direction of the target key entity are combined to generate a symbol or data structure used to identify the existence of opposite trends in the market, namely the hedging offset marker. This marker indicates that the offset of the target key entity may be partially or completely hedged by the reverse offset of the offset entity.
[0077] Step S505: Adjust the correction strength of the correction command based on the offset offset mark.
[0078] Specifically, based on the generated hedging offset markers, the correction strength of the previously generated correction instructions is adjusted. Correction strength is categorized into different levels, such as mild, moderate, and severe. If a strong reverse offset hedging exists, the correction strength is reduced; that is, the initial futures analysis text should not be significantly adjusted. If the reverse offset is weak or nonexistent, the correction strength is maintained or increased to ensure the text accurately reflects the true offset degree of the target key entity.
[0079] Reference Figure 6 In one embodiment of this invention, obtaining the corresponding set of associated entities based on the target key entity includes steps S601 to S608: Step S601: Obtain the entity category label of the target key entity.
[0080] Specifically, for the identified key entities, their corresponding entity category labels are obtained from the entity classification system. These labels are classification markers used to describe entity types, such as "energy products," "agricultural products," "main contract," "continuous contract," and "near-month contract." Different categories of entities have different connection relationships in the association graph.
[0081] Step S602: Based on the entity category label, retrieve the first-level related entities that have a direct connection relationship with the target key entity from the pre-generated futures association graph.
[0082] Specifically, using the obtained entity category tags as search criteria, a search is conducted in the pre-generated futures association graph to find entity nodes that are directly connected to the target key entity node (i.e., reachable in one hop). These entities are called first-level associated entities, such as "iron ore" and "hot-rolled coil" which are directly associated with "rebar".
[0083] Step S603: Obtain the association strength value between each primary related entity and the target key entity.
[0084] Specifically, for each first-level related entity retrieved, the weight value of the edge between it and the target key entity is obtained from the futures association graph. This weight value is called the association strength value. The association strength value is usually assigned based on the correlation coefficient of historical data, the dependence of upstream and downstream in the industry chain, or expert knowledge. The value range is generally between 0 and 1, and the larger the value, the stronger the association between the two entities.
[0085] Step S604: Filter out first-level associated entities whose association strength values exceed the preset association strength threshold to form an initial set of associated entities.
[0086] Specifically, a pre-set threshold is obtained to filter out entities with weak associations, i.e., a preset association strength threshold, such as 0.7. From all first-level associated entities, entities with association strength values greater than this threshold are selected and grouped into a set, called the initial associated entity set.
[0087] Step S605: Determine whether the number of entities in the initial associated entity set is lower than the minimum number threshold.
[0088] Specifically, obtain a minimum number of entities to ensure statistical significance for subsequent analysis, i.e., a minimum threshold, such as 3. Count the number of entities in the initial set of associated entities and determine if it is less than the minimum threshold.
[0089] Step S606: If the number of entities in the initial associated entity set is not less than the minimum number threshold, then the initial associated entity set is used as the associated entity set.
[0090] Specifically, if the number of entities in the initial set of associated entities is greater than or equal to the minimum threshold, it means that the current number of associated entities is sufficient, and the initial set of associated entities is directly used as the final set of associated entities for subsequent steps.
[0091] Step S607: If the number of entities in the initial associated entity set is lower than the minimum number threshold, then retrieve the second-level associated entities that have a direct connection relationship with the first-level associated entities from the futures association graph.
[0092] Specifically, if the number of entities in the initial set of associated entities is below a minimum threshold, an extended search is performed to find entity nodes in the graph that are indirectly connected to the target key entity (i.e., reachable in two hops) through first-level associated entities. These entities are called second-level associated entities. The search method starts from each first-level associated entity and searches for entities directly connected to it.
[0093] Step S608: Add secondary related entities to the initial related entity set until the number of entities reaches the minimum threshold or there are no more searchable next-level related entities, thus forming a related entity set.
[0094] Specifically, the retrieved second-level related entities are added to the initial related entity set. After each addition, the number of entities in the set is recounted. If the number reaches the minimum threshold, addition stops, and this set is used as the final related entity set. If there are no more searchable next-level related entities (i.e., third-level and above related entities do not exist or have been searched), addition stops even if the number has not yet reached the threshold, and the current set is used as the related entity set.
[0095] Reference Figure 7In one embodiment of this invention, after generating the offsetting offset marker based on the target key entity, the offsetting entity, and the offset direction, steps S701 to S706 are further included: Step S701: Obtain the offset magnitude of the target key entity and the reverse offset magnitude of the counteracting entity.
[0096] Specifically, for each target key entity, the degree to which its real-time value deviates from the historical trend is calculated, i.e., the offset magnitude, usually expressed as a slope difference or percentage, such as the real-time change slope being 0.5 greater than the historical change slope. Simultaneously, for each offset entity, the degree to which it deviates from the historical trend in the opposite direction is calculated, i.e., the reverse offset magnitude.
[0097] Step S702: Determine whether the offset amplitude is greater than the reverse offset amplitude.
[0098] Specifically, the offset magnitude of the target critical entity is compared with the reverse offset magnitude of the offsetting entity to determine whether the offset magnitude is greater than the reverse offset magnitude. If it is greater, it indicates that the dominant trend of the target critical entity is stronger than the hedging effect of the offsetting entity.
[0099] Step S703: If the offset amplitude is greater than the reverse offset amplitude, retain the correction command and adjust the correction intensity to the first intensity.
[0100] Specifically, if the offset magnitude is greater than the reverse offset magnitude, it indicates that the positive or negative trend of the target key entity still dominates and cannot be completely hedged. In this case, the previously generated correction instruction is retained without canceling the correction, and the correction intensity is adjusted to a preset medium intensity level, i.e., the first intensity, which means that a correction is needed but the magnitude is slightly lower than in the case without hedging.
[0101] Step S704: If the offset amplitude is not greater than the reverse offset amplitude, then determine whether the offset amplitude is equal to the reverse offset amplitude.
[0102] Specifically, if the offset amplitude is not greater than the reverse offset amplitude, then it is further determined whether the two are equal, that is, whether the values of the offset amplitude and the reverse offset amplitude are the same or differ within the allowable error range.
[0103] Step S705: If the offset magnitude is equal to the reverse offset magnitude, then generate a cancel correction command.
[0104] Specifically, if the offset magnitude equals the reverse offset magnitude, it indicates that the positive or negative trend of the target key entity has been offset, the reverse trend of the entity has been completely hedged, and there is no significant net offset in the overall market. At this time, a special operation command is generated to indicate that no further corrections will be made, i.e., the correction instruction is canceled, and the original content will be retained as the final futures content.
[0105] Step S706: If the offset magnitude is less than the reverse offset magnitude, a reverse correction instruction is generated. The reverse correction instruction is used to indicate that correction should be performed according to the reverse offset magnitude.
[0106] Specifically, if the offset magnitude is less than the reverse offset magnitude, it indicates that the reverse trend of the offsetting entity is stronger than the positive trend of the target key entity, and the overall market actually shows a change opposite to the offset direction of the target key entity. At this time, an operation command is generated to indicate that the correction should be made in the opposite direction to the original offset direction, i.e., a reverse correction command. This command specifies the magnitude of the reverse offset and the correction direction.
[0107] Reference Figure 8 In one embodiment of this invention, obtaining the correction instruction based on the target key entity and the offset direction includes steps S801 to S804: Step S801: Obtain the location and frequency of the target key entity in the preliminary futures analysis text.
[0108] Specifically, for the identified key entities, a full-text search is performed on the initial futures analysis text to record the start and end positions of each occurrence of the entity, i.e., the occurrence position, which is used to locate the specific sentences or paragraphs that need to be modified. At the same time, the total number of times the entity appears in the text is counted, i.e., the frequency of occurrence, which is used to determine the extent of the correction or the number of times to repeat the correction. The higher the frequency, the greater the importance of the entity in the text.
[0109] Step S802: Determine whether the offset direction is positive.
[0110] Specifically, based on the obtained offset direction, it is determined whether the offset is positive, that is, whether the real-time value change trend is more positive or stronger than the historical trend, such as accelerated price increases or increased trading volume. If it is a positive offset, an upward adjustment is performed; if it is a negative offset, a downward adjustment is performed.
[0111] Step S803: If the offset direction is positive, an upward adjustment instruction is generated. The upward adjustment instruction is used to indicate that the numerical representation of the target key entity is increased at the occurrence position, and the increase is determined based on the occurrence frequency.
[0112] Specifically, if the offset direction is positive, an upward adjustment command is generated. This is an operational command that instructs the increase of the numerical description related to the target key entity at each occurrence position. For example, changing "slight increase" to "significant increase", or changing "3800 yuan / ton" to "3810 yuan / ton". The increase is determined based on the frequency of occurrence; the higher the frequency, the larger the increase or the more significant the modification.
[0113] Step S804: If the offset direction is negative, a reduction correction instruction is generated. The reduction correction instruction is used to indicate the reduction of the numerical representation of the target key entity at the occurrence location, and the reduction magnitude is determined based on the occurrence frequency.
[0114] Specifically, if the offset direction is negative, a downward adjustment instruction is generated. This is an operational command that instructs the reduction of the numerical description related to the key entity at each occurrence position. For example, changing "high-level oscillation" to "under pressure and decline", or changing "3850 yuan / ton" to "3830 yuan / ton". The reduction amount is determined based on the frequency of occurrence; the higher the frequency, the greater the reduction or the more significant the modification.
[0115] Reference Figure 9 In one embodiment of this invention, the preliminary futures analysis text is corrected based on a preset text generation template and correction instructions to generate the final futures content, including steps S901 to S906: Step S901: Parse the preset text generation template to obtain multiple fields to be filled and the field type of each field to be filled.
[0116] Specifically, a preset text generation template is obtained, parsed, and reserved variable placeholders are extracted, i.e., the fields to be filled, such as "{Product Name}", "{Current Price}", "{Trend Judgment}", "{Risk Warning}", etc. Simultaneously, the data category of each field to be filled is obtained, i.e., the field type, including numeric (such as price, percentage change), text (such as descriptive statements), time (such as specific time), and enumeration (such as "rise / fall / oscillation"), etc. Different types of fields require different processing methods during subsequent filling.
[0117] Step S902: Based on the correction instruction, extract the original content that matches each field to be filled from the preliminary futures analysis text.
[0118] Specifically, based on the parsed fields to be filled and combined with the generated correction instructions, text fragments that semantically match each field are extracted from the preliminary futures analysis text; that is, the original content. For example, for the "{current price}" field, the specific price value and unit are extracted from the text; for the "{trend judgment}" field, keywords or phrases describing the trend are extracted.
[0119] Step S903: Determine whether the original content conflicts with the correction instruction.
[0120] Specifically, the extracted original content is compared with the correction instructions to determine if there are any conflicts. Conflicts can manifest as follows: the value or direction of the original content is opposite to that of the correction instructions; the intensity level of the original content does not match the requirements of the correction instructions; or the original content is missing key information that the correction instructions require to be modified. If a conflict exists, an overwrite operation is performed; if no conflict exists, the original content is retained.
[0121] Step S904: If there is a conflict between the original content and the correction instruction, the original content is overwritten according to the correction instruction to generate the fill content.
[0122] Specifically, if a conflict exists, the correction instruction prevails. The relevant part of the original content is directly replaced with the value, direction, or description required by the correction instruction. This operation is called overwriting. For example, if the original content is "prices rose slightly," but the correction instruction requires an increase in intensity, it is changed to "prices rose significantly." The content generated after overwriting is called filler content.
[0123] Step S905: If there is no conflict between the original content and the correction instruction, the original content is retained as the filling content.
[0124] Specifically, if there are no conflicts, it means the original content is already consistent with the correction instructions and no modifications are needed. In this case, the original content is simply retained as fill content without any adjustments.
[0125] Step S906: Fill the corresponding fields with the content to be filled to generate the final futures content.
[0126] Specifically, the generated content is filled into the corresponding fields one by one, according to the position of each field to be filled in the template. After all fields are filled, a complete and structured text is formed, which is the final futures content, and can be used for publishing, pushing, or storage.
[0127] Secondly, this application also discloses a futures content generation system based on a large language model.
[0128] Reference Figure 10 A futures content generation system based on a large language model includes: The data acquisition module is used to acquire real-time and historical market data in the futures market. The initial generation module is used to input real-time market data and historical market data into the large language model to generate preliminary futures analysis text. The entity extraction module is used to extract multiple key entities from the preliminary futures analysis text and obtain the real-time value corresponding to each key entity. The offset judgment module is used to determine whether the real-time value corresponding to each key entity has a trend offset from the historical value in the historical market data; If there is no trend deviation between the real-time value and the historical value corresponding to each key entity, the first execution module is used to convert the preliminary futures analysis text into the final futures content based on the preset text generation template. The anomaly detection module is used to detect the target key entity and the direction of the trend deviation if there is a trend deviation between the real-time value and the historical value corresponding to each key entity. The correction acquisition module is used to acquire correction instructions based on the target key entity and the offset direction; The second execution module is used to revise the preliminary futures analysis text based on the preset text generation template and correction instructions, and generate the final futures content.
[0129] The above are all preferred embodiments of this application, and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.
Claims
1. A futures content generation method based on a large language model, characterized in that, include: Obtain real-time and historical market data for the futures market; The real-time market data and the historical market data are input into the large language model to generate preliminary futures analysis text. Extract multiple key entities from the preliminary futures analysis text and obtain the real-time value corresponding to each key entity; Determine whether the real-time value corresponding to each key entity deviates from the historical value in the historical market data; If there is no trend deviation between the real-time value corresponding to each key entity and the historical value, then the preliminary futures analysis text is converted into final futures content based on the preset text generation template. If there is a trend deviation between the real-time value corresponding to each key entity and the historical value, then the target key entity where the trend deviation occurred and the direction of deviation are obtained. Based on the target key entity and the offset direction, obtain the correction instruction; Based on the preset text generation template and the correction instructions, the preliminary futures analysis text is corrected to generate the final futures content; The step of determining whether the real-time value corresponding to each key entity deviates from the historical value in the historical market data includes: Obtain the real-time change slope of the real-time value corresponding to each key entity; Obtain the historical change slope of the historical values corresponding to each key entity; Calculate the slope difference between the real-time change slope and the historical change slope; Determine whether the slope difference exceeds a preset slope threshold; If the slope difference exceeds the preset slope threshold, it is determined that there is a trend deviation; If the slope difference does not exceed the preset slope threshold, the number of consecutive times that it does not exceed the threshold is obtained. When the number of consecutive times that it does not exceed the threshold reaches the preset number of consecutive times, it is determined that there is no trend deviation.
2. The futures content generation method based on a large language model according to claim 1, characterized in that, The step of extracting multiple key entities from the preliminary futures analysis text and obtaining the real-time value corresponding to each key entity includes: Identify the futures commodity entity, time entity, and price entity in the preliminary futures analysis text; Associate the futures contract entity with the time entity to generate a contract-time key-value pair; Based on the product-time key-value pair, the corresponding real-time price value is matched from the real-time market data; Alignment verification is performed between the price entity and the real-time price value; If the alignment check passes, the real-time price value will be used as the real-time price value corresponding to the price entity. If the alignment check fails, the extraction process is triggered again until the alignment check passes or the maximum number of retries is reached.
3. The method of claim 1, wherein, If the slope difference exceeds the preset slope threshold, then after determining that a trend shift exists, the method further includes: Obtain the length of the continuous time window in which the trend shift occurs; Determine whether the length of the continuous time window exceeds a preset time window threshold; If the length of the continuous time window does not exceed the preset time window threshold, the ratio of the rate of change of the real-time change slope to the rate of change of the historical change slope is obtained, and the temporary offset level is determined based on the ratio of the rate of change. If the length of the continuous time window exceeds the preset time window threshold, the cumulative offset between the real-time change slope and the historical change slope is obtained, and the permanent offset level is determined based on the cumulative offset. The number of times the correction instruction is executed is adjusted based on the temporary offset level or the permanent offset level.
4. The method of claim 1, wherein, After obtaining the target key entity where the trend shift occurred and the direction of the shift, the process also includes: Based on the target key entity, obtain the corresponding set of associated entities; Determine whether there exists at least one associated entity in the set of associated entities whose real-time value is inversely offset from its historical value; If at least one of the associated entities in the set of associated entities has a real-time value that is offset from the historical value, then the associated entity with the offset is obtained as the offset entity. Based on the target key entity, the offset entity, and the offset direction, a hedging offset marker is generated; The correction strength of the correction command is adjusted based on the hedging offset mark.
5. The method of claim 4, wherein, The step of obtaining the corresponding set of associated entities based on the target key entity includes: Obtain the entity category label of the target key entity; Based on the entity category labels, retrieve first-level related entities that have a direct connection relationship with the target key entity from the pre-generated futures association map; Obtain the association strength value between each primary related entity and the target key entity; First-level associated entities whose association strength values exceed a preset association strength threshold are selected to form an initial set of associated entities; Determine whether the number of entities in the initial associated entity set is lower than the minimum number threshold; If the number of entities in the initial associated entity set is not less than the minimum number threshold, then the initial associated entity set is used as the associated entity set. If the number of entities in the initial set of associated entities is lower than the minimum threshold, then secondary associated entities that have a direct connection with the primary associated entities are retrieved from the futures association graph. The secondary related entities are added to the initial related entity set until the number of entities reaches the minimum number threshold or there are no more searchable next-level related entities, thus forming the related entity set.
6. The method according to claim 4, characterized in that, After generating the hedging offset marker based on the target key entity, the offset entity, and the offset direction, the method further includes: Obtain the offset magnitude of the target key entity and the reverse offset magnitude of the offset entity; Determine whether the offset magnitude is greater than the reverse offset magnitude; If the offset magnitude is greater than the reverse offset magnitude, the correction instruction is retained, and the correction intensity is adjusted to the first intensity. If the offset amplitude is not greater than the reverse offset amplitude, then determine whether the offset amplitude is equal to the reverse offset amplitude; If the offset magnitude is equal to the reverse offset magnitude, a cancellation correction instruction is generated; If the offset magnitude is less than the reverse offset magnitude, a reverse correction instruction is generated, which is used to instruct correction according to the reverse offset magnitude.
7. The method according to claim 1, characterized in that, The correction instructions include upward correction instructions and downward correction instructions; obtaining the correction instructions based on the target key entity and the offset direction includes: Obtain the location and frequency of the target key entity in the preliminary futures analysis text; Determine whether the offset direction is a positive offset; If the offset direction is positive, an upward adjustment instruction is generated. The upward adjustment instruction is used to instruct the numerical representation of the target key entity at the occurrence position to be increased, and the increase magnitude is determined based on the occurrence frequency. If the offset direction is negative, a downward adjustment instruction is generated. The downward adjustment instruction is used to instruct the numerical representation of the target key entity at the occurrence position to be reduced, and the reduction magnitude is determined based on the occurrence frequency.
8. The method according to claim 1, characterized in that, The process of revising the preliminary futures analysis text based on the preset text generation template and the revision instructions to generate the final futures content includes: The preset text generation template is parsed to obtain multiple fields to be filled and the field type of each field to be filled; Based on the correction instructions, extract the original content that matches each field to be filled from the preliminary futures analysis text; Determine whether the original content conflicts with the correction instruction; If the original content conflicts with the correction instruction, the original content is overwritten according to the correction instruction to generate fill content; If the original content does not conflict with the correction instruction, the original content is retained as the fill content; The filled content is then entered into the corresponding fields to generate the final futures content.
9. A futures content generation system based on a large language model, used to execute the method of any one of claims 1 to 8, characterized in that, include: The data acquisition module is used to acquire real-time and historical market data in the futures market. The initial generation module is used to input the real-time market data and the historical market data into the large language model to generate preliminary futures analysis text. The entity extraction module is used to extract multiple key entities from the preliminary futures analysis text and obtain the real-time value corresponding to each key entity. The offset judgment module is used to determine whether the real-time value corresponding to each key entity has a trend offset from the historical value in the historical market data. If the real-time value corresponding to each key entity does not deviate from the historical value in terms of trend, the first execution module is used to convert the preliminary futures analysis text into final futures content based on a preset text generation template. The anomaly detection module is used to detect the target key entity and the direction of the trend deviation if the real-time value corresponding to each key entity deviates from the historical value. The correction acquisition module is used to acquire correction instructions based on the target key entity and the offset direction; The second execution module is used to revise the preliminary futures analysis text based on the preset text generation template and the revision instructions, and generate the final futures content.
Citation Information
Patent Citations
Futures content generation method and system based on large language model
CN119248909A
Data processing method and device, equipment, medium and program product
CN120996917A