A time series prediction method, system, terminal and storage medium based on retrieval enhancement, frequency domain fusion and large model calibration

CN122886774APending Publication Date: 2026-10-09SKYWORTH GRP CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610872080.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-16
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

[0009]本发明要解决的技术问题在于,针对现有技术的上述缺陷,提供一种基于检索增强、频域融合及大模型校准的时序预测方法、系统、终端及存储介质,旨在解决现有的基于深度学习模型的时序预测方法直接拼接、复用检索片段,容易将不属于目标对象的短期噪声引入预测结果,且检索信息利用方式单一,并难以与预训练模型灵活集成的问题

Benefits of technology

[0014]本发明的有益效果:本发明实施例基于目标对象的目标历史序列从历史窗口库中检索出相似度排前若干位的窗口样本作为检索样本;对各个检索样本进行尺度对齐,并通过分段聚合的方式生成检索历史参考轨迹与检索未来参考轨迹;根据目标历史序列、检索历史参考轨迹及检索未来参考轨迹进行两阶段频域融合与模型预测,得到检索增强预测结果;基于结构化提示词和检索增强预测结果进行大语言模型离散校准,得到校准后的预测结果和推理解释。本发明通过对历史时序数据、检索得到的相似时序片段、频域融合结果以及离散校准动作进行协同处理,可以在短时及复杂外部干预场景下有效增强预测性能与可信度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122886774A_ABST
    Figure CN122886774A_ABST
Patent Text Reader

Abstract

The application discloses a time series prediction method and system based on retrieval enhancement, frequency domain fusion and large model calibration, a terminal and a storage medium. The method comprises the following steps: retrieving window samples with a certain number of similarities from a history window library based on a target historical sequence of a target object as retrieval samples; performing scale alignment on each retrieval sample, and generating a retrieval historical reference track and a retrieval future reference track through a segmented aggregation manner; performing two-stage frequency domain fusion and model prediction according to the target historical sequence, the retrieval historical reference track and the retrieval future reference track to obtain a retrieval enhancement prediction result; performing large language model discrete calibration based on a structured prompt word and the retrieval enhancement prediction result to obtain a calibrated prediction result and a push explanation. Through the collaborative processing of historical time series data, similar time series segments obtained through retrieval, frequency domain fusion results and discrete calibration actions, the prediction performance and reliability can be effectively enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of time series prediction technology, and in particular to a time series prediction method, system, terminal and storage medium based on retrieval enhancement, frequency domain fusion and large model calibration. Background Technology

[0002] Time series forecasting is a fundamental technology in fields such as supply chain management, sales planning, inventory scheduling, and financial analysis. In real-world industrial and commercial scenarios, forecasting results not only affect a company's production arrangements and inventory preparation, but also directly relate to sales strategies and resource allocation efficiency.

[0003] In recent years, deep learning methods based on Transformer and its variants have achieved good results in time series forecasting. These methods can learn time dependencies through neural networks and perform well on multiple public datasets. However, these traditional deep learning-based time series forecasting methods typically rely on historical data of the target sequence itself for modeling. When the historical samples are few or the distribution changes significantly, the model is prone to insufficient generalization ability.

[0004] To alleviate the problem of data scarcity, current research has begun to explore retrieval-enhanced prediction methods. These methods typically search for historical observation segments similar to the current target sequence from a historical sample database and use these similar segments as reference information for prediction. This idea enables cross-sequence knowledge transfer, and is particularly suitable for short-history or cold-start scenarios. However, existing retrieval enhancement methods still have the following shortcomings: First, existing methods often directly splice, copy, or correct the retrieved time series segments using residuals. This approach does not distinguish between transferable patterns and non-transferable perturbations, and directly reusing retrieved segments can easily introduce short-term noise that does not belong to the target object into the prediction results.

[0005] Second, existing retrieval enhancement prediction methods typically use retrieval information only at a single location, either at the input or output end. This single-stage utilization approach cannot fully leverage the information in the retrieval sample.

[0006] Third, many retrieval enhancement methods rely on specially trained retrieval modules or prediction models, making it difficult to combine them with existing pre-trained prediction models as plug-and-play modules.

[0007] Fourth, for industrial forecasting scenarios involving complex external intervention factors, existing pure numerical time series models are insufficient to fully understand these heterogeneous business information.

[0008] Therefore, existing technologies still need improvement and development. Summary of the Invention

[0009] The technical problem to be solved by the present invention is to provide a time series prediction method, system, terminal and storage medium based on retrieval enhancement, frequency domain fusion and large model calibration, in order to address the above-mentioned defects of the prior art. The aim is to solve the problems of existing time series prediction methods based on deep learning models that directly splice and reuse retrieval fragments, which easily introduce short-term noise that does not belong to the target object into the prediction results, and the limited use of retrieval information and difficulty in flexibly integrating with pre-trained models.

[0010] The technical solution adopted by this invention to solve the problem is as follows: In a first aspect, embodiments of the present invention provide a time-series prediction method based on retrieval enhancement, frequency domain fusion, and large model calibration, the method comprising: Based on the target object's historical sequence, the top-ranked window samples with the highest similarity are retrieved from a pre-built historical window library as retrieval samples; Each of the search samples is scale-aligned, and historical and future search reference trajectories are generated by segmented aggregation. Based on the target historical sequence, the retrieval historical reference trajectory, and the retrieval future reference trajectory, a two-stage frequency domain fusion and model prediction are performed to obtain the retrieval enhancement prediction result. Based on the structured prompts corresponding to the target object and the enhanced retrieval prediction results, a large language model is discretely calibrated to obtain the calibrated prediction results and the corresponding inference explanations.

[0011] Secondly, embodiments of the present invention also provide a time series prediction system based on retrieval enhancement, frequency domain fusion, and large model calibration, the system comprising: The sample retrieval module is used to retrieve the top-ranked window samples in terms of similarity from a pre-built historical window library based on the target historical sequence of the target object, and use them as retrieval samples. The sample processing module is used to scale-align each of the retrieved samples and generate historical retrieval reference trajectories and future retrieval reference trajectories by segmentation and aggregation. The frequency domain fusion and prediction enhancement module is used to perform two-stage frequency domain fusion and model prediction based on the target historical sequence, the retrieval historical reference trajectory and the retrieval future reference trajectory to obtain the retrieval enhancement prediction result. The discrete calibration module is used to perform discrete calibration of the large language model based on the structured prompts corresponding to the target object and the retrieval enhancement prediction results, so as to obtain the calibrated prediction results and the corresponding inference explanations.

[0012] Thirdly, embodiments of the present invention also provide a terminal, the terminal including a memory and one or more processors; the memory stores one or more programs; the programs include instructions for executing the time-series prediction method based on retrieval enhancement, frequency domain fusion and large model calibration as described above; the processor is used to execute the programs.

[0013] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a plurality of instructions adapted to be loaded and executed by a processor to implement the steps of the time-series prediction method based on retrieval enhancement, frequency domain fusion and large model calibration as described above.

[0014] The beneficial effects of this invention are as follows: In this embodiment, based on the target historical sequence of the target object, the top-ranked window samples in terms of similarity are retrieved from the historical window library as retrieval samples; each retrieval sample is scale-aligned, and a historical retrieval reference trajectory and a future retrieval reference trajectory are generated through segmented aggregation; a two-stage frequency domain fusion and model prediction are performed based on the target historical sequence, the historical retrieval reference trajectory, and the future retrieval reference trajectory to obtain enhanced retrieval prediction results; and a large language model is discretely calibrated based on structured prompts and the enhanced retrieval prediction results to obtain calibrated prediction results and inference explanations. This invention, by coordinating the processing of historical time-series data, retrieved similar time-series segments, frequency domain fusion results, and discrete calibration actions, can effectively enhance prediction performance and reliability in short-term and complex external intervention scenarios. Attached Figure Description

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

[0016] Figure 1 This is a flowchart illustrating the time-series prediction method based on retrieval enhancement, frequency domain fusion, and large model calibration provided in this embodiment of the invention.

[0017] Figure 2 This is a technical architecture diagram of the time series prediction method based on retrieval enhancement, frequency domain fusion, and large model calibration provided in the embodiments of the present invention.

[0018] Figure 3 This is a schematic diagram of the technical framework and experimental results provided by the embodiments of the present invention.

[0019] Figure 4This is a schematic diagram of the modules of a time series prediction system based on retrieval enhancement, frequency domain fusion, and large model calibration provided in an embodiment of the present invention.

[0020] Figure 5 This is a schematic diagram of the terminal provided in the embodiment of the present invention. Detailed Implementation

[0021] This invention discloses a time series prediction method, system, terminal, and storage medium based on retrieval enhancement, frequency domain fusion, and large model calibration. To make the objectives, technical solutions, and effects of this invention clearer and more explicit, the invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only for explaining the invention and are not intended to limit the invention.

[0022] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this specification means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.

[0023] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.

[0024] To address the aforementioned shortcomings of existing technologies, this invention provides a time-series prediction method based on retrieval enhancement, frequency domain fusion, and large-scale model calibration. The method includes: retrieving top-ranking window samples with high similarity from a pre-constructed historical window library based on the target historical sequence of the target object; performing scale alignment on each of the retrieved samples and generating a historical retrieval reference trajectory and a future retrieval reference trajectory through segmented aggregation; performing two-stage frequency domain fusion and model prediction based on the target historical sequence, the historical retrieval reference trajectory, and the future retrieval reference trajectory to obtain a retrieval enhancement prediction result; and performing discrete calibration of a large language model based on the structured prompts corresponding to the target object and the retrieval enhancement prediction result to obtain a calibrated prediction result and a corresponding inference explanation. This invention obtains the predicted value of the target object for the future time interval by coordinating the processing of historical time-series data, retrieved similar time-series segments, frequency domain fusion results, and discrete calibration actions. Frequency domain fusion effectively distinguishes between transferable information across sequences and short-term perturbations of the target sequence itself, avoiding noise pollution caused by directly reusing retrieval segments. The two-stage fusion mechanism effectively utilizes both historical trends and future evolution information from the retrieved fragments, improving the accuracy and robustness of predictions. The discrete calibration method of the large language model avoids the instability problem of continuous numerical generation and can output interpretable reasoning information, thereby effectively enhancing prediction performance and credibility in short-term and complex external intervention scenarios.

[0025] like Figure 1 As shown, the method includes: Step S100: Based on the target historical sequence of the target object, retrieve the window samples with the highest similarity from the pre-built historical window library as retrieval samples.

[0026] Specifically, the target object can be a commodity, a power load node, a road cross-section, a regional passenger flow point, or other objects with continuous observation values. This embodiment uses the target object's historical sequence as a query, searching for multiple similar historical samples most similar to it in a large-scale offline historical window library as retrieval samples, thereby alleviating the problems of short history and sample scarcity. These retrieval samples not only include historical observation segments similar to the historical trend of the target historical sequence, but also carry their corresponding actual future trajectory segments.

[0027] For example, in a sales forecasting scenario: the target object can be a specific product, and its target historical sequence is the daily sales record of that product over a continuous period of time. The historical window library is constructed by collecting a large number of historical product sales sequences and dividing them into several samples using a sliding window approach. Each sample contains a historical observation window and the subsequent actual future sales trajectory. This window library is used to subsequently retrieve segments similar to the historical trend of the target product, thereby achieving cross-product knowledge transfer.

[0028] In traffic flow prediction scenarios, the target object can be a road section, intersection, toll station, parking lot, or urban area. Its historical sequence is the traffic flow sequence of that target object over a past period (e.g., traffic flow every 15 minutes over the past 7 days). The historical window library consists of traffic flow segments from similar roads, similar dates, or similar events. Specifically, it is formed by extracting historical observation segments and their corresponding future real traffic flow trajectories from historical traffic flow data of multiple road sections, different dates (e.g., weekdays, weekends, holidays), and different events (e.g., large events, accidents, construction) using a sliding window approach. This historical window library provides reference segments with similar traffic patterns or external conditions for traffic flow prediction of the target object.

[0029] In power load forecasting, the target object can be a substation, distribution area, industrial park, or regional power grid. Its target historical sequence is the load sequence of this template object over a past period (e.g., the power load value every 15 minutes over the past 7 days). The historical window library consists of load segments from multiple nodes (e.g., different substations or distribution areas) or multiple historical dates (e.g., different seasons or different weather conditions). Each historical load sequence is divided into several samples using a sliding window. Each sample contains a historical observation segment and its subsequent actual future load trajectory. This historical window library provides a data foundation for retrieving historical observation segments similar to the target load trend, helping to address forecasting tasks in short-history or highly volatile scenarios.

[0030] In one implementation, the steps for constructing the history window library include: Obtain several original historical time series; The historical input length and prediction length are set, and each historical time series is divided into several window samples by means of a sliding window; each window sample contains a historical observation segment and a corresponding future trajectory segment; The historical window library is composed of all the window samples mentioned above.

[0031] Specifically, each historical time series can originate from multiple different objects, periods, and scenarios. An offline historical window library is constructed using these historical time series data for subsequent similar sample retrieval. In the actual construction phase, multiple samples are generated for each historical time series using a sliding window approach. Each sample consists of two parts: the historical observation segment and the corresponding future trajectory segment. This embodiment, through the sliding window approach, can form a large-scale historical window library from historical data across multiple objects, periods, and scenarios. This historical window library not only preserves the historical observation segment of each sample but also its subsequent true future trajectory. Therefore, it can provide two key types of reference information for the current target historical sequence: similar historical trends and how similar trends typically develop afterward, thus providing a data foundation for enhanced prediction in subsequent retrieval.

[0032] For example, let the length of the input historical time series be T, and the prediction length be H. Then each window sample can be represented as s=(x,y), where x represents a historical observation segment of length T, and y represents a future trajectory segment of length H that immediately follows. In e-commerce sales forecasting, x could be the sales volume of a product over the past 90 days, and y could be the actual outbound volume over the next 30 days, i.e., T=90, H=30. For different application scenarios, x and y can also correspond to other time-series physical quantities: in power load forecasting, x could be the electricity consumption of a region over the past 10 days, and y could be the actual electricity consumption over the next 5 days, i.e., T=10, H=5; in traffic flow forecasting, x could be the traffic flow of a road segment over the past 20 days, and y could be the actual traffic flow over the next 10 days, i.e., T=20, H=10.

[0033] In one implementation, the step of retrieving the top-ranked window samples in terms of similarity from a pre-built historical window library based on the target object's historical sequence as retrieval samples includes: Receive the target historical sequence of the target object; The target historical sequence and each window sample are encoded using a pre-trained temporal representation model. Calculate the similarity between the encoding vector of the target historical sequence and the encoding vector of each window sample, and select the first few window samples that meet the time constraints from the historical window library based on the similarity as the retrieval samples.

[0034] Specifically, to achieve efficient and accurate retrieval of similar historical samples, this embodiment uses a time-series representation model in the retrieval stage. A time-series representation model is a pre-trained model used to encode raw time-series segments into low-dimensional vector representations. Through this model, time-series segments of different lengths or from different sources can be mapped to a unified representation space, thereby enabling efficient retrieval based on vector similarity.

[0035] In practical applications, after constructing a historical window library, the historical observation segment x of each window sample can be pre-input into the time series representation model to obtain the corresponding encoding vector e, which is then cached to improve retrieval efficiency in subsequent inference stages. When it is necessary to predict a target object, the system receives the target historical sequence corresponding to the target object and inputs it into the same time series representation model to obtain the encoding vector of the target historical sequence.

[0036] Subsequently, the similarity between the encoding vector of the target historical sequence and the encoding vectors of each window sample in the historical window library is calculated. For example, cosine similarity is used, which measures the morphological similarity of the corresponding time segments by measuring the angle between the two vectors. Based on the calculated similarity scores, the K most similar window samples are selected from the historical window library as retrieval samples.

[0037] For example, such as Figure 2 As shown, a historical window library is pre-constructed, where each window sample contains a historical observation segment and its corresponding future true trajectory. For the current target sequence, a pre-trained temporal representation model (such as the Sundial encoder) is used to convert it into an encoded vector, and a cosine similarity search is performed between this vector and the encoded vectors of each window sample pre-stored in the historical window library to retrieve the top-ranked window samples based on similarity. For example, 10 most similar window samples are retrieved for the target historical sequence.

[0038] Furthermore, to avoid time leakage, this embodiment can incorporate time constraints during the retrieval phase: the target window is determined based on the target's historical sequence. Any future intervals that overlap with the target window or occur after the target window are excluded; only window samples that are strictly earlier than the target window in time, and whose future trajectories are already clearly visible before the prediction time, are allowed to be used as retrieval references. This time constraint ensures that future information will not be used in offline evaluation and actual deployment, thereby guaranteeing the reliability and fairness of the prediction.

[0039] Step S200: Scale-align each of the retrieved samples and generate historical retrieval reference trajectories and future retrieval reference trajectories by segmented aggregation.

[0040] Specifically, because different target objects or time series may have significant differences in numerical scale, dimensions, or observation levels, directly using the original values ​​of the retrieval samples may lead to scale mismatch. For example, two objects may have similar morphological changes, but their absolute numerical levels are not the same. Therefore, before using the retrieval samples, scale alignment is required to eliminate the differences in dimensions, numerical levels, or observation scales between different retrieval samples in order to extract transferable morphological patterns. After scale alignment, the historical observation segments and corresponding future trajectory segments of each retrieval sample are aggregated separately through segmented aggregation, thereby generating smooth and stable historical and future reference trajectories. These two reference trajectories not only eliminate irregular jitter in the original retrieval samples but also retain morphological patterns consistent with the scale of the target historical sequence, providing effective reference information for the subsequent two-stage frequency domain fusion.

[0041] In one implementation, the steps of scaling each of the retrieved samples and generating historical and future retrieval reference trajectories through segmented aggregation include: For each of the search samples, the search samples are scale-aligned based on the statistical features corresponding to the target historical sequence and the search sample, respectively. The historical reference trajectory is generated by aggregating the historical observation segments of each retrieved sample after scale alignment, and the future reference trajectory is generated by aggregating the future trajectory segments of each retrieved sample after scale alignment.

[0042] Specifically, during scale alignment, the statistical characteristics (also known as statistics) of the target historical sequence and each retrieved sample are calculated separately, such as the mean and standard deviation. Then, the historical observation segments and future trajectory segments of the retrieved samples are standardized according to their own statistical characteristics. Afterward, destandardization is performed according to the statistical characteristics of the target historical sequence. This scale alignment method preserves the relative change patterns of the retrieved samples, such as increases, decreases, and periodic fluctuations, while adjusting their numerical amplitude to the scale of the target historical sequence to avoid matching bias caused by differences in absolute numerical levels.

[0043] After scale alignment, the historical observation segments of the first K retrieved samples are aggregated to form a historical reference trajectory; simultaneously, the future trajectory segments of the first K retrieved samples are aggregated to form a future reference trajectory. Aggregation methods can include averaging, weighted averaging, or similarity-based weighted fusion. In practical applications, if no effective neighbors meeting the time constraints and quality requirements are found during the retrieval process (i.e., the number of similar samples is insufficient or the similarity is too low), the system can automatically revert to the original output of the pre-trained prediction model to avoid negatively impacting the prediction results due to low-quality retrieved samples.

[0044] Step S300: Perform two-stage frequency domain fusion and model prediction based on the target historical sequence, the retrieval historical reference trajectory, and the retrieval future reference trajectory to obtain the retrieval enhancement prediction result.

[0045] Specifically, time series forecasting is a method that predicts the trend of numerical changes over a future period based on historical observation data; while retrieval-enhanced time series forecasting is a method that uses similar time series segments from a historical sample library to assist the current forecasting task. In other words, when the target series itself has limited historical data or exhibits strong fluctuations, segments with similar patterns can be retrieved from other historical series, and the historical trends and subsequent development trajectories of these segments can be used to provide a reference for the current forecast. Frequency domain fusion is a method that first transforms the time series from the time domain to the frequency domain, and then selectively fuses different frequency components. This embodiment introduces a two-stage frequency domain fusion mechanism, which applies the retrieved historical reference trajectory and the retrieved future reference trajectory before and after forecasting, respectively, enabling the retrieval information to simultaneously enhance the input context and correct the forecast trend. Through this two-stage frequency domain fusion approach, the retrieval information can enrich the context on the input side and correct the forecast trend on the output side, effectively avoiding noise pollution caused by direct splicing or copying.

[0046] In one implementation, the step of performing two-stage frequency domain fusion and model prediction based on the target historical sequence, the retrieval historical reference trajectory, and the retrieval future reference trajectory to obtain the retrieval enhancement prediction result includes: The target historical sequence and the retrieved historical reference trajectory are fused in the frequency domain in the first stage to obtain an enhanced historical input sequence; wherein, the fusion ratio corresponding to the first stage is determined based on the low-frequency correlation between the retrieved historical reference trajectory and the target historical sequence. The enhanced historical input sequence is input into a pre-trained prediction model to generate intermediate prediction results; The intermediate prediction results are fused with the future reference trajectory in the second stage to obtain the enhanced prediction results; wherein, the fusion ratio corresponding to the second stage is determined based on the consistency of the changing trend of the future trajectory segments of each retrieval sample.

[0047] Specifically, the first stage involves selectively fusing the target historical sequence and the retrieved historical reference trajectory in the frequency domain to obtain the enhanced historical input sequence. The specific operation involves transforming both the target historical sequence and the retrieved historical reference trajectory to the frequency domain using discrete Fourier transform. Low-frequency components in the frequency domain typically reflect stable structures such as trends, seasonality, and lifecycles, while high-frequency components correspond to short-term disturbances, random noise, or individual product differences. This embodiment fuses the retrieved historical reference trajectory and the target historical sequence only in the low-frequency portion, retaining the target historical sequence's own information in the high-frequency portion. This transfers only stable structures such as trends, seasonality, and lifecycles, avoiding the direct introduction of non-transferable high-frequency components such as random disturbances and short-term noise. Furthermore, the fusion ratio in the first stage is not a fixed value but is adaptively determined based on the low-frequency correlation between the retrieved historical reference trajectory and the target historical sequence: if their low-frequency trends are highly consistent, indicating high structural similarity, the fusion ratio can be appropriately increased; otherwise, the fusion ratio is decreased. After completing the frequency domain fusion, the sequence is restored to the time domain using inverse Fourier transform to obtain the enhanced historical input sequence. The advantages of the first-stage frequency domain fusion are: it can inject stable and transferable trend structures from similar historical samples into the target historical sequence before prediction, enabling the pre-trained prediction model to make predictions under more sufficient contextual conditions. At the same time, since the high-frequency part still retains the characteristics of the target sequence itself, it can avoid erroneously transferring short-term perturbations, event shocks, or random noise specific to other objects to the current target object.

[0048] Subsequently, the enhanced historical input sequence is fed into the pre-trained prediction model to generate intermediate prediction results. The pre-trained prediction model can be any base model with time series prediction capabilities, such as Chronos-2, which has been trained on large-scale time series data. Since the frequency domain fusion module in this embodiment is located outside the prediction model, it can be used as a plug-and-play module to enhance existing pre-trained models without modifying or retraining the model.

[0049] The second stage, frequency domain fusion, then proceeds: the intermediate prediction results are fused with the retrieved future reference trajectories in the frequency domain. The retrieved samples include not only historical observation segments but also subsequent actual future trajectories, which provide reference information on how similar historical patterns typically develop. The intermediate prediction results and the retrieved future reference trajectories are each converted to the frequency domain, and fusion is performed only in the low-frequency range, retaining the results generated by the prediction model itself in the high-frequency range. Then, an inverse Fourier transform is used to obtain the enhanced prediction results. Furthermore, the fusion ratio in the second stage is determined based on the consistency of the changing trends of the future trajectory segments of each retrieved sample: if the changing trends of the first K retrieved future trajectories are relatively consistent within their future trajectory segments, it indicates strong consensus in the retrieval results, and the future reference information is more reliable, thus allowing for a higher fusion ratio; if multiple retrieved future trajectories differ significantly, it indicates high uncertainty in future evolution, thus allowing for a lower fusion ratio.

[0050] In summary, in the two-stage frequency domain fusion mechanism, historical fusion occurs before prediction, enhancing the model's input context; future injection occurs after prediction, utilizing the subsequent development trends of similar samples to correct the prediction results. The two work synergistically to ultimately obtain more accurate and robust retrieval enhancement prediction results. Secondly, in the adaptive fusion ratio adjustment mechanism, the low-frequency bandwidth to be fused is automatically determined based on the similarity between the retrieved sample and the target sample, historical consistency, and future trajectory consensus. Compared to fixed-ratio fusion, this method calculates the final reliability score through historical consistency and future consensus, mapping it to a preset minimum and maximum fusion ratio. This allows for dynamic adjustment of the intensity of retrieval knowledge introduction based on information reliability, achieving adaptive adjustment of the fusion ratio and avoiding the problem of unstable performance on different samples with a fixed fusion ratio.

[0051] For example, taking the target historical sequence and the retrieved historical reference trajectory as an example, such as... Figure 2 As shown, the system receives the target historical sequence of the target object and the retrieval historical reference trajectory. Both are transformed to the frequency domain using Fast Fourier Transform (FFT). The low-frequency band to be fused is determined according to the adaptive fusion ratio λ. In the low-frequency part, the frequency domain components of the target historical sequence and the retrieval sequence are weighted and fused to inject stable trends, seasonality, and other low-frequency transferable patterns from the retrieval sample into the target historical sequence. In the high-frequency part (i.e., outside the low-frequency band), the original frequency components of the target sequence are retained to avoid introducing short-term noise or individual-specific perturbations from the retrieval sample. The fused frequency domain representation is then restored to the time domain sequence using Inverse Fast Fourier Transform (IFFT) to obtain the fused target historical input, i.e., the enhanced historical input sequence.

[0052] Step S400: Based on the structured prompts corresponding to the target object and the retrieval enhancement prediction results, perform discrete calibration of the large language model to obtain the calibrated prediction results and the corresponding inference explanations.

[0053] Specifically, in time series data prediction processing, relying solely on numerical time series data is often insufficient to fully characterize complex external intervention information such as holidays, policies, operational status, business rules, traffic control, and weather conditions. Therefore, this invention, based on retrieving and enhancing prediction results, introduces discrete calibration using a large language model. Through the semantic understanding and reasoning capabilities of the large language model, the generated numerical prediction results are corrected and interpreted at the business level.

[0054] Discrete calibration of a large language model is a predictive calibration method that utilizes a large language model to select discrete adjustment actions based on business context. Instead of directly generating continuous predicted values, the large language model selects from a set of predefined discrete adjustment actions, such as increasing by 10%, decreasing by 5%, maintaining the value, scaling by a certain proportion, or adding a constant offset. Based on structured prompts related to the target object, the large language model determines in which aspects the current search enhancement prediction result might deviate from reality and outputs the most reasonable discrete action. Finally, the search enhancement prediction result is corrected based on the selected discrete action to obtain the calibrated prediction result, while simultaneously outputting a natural language inference explanation. This makes the prediction result not only more aligned with complex business scenarios but also interpretable and auditable by humans. For example, if there is a pre-sale period for Double Eleven next week, sales usually increase, and the prediction underestimates the impact of the upcoming promotion, then an 8% increase is made. The large language model in this embodiment is applicable to the discrete calibration of general time-series prediction results, thus allowing for seamless integration of search enhancement prediction results.

[0055] In one implementation, the structured cue words corresponding to the target object include at least one of the following: object attributes, time context, historical observation statistics, and external events, as well as the intermediate prediction results and the calibration action space of the target object.

[0056] Specifically, firstly, structured cue words related to the target object are constructed to reflect complex external intervention information related to the target object. These structured cue words serve as input to the large language model and may include the following information: Object attribute information, such as product size, equipment type, line or region attributes, life cycle stage, operating status, whether it is on sale or under special control, etc. Predict the month and time context; Historical observation and statistical information, such as sales volume, outbound volume, load, flow rate, and year-on-year or month-on-month changes in recent periods; Seasonal signals, such as overall market changes from the same period last year or from last month to this month; load trend changes from last month to this month due to changes in temperature, sunshine, and heating / cooling demand; overall traffic flow changes from last month to this month due to peak tourist season, school winter and summer vacations, etc. Information on future external events, such as promotional activities, subsidy policies, holidays, weather changes, equipment maintenance, traffic control, large-scale events or channel activities; In addition, it includes the ability to retrieve enhanced prediction results and an optional discrete calibration action space.

[0057] By organizing this multidimensional information into structured cue words, the large language model can fully understand the business context of the target object and select the most appropriate discrete calibration action in the given action space, thereby achieving reasonable and interpretable correction of prediction results.

[0058] In one implementation, the steps of performing discrete calibration of the large language model based on the structured prompts corresponding to the target object and the retrieval enhancement prediction results to obtain the calibrated prediction results and corresponding inference explanations include: The calibration action is selected in the calibration action space based on the structured cue words using a large language model; wherein the large language model is optimized using reinforcement learning. The retrieval enhancement prediction results are calibrated according to the selected calibration action to obtain the calibrated prediction results and the corresponding inference explanation.

[0059] Specifically, the large language model discrete calibration method in this embodiment is a calibration method oriented towards external intervention information. It transforms prediction calibration from a continuous numerical generation problem into a discrete decision-making problem in a finite action space, thereby improving the stability, controllability, and interpretability of the calibration process. Unlike the approach that requires the large language model to directly generate specific numerical values, this embodiment transforms prediction calibration into a discrete action selection problem in a finite action space: the large language model does not directly output a specific predicted value, but selects an action from several predefined or data-adaptively generated adjustment actions. Each action corresponds to a multiplicative calibration coefficient, such as increasing by 10%, decreasing by 5%, or keeping it unchanged, used to increase or decrease the retrieval enhancement prediction result. Based on the object attributes contained in the structured prompts, historical observation statistics, seasonal signals, future external events, and retrieval enhancement prediction results, the model selects the most reasonable action from the calibration action space and outputs a natural language inference explanation.

[0060] For example, when there are no promotions and there is a significant off-season decline in the same period in history, the large language model may choose to make a slight downward adjustment; when the forecast month includes major promotional activities and historical sales have an upward trend, the large language model may choose to make an upward adjustment; in power load forecasting, if there is high temperature on the forecast day, strong production load on weekdays, and the load is rising in the same period in history, the large language model may choose to make an upward adjustment; in traffic flow forecasting, if there is severe weather or traffic control during the forecast period that leads to a decrease in traffic demand, the model may choose to make a downward adjustment.

[0061] In one implementation, to give the discrete calibration actions practical business significance, this embodiment does not use arbitrarily set adjustment coefficients, but rather adaptively constructs the calibration action space based on the true error distribution in the training set. The steps for constructing the calibration action space include: Calculate the ratio distribution of true prediction results to retrieval-enhanced prediction results on the training set; Based on the aforementioned proportional distribution, several equally probable intervals are divided according to quantiles. Representative quantiles of the intervals are selected as multiplication calibration coefficients to form a calibration action space that includes up-adjustment, down-adjustment, and hold.

[0062] Specifically, a training set refers to a collection of historical data that includes complete historical observations and actual future values, typically derived from historical records within the same prediction scenario. For example, in a sales forecasting scenario, the training set could be daily sales data for multiple products over the past year, with each sample containing several days of historical sales and several days of actual sales following them; in an electricity load forecasting scenario, the training set could be load records at several time points each day over the past few years, with training samples generated using a sliding window; and in a traffic flow forecasting scenario, the training set could be traffic flow data at specific time intervals at a key section of a highway over the past year, with training samples generated using a sliding window.

[0063] The ratio between the true prediction result and the retrieval-enhanced prediction result is calculated on the training set, i.e., the ratio of y to the retrieval-enhanced prediction result, resulting in a proportional distribution. This proportional distribution represents the degree to which the prediction result typically needs to be adjusted up or down in historical samples. Subsequently, this proportional distribution is divided into multiple intervals according to quantiles. For example, five equally probable intervals are divided using 20%, 40%, 60%, and 80% quantiles. Each action can take a representative quantile from the corresponding interval, such as 10%, 30%, 50%, 70%, and 90% quantiles. Through this construction method, each discrete action corresponds to a typical calibration amplitude that actually exists in historical data, rather than an arbitrarily set adjustment value. The resulting calibration action space enables the action selection of the large language model to be more stable and reasonable, and consistent with the distribution of actual business data.

[0064] Take sales forecasting as an example: Historical daily sales data for multiple product categories over the past year were selected. Each original sequence is over 120 days long. The historical input length T = 90 days, and the prediction length H = 30 days. A sliding window method was used to generate samples: for each product, sales for 90 consecutive days were extracted with a step size of 1 day as the historical observation segment, and the sales for the following 30 days were taken as the true future trajectory segment. For each sample, the retrieval augmentation prediction method of this embodiment was used to generate the corresponding retrieval augmentation prediction result, i.e., the retrieval augmentation prediction for 30 days. Finally, a large number of samples were obtained in the training set, each sample containing the true 30-day total sales and the retrieval augmentation prediction for the 30-day total sales.

[0065] For each sample i in the training set, the proportion ri is calculated as: (True 30-day total sales volume) ÷ (Search-enhanced prediction of 30-day total sales volume). If the search-enhanced prediction is accurate, it means the true result is basically the same as the search-enhanced prediction, and the model prediction is accurate; in this case, ri ≈ 1, and it can be maintained. If the true result is greater than the search-enhanced prediction, it means the model underestimates the value; in this case, ri > 1, and it needs to be adjusted upwards. If the true result is less than the search-enhanced prediction, it means the model overestimates the value; in this case, ri < 1, and it needs to be adjusted downwards. After calculating ri for all samples, a set of proportion values ​​is obtained. The statistical characteristics of this set are: minimum 0.32, maximum 2.88, mean 1.04, and median 1.02. To avoid the influence of extreme values, several typical quantiles are selected as candidate points for calibrating the action space: the proportion values ​​corresponding to the 5%, 25%, 50%, 75%, and 95% quantiles are used as multiplication adjustment coefficients. The calculation results are as follows: 5th percentile: 0.483, indicating that in the training set, 5% of the samples have a true result / predicted result ratio less than 0.483, meaning the model is severely overestimating; 25th percentile: 0.828; 50th percentile: 1.0756; 75th percentile: 1.3752; 95th percentile: 2.1113. From this, the discrete calibration action space is obtained: A={0.483,0.828,1.0756,1.3752,2.1113}; Actions less than 1 (0.483, 0.828) indicate that the search enhancement prediction results need to be lowered; actions greater than 1 (1.3752, 2.1113) indicate that they need to be raised; and actions close to 1 (1.0756) indicate that they should remain basically unchanged.

[0066] In actual forecasting, the large language model receives structured cue words, which may include product level, channel inventory, historical average outbound shipments, in-transit inventory, minimum safety stock, replenishment lead time, promotion schedule, and pricing strategy. Based on the structured cue words, the most reasonable action is selected from the calibration action space, and an inference explanation is output. For example, if the product is a seasonal food, the forecast month coincides with the peak of pre-Chinese New Year stocking, and the historical actual / predicted ratio is near the 75th percentile, then calibration action 1.3752 is selected, increasing the forecast value by 37.52%. The calibrated forecast result = retrieval-enhanced forecast result × multiplication coefficient selected based on the calibration action. Supply chain operations are then generated based on the relationship between the predicted sales value and inventory thresholds, replenishment thresholds, and clearance thresholds. For example, when the projected future sales volume is greater than or equal to the first sales threshold Q1, and the existing available inventory is lower than the sum of the projected sales volume and the safety stock, the supply chain operation recommendation is to replenish stock or increase the purchase volume. When the projected future sales volume is between the second sales threshold Q2 and the first sales threshold Q1, the supply chain operation recommendation is to maintain regular inventory levels or replenish stock on a rolling basis according to the standard replenishment cycle. When the projected future sales volume is between the third sales threshold Q3 and the second sales threshold Q2, the supply chain operation recommendation is to reduce the replenishment priority, observe sales trends, and control new inventory. When the projected future sales volume is lower than the third sales threshold Q3, and the inventory turnover days exceed the preset upper limit, the supply chain operation recommendation is to stop replenishing stock, reallocate inventory, or initiate promotional activities to clear inventory. The above Q1, Q2, and Q3 can be dynamically set according to product category, channel, forecast period, and historical percentile.

[0067] Taking electricity load forecasting as an example: Historical load data from multiple nodes over several years is selected, including load sequences from multiple monitoring points across four levels: substations, distribution substations, industrial parks, and regional power grids. Each sequence is sampled at a specific interval, corresponding to multiple time points each day. The historical input length T = 7 days, and the prediction length H = 1 day. A sliding window method is used to generate samples: with a step size of 1 day, the load of 7 consecutive days is extracted as the historical observation segment, and the load of the following day is taken as the actual future trajectory segment. For each sample, the retrieval-enhanced prediction method of this embodiment is used to generate the corresponding retrieval-enhanced prediction result, i.e., the predicted total load for the 24 hours of the day or the average load at a specified number of time points on that day. Finally, a large number of samples are obtained in the training set, each containing the actual daily total load or average load, and the retrieval-enhanced predicted daily total load or average load. Taking the total load as an example, for each sample i in the training set, the proportion is calculated: ri = actual daily total load ÷ retrieval-enhanced predicted daily total load. If ri ≈ 1, the prediction is accurate; ri > 1, the model underestimates; and ri < 1, the model overestimates. After statistically analyzing all ri values, the distribution characteristics are as follows: minimum value 0.41, maximum value 2.95, mean 1.03, and median 1.01.

[0068] Next, a discrete calibration action space was constructed based on quantiles: five quantiles—5%, 25%, 50%, 75%, and 95%—were selected as candidate points for the calibration action space. The calculation results are as follows: 5% quantile: 0.512, indicating severe overestimation by the model; 25% quantile: 0.873; 50% quantile: 1.058; 75% quantile: 1.384; 95% quantile: 2.063. Thus, the discrete calibration action space is obtained. A={0.512,0.873,1.058,1.384,2.063}; Actions with a value less than 1 (0.512, 0.873) indicate a downward adjustment of the predicted load, meaning that the actual load may be lower than the predicted load; actions with a value greater than 1 indicate an upward adjustment of the predicted load.

[0069] In actual forecasting, the input to the large language model includes not only retrieval-enhanced load forecasting but also structured prompts such as forecast date type, temperature, humidity, holidays, production shifts, electricity policies, equipment maintenance plans, and demand response notifications. The large language model selects the most reasonable action from the calibration action space and outputs the corresponding inference explanation. For example, if the forecast date is a high-temperature summer workday with a maximum temperature of 38℃ and no equipment maintenance plan, the air conditioning load will increase significantly; if the ratio of historical actual results to forecast results is near the 75th percentile, then calibration action 1.384 is selected, increasing the forecast load by 38.4%. The calibrated load forecast result = retrieval-enhanced forecast result × multiplication coefficient selected based on the calibration action. This is used to generate operational suggestions such as peak-shifting electricity consumption, reserve capacity preparation, maintenance window adjustment, or demand response triggering.

[0070] Taking traffic flow prediction as an example: Historical traffic flow data from multiple road sections, intersections, toll stations, parking lots, and urban areas over several years were selected for a specific region. Specifically, this included: 10 urban expressway sections, 20 signalized intersections, 8 highway toll stations, 15 large parking lots, and 5 core commercial districts. Traffic flow (unit: standard vehicle equivalent) was recorded every 15 minutes at each sampling point. The historical input length T = 7 days, and the prediction length H = 4 hours. A sliding window method was used to generate samples: with a step size of 1 day, traffic flow for 7 consecutive days was extracted as the historical observation segment, followed by 4 hours of traffic flow as the actual future trajectory segment. For each sample, the retrieval augmentation prediction method of this embodiment was used to generate a corresponding retrieval augmentation prediction result, i.e., predicting the total traffic flow or average traffic flow for a specific duration, such as the total traffic flow for 4 hours or the average traffic flow every 15 minutes. Finally, a large number of samples were obtained in the training set, each sample containing the actual 4-hour total traffic flow and the retrieval augmentation predicted 4-hour total traffic flow, or the actual 15-minute average traffic flow and the retrieval augmentation predicted 15-minute average traffic flow. Taking the total traffic flow over 4 hours as an example, for each sample i in the training set, the proportion is calculated as: ri = actual total traffic flow over 4 hours ÷ total traffic flow over 4 hours predicted by retrieval enhancement. ri≈1 indicates accurate prediction, ri>1 indicates model underestimation (actual traffic flow is higher than predicted), and ri<1 indicates model overestimation. After calculating all ri values, the distribution characteristics are: minimum 0.38, maximum 3.12, mean 1.02, and median 1.00. A discrete calibration action space is constructed based on quantiles: the proportions corresponding to the 5%, 25%, 50%, 75%, and 95% quantiles are selected as multiplication adjustment coefficients. The calculation results are as follows: 5% quantile: 0.451, indicating severe model overestimation; 25% quantile: 0.796; 50% quantile: 1.023; 75% quantile: 1.428; 95% quantile: 2.187; thus, the discrete calibration action space is obtained. A={0.451,0.796,1.023,1.428,2.187}; Actions less than 1 (0.451, 0.796) indicate a downward adjustment of the predicted traffic flow; actions greater than 1 indicate an upward adjustment of the predicted traffic flow; and 1.023, close to 1, indicates a slight upward adjustment or maintenance.

[0071] In actual prediction, the input context of the large language model not only includes retrieval-enhanced traffic flow prediction, but also structured prompts such as weekday or holiday attributes, weather, accident information, road construction, traffic control, large-scale events, school opening / closing dates, and commercial district activities. The large language model selects the most reasonable action from the calibration action space and outputs the corresponding inference explanation. For example, if the predicted day is Friday evening rush hour, and there is an anniversary celebration of a large commercial complex and road construction in the surrounding area occupying two lanes, congestion is expected to worsen; the ratio of actual results to predicted results in similar historical event scenarios is around the 75th percentile, so calibration action 1.428 is selected, increasing the predicted traffic flow by 42.8%. The calibrated traffic flow prediction result = retrieval-enhanced prediction result × multiplication coefficient selected based on the calibration action. This is used to generate suggestions for signal timing adjustment, traffic diversion guidance, police deployment, number of tollbooth lanes, or parking resource allocation.

[0072] To further improve calibration quality, reinforcement learning can be used to optimize the discrete action selection strategy of the large language model. This allows the model to learn to select reasonable adjustment actions guided by long-term reward signals based on object attributes, historical trends, seasonal patterns, external events, and basic prediction results, and output corresponding inference explanations to provide interpretable support for subsequent business decisions. For example, GRPO can be used to train the large language model strategy. Finally, the system performs numerical calibration on the retrieval enhancement prediction results based on the selected calibration actions, obtaining calibrated prediction results along with the inference explanations generated by the large language model, thereby outputting accurate and reliable prediction information in complex business scenarios.

[0073] Specifically, the reward function consists of multiple parts: (1) Calculate the basic error of each candidate calibration action based on the relative prediction error: For a candidate calibration action, multiply the retrieval enhancement prediction result by the adjustment coefficient corresponding to the action to obtain the calibration prediction result, and then calculate the relative error between it and the true result (e.g., using WAPE or MSE). The smaller the error, the better the action. (2) Introduce confidence-weighted penalty: If the model assigns a higher probability to a certain incorrect calibration action, a stronger penalty will be given. If the model assigns a higher probability to the correct calibration action, it will be beneficial to obtain a better reward. This design encourages the model not only to select the correct calibration action, but also to form a reasonable probability distribution. (3) Perform intra-group normalization: Since the sales volume of different products or months is different, the original error may not be directly comparable. Therefore, reward normalization is performed between multiple candidate calibration actions in the same sample to make the reward a relative ranking signal, thereby improving training stability. (4) Introduce the optimal action reward: For each training sample, select the calibration action that minimizes the prediction error as the optimal calibration action, and add an extra reward for this action to provide the model with a clear action supervision signal, making it easier for the model to learn an effective calibration strategy.

[0074] By designing the above reward function, the large language model can be transformed from an unstable continuous numerical generator into a constrained discrete decision-making strategy. The final output of the model includes the selected calibration action, the calibrated prediction result, and the corresponding natural language interpretation.

[0075] To demonstrate the technical effectiveness of the present invention, the specific embodiments and effects of the present invention are further explained below in conjunction with experimental results: Example 1: Enhanced frequency domain fusion for retrieval on public time series datasets.

[0076] In experiments on publicly available datasets, the prediction backbone model used a pre-trained time series model, and the baseline method was the original prediction backbone without retrieval-enhanced frequency domain fusion. This invention adds representation-based similar sample retrieval and adaptive frequency domain history / future fusion to the same prediction backbone. Experiments covered six types of publicly available time series data: ETTh1, ETTh2, Exchange, Traffic, M4, and FRED. Since these publicly available datasets do not contain explicit promotional, policy, or business intervention text information, this experiment primarily verifies the effectiveness of the retrieval-enhanced frequency domain fusion module, without enabling the large language model discrete calibration module.

[0077] Table 1. Examples of effects based on multi-class datasets

[0078] The above results show that, without changing the pre-trained prediction backbone, a stable improvement can be achieved simply by retrieval enhancement and frequency-domain selective fusion, indicating that the present invention can be used as a general prediction enhancement module for various time series tasks.

[0079] Example 2: A complete method on an industrial sales forecast dataset.

[0080] The industrial sales forecast dataset contains highly seasonal and volatile demand, as well as complex external intervention information such as promotions, policies, and product attributes. This embodiment further incorporates a large language model discrete calibration module based on enhanced frequency domain fusion. Experimental results show that the overall WAPE of this invention is 31.41, and the overall MSE is 3.30 × 10⁻⁶ for 12 forecast months. 6 It outperformed the strongest baseline with a total WAPE of 36.44 and a total MSE of 3.92 × 10⁻⁶. 6According to monthly statistics, this invention achieved the best WAPE in 7 out of 12 months and the best MSE in 5 out of 12 months.

[0081] The improvements in WAPE were particularly significant in July and August, with the present invention reducing the optimal baseline WAPE of 27.85 and 28.91 to 22.51 and 27.36, respectively. The improvements in MSE were also significant in May and June, with the present invention reducing the optimal baseline MSE to 2.39 × 10⁻⁶. 6 and 2.18×10 6 Reduced to 2.10×10 6 and 1.71×10 6 The results demonstrate that this invention can improve overall forecast reliability in real-world industrial scenarios with complex business interventions and significant demand fluctuations.

[0082] Example 3: Discrete calibration strategy for large language models.

[0083] To compare different large language model calibration methods, direct numerical calibration and the discrete action calibration of this invention were compared on the same retrieval augmentation prediction basis. Direct numerical calibration requires the large language model to directly generate the final sales value, while this invention requires the large language model to select multiplicative calibration coefficients from a finite action space. The experimental results are as follows: Table 2. Examples of the effects of multi-class methods

[0084] The results above show that directly generating numerical values ​​using a large language model without reinforcement learning optimization leads to increased errors, indicating that continuous numerical generation is unstable. Performance is improved after GRPO optimization, but it is still inferior to the discrete action calibration of this invention. Compared to Base, Base+GRPO-LDC reduces WAPE from 36.15 to 31.41 and MSE from 4.46 × 10⁻⁶. 6 Reduced to 3.30×10 6 This demonstrates that discrete calibration strategies can more stably incorporate business context.

[0085] Example 4: Interpretable calibration case.

[0086] In a case study forecasting sales in February 2025, the product had no promotions or policy support for the month, and historically, overall shipments from January to February showed a significant decline. The model made a slight downward adjustment based on the off-season decline and lack of promotional support, thus avoiding an unreasonable upward adjustment to the base forecast.

[0087] In another case predicting October 2025 sales, the forecast month includes the Double Eleven pre-sale period, and recent shipments have shown an upward trend. The model identifies signals of promotional stocking and recent demand recovery, and chooses to adjust upwards to make the forecast more consistent with actual business expectations. These examples illustrate that the large language model calibration module of this invention not only performs numerical corrections but also forms readable business reasoning chains.

[0088] Example 5: Ablation experiment.

[0089] Table 3. Examples of effects based on multiple model variants

[0090] Ablation results demonstrate that the two-stage frequency domain fusion mechanism and the GRPO-based large language model discrete calibration mechanism of this invention make non-redundant contributions. The former injects stable low-frequency structures by retrieving historical and future trajectories, while the latter utilizes external intervention information through interpretable discrete decision-making. The combination of the two can achieve the best overall prediction performance.

[0091] like Figure 3 As shown, this invention proposes a systematic framework to address the challenges of short history, high volatility, and promotional / policy shocks in time series forecasting. Specifically: For the short history issue, this invention constructs an embedding library, i.e., a vectorized index of the historical window library, to establish historical pattern memory and transfer reusable patterns to short historical sequences. Simultaneously, by searching similar sequences, transferable patterns are discovered from similar contexts, effectively alleviating data scarcity. For the high volatility issue, this invention introduces a frequency domain fusion mechanism to retain transferable low-frequency patterns while avoiding the injection of object-specific short-term shocks and noise, thereby improving forecast stability. For the promotional / policy shock issue, this invention employs a large language model calibration module to adjust the forecast results in conjunction with the business context, ensuring that it reasonably reflects the impact of promotional or policy changes. Experimental results show that, compared to baseline forecasting, the framework of this invention can obtain more accurate forecast results in sparse and highly volatile demand scenarios.

[0092] In summary, the present invention has at least the following advantages over the prior art: (1) This invention can improve the prediction stability in scenarios with short history and scarce samples. This invention constructs a historical window library by pre-training a time series representation model and retrieves similar segments from historical samples across commodities, months, and scenarios, so that the target sequence can still obtain external references when its own history is short or its fluctuations are strong. Compared with prediction methods that rely solely on the historical data of the target sequence itself, this mechanism can make fuller use of the enterprise's existing historical data assets and reduce the prediction uncertainty of cold-start commodities, short-life cycle commodities, or months with abnormal fluctuations.

[0093] (2) This invention avoids coarse transfer of retrieved information. This invention does not directly copy, splice, or superimpose retrieval sequences, but instead converts the retrieval trajectory and target trajectory to the frequency domain and selectively fuses only the low-frequency components. Since the low-frequency components mainly correspond to stable structures such as trends, seasonality, and life cycles, while the high-frequency components mainly correspond to short-term promotional shocks, random disturbances, and individual differences in products, this design can both absorb transferable patterns from similar samples and reduce the risk of erroneously introducing short-term noise from other products.

[0094] (3) This invention can fully utilize the historical and future information of the retrieved samples. This invention adopts a two-stage mechanism of pre-prediction historical fusion and post-prediction future injection. Pre-prediction historical fusion is used to enhance the input context of the pre-trained prediction model, and post-prediction future injection is used to correct the prediction trend by utilizing the actual future trajectories that occur after similar historical observation segments. The two-stage mechanism allows both similar historical trends and the evolutionary patterns after similar trends in the retrieved samples to play a role, which is superior to the scheme of using retrieval information only at the input or output end.

[0095] (4) This invention has strong model compatibility and deployment convenience. The frequency domain fusion module is located outside the pre-trained prediction model and does not depend on the internal structure of the prediction model. It can be used in conjunction with Chronos-2 or other time series base models. In actual deployment, this method can be used as a plug-and-play enhancement module superimposed on existing prediction systems, reducing the cost of retraining dedicated models.

[0096] (5) This invention can improve the controllability and interpretability in complex external intervention scenarios. This invention transforms the calibration of large language models from directly generating continuous values ​​to a discrete action selection problem, enabling the large language model to select calibration actions of upward adjustment, downward adjustment, or basic maintenance based on object attributes, seasonal patterns, historical observations, external events, and basic forecast values. This method ensures that the final prediction result is still anchored to the output of the time series model, avoiding the large language model from generating unreasonable values ​​without constraints, while also outputting the reasoning basis in natural language, making it easier for business personnel to understand the reasons for the prediction adjustment.

[0097] (6) This invention optimizes the calibration strategy through reinforcement learning to make it more stable. By using reinforcement learning methods such as GRPO, this invention optimizes the large language model strategy based on relative prediction error, confidence weighted penalty, within-group normalization and optimal action reward, so that the model not only learns which action is better, but also learns the relative ranking relationship between different candidate actions, thereby improving the generalization ability across products, months and sales scale scenarios.

[0098] (7) The effectiveness of the method was verified by experimental results. According to the experimental results, on six public datasets including ETTh1, ETTh2, Exchange, Traffic, M4, and FRED, the retrieval-enhanced frequency domain fusion method of this invention outperforms the pre-trained prediction backbone without retrieval enhancement in both WAPE and MSE metrics. On the industrial sales forecast dataset, the overall WAPE of this invention reached 31.41 and the overall MSE reached 3.30 × 10 for 12 forecast months. 6 The overall WAPE (36.44) and overall MSE (3.92 × 10⁻⁶) were superior to the strongest baseline. 6 .

[0099] Based on the above embodiments, the present invention also provides a time series prediction system based on retrieval enhancement, frequency domain fusion, and large model calibration, such as... Figure 4 As shown, the system includes: The sample retrieval module 01 is used to retrieve the top-ranked window samples in terms of similarity from a pre-built historical window library based on the target historical sequence of the target object as retrieval samples. Sample processing module 02 is used to scale-align each of the retrieved samples and generate historical retrieval reference trajectories and future retrieval reference trajectories by segmentation and aggregation. The frequency domain fusion and prediction enhancement module 03 is used to perform two-stage frequency domain fusion and model prediction based on the target historical sequence, the retrieval historical reference trajectory and the retrieval future reference trajectory to obtain the retrieval enhancement prediction result. Discrete calibration module 04 is used to perform discrete calibration of the large language model based on the structured prompt words corresponding to the target object and the retrieval enhancement prediction results, so as to obtain the calibrated prediction results and the corresponding inference explanations.

[0100] Based on the above embodiments, the present invention also provides a terminal, the principle block diagram of which can be as follows: Figure 5 As shown, the terminal includes a processor, memory, network interface, and display screen connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides the environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a time-series prediction method based on retrieval enhancement, frequency domain fusion, and large model calibration. The display screen can be a liquid crystal display (LCD) or an e-ink display.

[0101] Those skilled in the art will understand that Figure 5The schematic diagram shown is merely a partial structural diagram related to the present invention and does not constitute a limitation on the terminal to which the present invention is applied. A specific terminal may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0102] In one implementation, the terminal's memory stores one or more programs, and these programs are configured to be executed by one or more processors. The programs include instructions for performing a time-series prediction method based on retrieval enhancement, frequency domain fusion, and large model calibration.

[0103] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0104] In summary, this invention discloses a time series prediction method, system, terminal, and storage medium based on retrieval enhancement, frequency domain fusion, and large model calibration. The method includes: retrieving the top-ranked window samples in similarity from a pre-constructed historical window library based on the target historical sequence of the target object as retrieval samples; performing scale alignment on each retrieval sample and generating a retrieval historical reference trajectory and a retrieval future reference trajectory through segmented aggregation; performing two-stage frequency domain fusion and model prediction based on the target historical sequence, the retrieval historical reference trajectory, and the retrieval future reference trajectory to obtain a retrieval enhancement prediction result; and performing large language model discrete calibration based on the structured prompt words corresponding to the target object and the retrieval enhancement prediction result to obtain the calibrated prediction result and the corresponding inference explanation. This invention obtains the predicted value of the target object's future time interval by coordinating the processing of historical time series data, retrieved similar time series segments, frequency domain fusion results, and discrete calibration actions. Frequency domain fusion effectively distinguishes between transferable information across sequences and short-term perturbations of the target sequence itself, avoiding noise pollution caused by directly reusing retrieval segments. The two-stage fusion mechanism effectively utilizes both historical trends and future evolution information from the retrieved fragments, improving the accuracy and robustness of predictions. The discrete calibration method of the large language model avoids the instability problem of continuous numerical generation and can output interpretable reasoning information, thereby effectively enhancing prediction performance and credibility in short-term and complex external intervention scenarios.

[0105] It should be understood that the application of the present invention is not limited to the examples above. Those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims.

Claims

1. A time-series prediction method based on retrieval enhancement, frequency domain fusion, and large model calibration, characterized in that, The method includes: Based on the target object's historical sequence, the top-ranked window samples with the highest similarity are retrieved from a pre-built historical window library as retrieval samples; Each of the search samples is scale-aligned, and historical and future search reference trajectories are generated by segmented aggregation. Based on the target historical sequence, the retrieval historical reference trajectory, and the retrieval future reference trajectory, a two-stage frequency domain fusion and model prediction are performed to obtain the retrieval enhancement prediction result. Based on the structured prompts corresponding to the target object and the enhanced retrieval prediction results, a large language model is discretely calibrated to obtain the calibrated prediction results and the corresponding inference explanations.

2. The time series prediction method based on retrieval enhancement, frequency domain fusion, and large model calibration according to claim 1, characterized in that, The steps for constructing the history window library include: Obtain several original historical time series; The historical input length and prediction length are set, and each historical time series is divided into several window samples by means of a sliding window; each window sample contains a historical observation segment and a corresponding future trajectory segment; The historical window library is composed of all the window samples mentioned above.

3. The time series prediction method based on retrieval enhancement, frequency domain fusion, and large model calibration according to claim 1, characterized in that, The steps for retrieving the top-ranked window samples based on the similarity of the target object's historical sequence from a pre-built historical window library as retrieval samples include: Receive the target historical sequence of the target object; The target historical sequence and each window sample are encoded using a pre-trained temporal representation model. Calculate the similarity between the encoding vector of the target historical sequence and the encoding vector of each window sample, and select the first few window samples that meet the time constraints from the historical window library based on the similarity as the retrieval samples.

4. The time series prediction method based on retrieval enhancement, frequency domain fusion, and large model calibration according to claim 1, characterized in that, The steps of scaling each of the retrieved samples and generating historical and future retrieval reference trajectories through segmented aggregation include: For each of the search samples, the search samples are scale-aligned based on the statistical features corresponding to the target historical sequence and the search sample, respectively. The historical reference trajectory is generated by aggregating the historical observation segments of each retrieved sample after scale alignment, and the future reference trajectory is generated by aggregating the future trajectory segments of each retrieved sample after scale alignment.

5. The time series prediction method based on retrieval enhancement, frequency domain fusion, and large model calibration according to claim 1, characterized in that, The steps for performing two-stage frequency domain fusion and model prediction based on the target historical sequence, the retrieval historical reference trajectory, and the retrieval future reference trajectory to obtain the retrieval enhancement prediction result include: The target historical sequence and the retrieved historical reference trajectory are fused in the frequency domain in the first stage to obtain an enhanced historical input sequence; wherein, the fusion ratio corresponding to the first stage is determined based on the low-frequency correlation between the retrieved historical reference trajectory and the target historical sequence. The enhanced historical input sequence is input into a pre-trained prediction model to generate intermediate prediction results; The intermediate prediction results are fused with the future reference trajectory in the second stage to obtain the enhanced prediction results; wherein, the fusion ratio corresponding to the second stage is determined based on the consistency of the changing trend of the future trajectory segments of each retrieval sample.

6. The time series prediction method based on retrieval enhancement, frequency domain fusion, and large model calibration according to claim 1, characterized in that, The structured cue words corresponding to the target object include at least one of the following: object attributes, time context, historical observation statistics, external events, and the calibration action space of the intermediate prediction results and the target object.

7. The time series prediction method based on retrieval enhancement, frequency domain fusion, and large model calibration according to claim 6, characterized in that, The steps for performing discrete calibration of the large language model based on the structured prompts corresponding to the target object and the enhanced retrieval prediction results, to obtain the calibrated prediction results and corresponding inference explanations, include: The calibration action is selected in the calibration action space based on the structured cue words using a large language model; wherein the large language model is optimized using reinforcement learning. The retrieval enhancement prediction results are calibrated according to the selected calibration action to obtain the calibrated prediction results and the corresponding inference explanation.

8. A time series prediction system based on retrieval enhancement, frequency domain fusion, and large model calibration, characterized in that, The system includes: The sample retrieval module is used to retrieve the top-ranked window samples in terms of similarity from a pre-built historical window library based on the target historical sequence of the target object, and use them as retrieval samples. The sample processing module is used to scale-align each of the retrieved samples and generate historical retrieval reference trajectories and future retrieval reference trajectories by segmentation and aggregation. The frequency domain fusion and prediction enhancement module is used to perform two-stage frequency domain fusion and model prediction based on the target historical sequence, the retrieval historical reference trajectory and the retrieval future reference trajectory to obtain the retrieval enhancement prediction result. The discrete calibration module is used to perform discrete calibration of the large language model based on the structured prompts corresponding to the target object and the retrieval enhancement prediction results, so as to obtain the calibrated prediction results and the corresponding inference explanations.

9. A terminal, characterized in that, The terminal includes a memory and one or more processors; the memory stores one or more programs; the programs contain instructions for executing the time-series prediction method based on retrieval enhancement, frequency domain fusion and large model calibration as described in any one of claims 1 to 7; the processor is used to execute the programs.

10. A computer-readable storage medium storing a plurality of instructions thereon, characterized in that, The instructions are applicable to be loaded and executed by a processor to implement the steps of the time series prediction method based on retrieval enhancement, frequency domain fusion, and large model calibration as described in any one of claims 1 to 7.