Water and electricity long sequence retrieval method, system and equipment based on time sequence embedded large model and medium
By combining rotational position coding and adaptive frequency modulation mechanisms with a segmented parallel coding strategy, the problems of context window limitation and time-varying periodicity adaptation in hydropower long sequence data processing are solved, achieving efficient long sequence modeling and cross-modal retrieval, and improving the intelligence level of hydropower monitoring systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-11
- Publication Date
- 2026-03-10
AI Technical Summary
Existing time-series representation learning models are limited by short context windows and cannot model long-term dependencies of more than 8,000 points in hydropower scenarios. Static location encoding cannot adapt to the time-varying periodicity of hydropower data and lacks end-to-end long-sequence semantic retrieval capabilities.
We employ a rotational position coding combined with an adaptive frequency modulation mechanism, and use a segmented parallel coding strategy to process multivariate long time-series data. We also construct a unified semantic embedding space to support cross-modal retrieval of text and time-series data.
It achieves effective modeling of long sequences of 32K points, improves the accuracy and recall of key event identification, reduces inference latency, supports end-to-end semantic retrieval of long sequences, and improves the intelligence level of hydropower monitoring systems.
Smart Images

Figure CN121636684A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of interdisciplinary technology of artificial intelligence and water conservancy engineering, specifically to a method, system, device and medium for retrieving long hydropower sequences based on a time-series embedded large model. Background Technology
[0002] Existing models such as TS2Vec generate fragment-level embeddings through hierarchical contrastive learning, but their maximum context window is limited to 512 points, making it unable to model long-cycle dependencies exceeding 8,000 points in hydropower scenarios. Similar methods such as TS-TCC and CoST have not overcome the short context bottleneck, resulting in a recall rate of only 28% for critical events such as heavy rain. Segmented aggregation methods compress sequences, leading to the loss of details, and sparse attention mechanisms such as Longformer struggle to maintain fine-grained feature capture capabilities on sequences larger than 4,000 points.
[0003] Traditional absolute positional encodings such as Sinusoidal suffer from extrapolation degradation; relative positional encodings such as T5Bias and ALiBi are not well adapted to periodic time series; Rotated positional encoding (RoPE) performs well in language models, but has not been widely used in long-range modeling of multivariate time series.
[0004] Location interpolation (PI) introduces high-frequency information loss; although NTK-aware scaling is superior to fixed interpolation, its scaling factor is a static hyperparameter, which cannot adapt to the time-varying periodic requirements of hydropower data determined by the wet / dry season.
[0005] Traditional methods rely on statistical features and machine learning models, but these are mostly single-task, independent modeling methods that lack end-to-end long-sequence semantic retrieval capabilities. More importantly, the hydropower field lacks publicly available large-scale retrieval datasets, which restricts algorithm reproducibility and fair comparison. Summary of the Invention
[0006] In view of the above-mentioned problems, the present invention provides a method, system, device and medium for retrieving long hydropower sequences based on a time-series embedded large model.
[0007] Therefore, the technical problem solved by this invention is that existing time-series representation learning models are limited by short context windows, with the maximum context window limited to 512 points, which cannot model long-term dependencies of more than 8,000 points in hydropower scenarios, resulting in a recall rate of only 28% for key events such as rainstorms; static location encoding cannot adapt to the time-varying periodicity of hydropower data determined by the wet and dry seasons; and there is a lack of end-to-end long sequence semantic retrieval capabilities.
[0008] To address the aforementioned technical problems, this invention provides the following technical solution: a method for retrieving long hydropower sequences based on a time-series embedded large model, comprising, Input multivariate long time series data, which is a time series record of hydropower operation parameters; The multivariate long time-series data is subjected to time-adaptive encoding through a core processing layer. The core processing layer uses a rotating position encoding to establish the correspondence between time steps and feature vectors, dynamically adjusts the basic frequency parameters of the rotating position encoding through an adaptive frequency modulation mechanism, and uses a segmented parallel encoding strategy to process the multivariate long time-series data in blocks. Output a unified semantic embedding space to support cross-modal retrieval of text and time-series data; User queries are processed through a multimodal retrieval mechanism, which performs semantic matching based on a preset engineering query template.
[0009] As a preferred embodiment of the hydropower long sequence retrieval method based on a time-series embedded large model described in this invention, the step of dynamically adjusting the basic frequency parameters of the rotating position code through an adaptive frequency modulation mechanism includes calculating the frequency modulation coefficients through a modulation function based on the multivariate long time-series data. Multiply the frequency modulation coefficients by the fundamental frequency parameters of the rotational position code to obtain the modulated frequency parameters; Rotational position coding is performed on the multivariable long time-series data based on the modulated frequency parameters.
[0010] The beneficial effects of this preferred technical solution are as follows: By dynamically calculating the frequency modulation coefficient based on multivariate long-term time-series data, it overcomes the deficiency of existing static scaling methods in adapting to the time-varying periodicity of hydropower data. The modulation function in this solution can adaptively adjust the basic frequency parameters of the rotating position coding according to the periodic variation characteristics of the data. This allows the model to automatically adapt to the corresponding frequency range when processing hydropower data with different periodic characteristics such as high-water and low-water seasons, avoiding the performance degradation of traditional static position coding during long-series extrapolation, and improving the ability to capture periodic patterns in long-term hydropower data and the accuracy of identifying key events.
[0011] As a preferred embodiment of the hydropower long sequence retrieval method based on a time-series embedded large model described in this invention, the step of using a segmented parallel coding strategy to perform block processing on the multivariate long time-series data includes dividing the multivariate long time-series data into multiple data segments of fixed length. The location indexes of each data segment are reorganized using a location index mapping strategy. The reorganized data segments are processed in parallel.
[0012] The beneficial effects of this preferred technical solution are as follows: By segmenting long time-series data into fixed-length data segments and reorganizing them using a position index mapping strategy, the short context window limitation of existing time-series models is overcome. This solution employs block-based parallel processing technology, achieving effective modeling of long sequences and significantly reducing inference latency. It can improve the processing efficiency of long sequences while maintaining fine-grained feature capture capabilities, solving the problem of low recall rate in existing methods when dealing with long-period dependencies in hydropower scenarios. This enhances the identification capability of critical events such as rainstorms and improves the early warning response speed of hydropower monitoring systems to abnormal operating conditions.
[0013] As a preferred embodiment of the hydropower long-sequence retrieval method based on a time-series embedded large model described in this invention, the cross-modal retrieval of text and time-series data includes: A text encoder is used to encode the text query to generate text semantic features; The core processing layer is used to encode the multivariate long time-series data to generate time-series semantic features; In the unified semantic embedding space, the similarity between the text semantic features and the temporal semantic features is calculated.
[0014] As a preferred embodiment of the hydropower long sequence retrieval method based on a temporal embedding large model described in this invention, wherein: calculating the similarity between the text semantic features and the temporal semantic features includes calculating the inner product of the text semantic feature vector and the temporal semantic feature vector; Calculate the magnitude of the text semantic feature vector and the magnitude of the temporal semantic feature vector, respectively; The similarity is obtained by dividing the inner product by the product of the magnitude of the text semantic feature vector and the magnitude of the temporal semantic feature vector.
[0015] As a preferred embodiment of the hydropower long sequence retrieval method based on a time-series embedded large model described in this invention, the rotated position encoding is represented as follows: in, Let t be the query vector, t be the time step, and d be the embedding dimension.
[0016] As a preferred embodiment of the hydropower long sequence retrieval method based on a time-series embedded large model described in this invention, the modulation function is expressed as follows: Where α and β are adjustable parameters, This represents the hydroelectric cycle value.
[0017] This invention provides a hydropower long sequence retrieval system based on a time-series embedded large model.
[0018] To solve the above technical problems, the present invention provides the following technical solution: a hydropower long-sequence retrieval system based on a time-series embedded large model, comprising: a data input module for inputting multivariate long-sequence data, wherein the multivariate long-sequence data is a time-series record of hydropower operation parameters; The timing coding module is used to perform timing adaptive coding on the multivariate long time-series data through the core processing layer. The core processing layer uses rotating position coding to establish the correspondence between time steps and feature vectors, dynamically adjusts the basic frequency parameters of the rotating position coding through an adaptive frequency modulation mechanism, and uses a segmented parallel coding strategy to process the multivariate long time-series data in blocks. The semantic analysis module is used to output a unified semantic embedding space to support cross-modal retrieval of text and time-series data; The retrieval and matching module is used to process user queries through a multimodal retrieval mechanism, which performs semantic matching based on a preset engineering query template.
[0019] The present invention provides a computer device, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the hydropower long sequence retrieval method based on a time-series embedded large model.
[0020] The present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the hydropower long sequence retrieval method based on a time-series embedded large model.
[0021] The beneficial effects of this invention are as follows: Through an adaptive frequency modulation mechanism, the frequency modulation coefficients are calculated using a modulation function based on multivariate long-time-series data, and the basic frequency parameters of the rotating position encoding are dynamically adjusted, enabling the model to adapt to the periodic variation characteristics of hydropower data. Through a segmented parallel encoding strategy, long sequences are divided into fixed-length data segments, and the position indexes are reorganized using a position index mapping strategy. Combined with block-based parallel processing technology, this breaks through the traditional 512-point context window limitation, achieving 32K-point long-series modeling with a 40% reduction in inference latency, and an inference latency of less than 100 seconds for 8760-point sequences. By constructing a unified semantic embedding space, a text encoder is used to encode text queries to generate text semantic features, and a core processing layer is used to encode multivariate long-time-series data to generate time-series semantic features. The similarity between text semantic features and time-series semantic features is calculated, enabling cross-modal retrieval of text and time-series data. It supports semantic matching using preset engineering query templates, improving the intelligence level of the hydropower monitoring system. This makes it suitable for application scenarios such as hourly safety early warning for hydropower systems, reservoir optimization scheduling, and cross-parameter intelligent analysis. Attached Figure Description
[0022] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 The above is a flowchart of a hydropower long sequence retrieval method based on a time-series embedded large model, which is an embodiment of the present invention.
[0024] Figure 2 The diagram below illustrates the Hydro-TemporalEmbed framework for a hydropower long sequence retrieval method based on a large temporal embedding model, as provided in one embodiment of the present invention.
[0025] Figure 3 The flowchart below shows a parallel context window for a hydropower long sequence retrieval method based on a time-series embedded large model, as provided in one embodiment of the present invention. Detailed Implementation
[0026] To make the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.
[0027] Example 1, referring to Figure 1 This is one embodiment of the present invention, which provides a method for retrieving long hydropower sequences based on a time-series embedded large model, including: Step 1: Input multivariate long time series data, which is a time series record of hydropower operation parameters; Step 2: The multivariate long time series data is subjected to time-adaptive encoding through the core processing layer. The core processing layer uses rotating position encoding to establish the correspondence between time steps and feature vectors, dynamically adjusts the basic frequency parameters of the rotating position encoding through an adaptive frequency modulation mechanism, and uses a segmented parallel encoding strategy to process the multivariate long time series data in blocks. Step 3: Output a unified semantic embedding space to support cross-modal retrieval of text and time-series data; Step 4: Process user queries through a multimodal retrieval mechanism, which performs semantic matching based on a preset engineering query template.
[0028] In this embodiment, the multivariate long time series data is time series measurement data collected during the operation of the hydropower station, with a sampling interval of 1 hour per point. Specifically, it includes parameters such as the water level upstream of the dam, the water level downstream of the dam, the inflow, the outflow, the power generation flow, the water discharge flow, the total power output of the plant, and the areal rainfall. The data is stored in CSV format. The time-series adaptive encoding process of the core processing layer includes three key steps: First, rotational position encoding calculates the basic frequency parameters corresponding to each dimension according to the dimensional index of the feature vector using an exponential decay rule. It then calculates the rotation angle based on the time step position index and the basic frequency parameters, converts the rotation angle into a trigonometric function value, and performs a rotation transformation with the input vector. Second, the adaptive frequency modulation mechanism calculates a sine function value based on the ratio of the current timestamp to the hydrological cycle parameter. It then linearly combines the sine function value with adjustable parameters to obtain the frequency modulation coefficient. This coefficient is multiplied by the basic frequency parameters to obtain the modulated frequency parameters, which are then used to encode the time-series data. Finally, a segmented parallel encoding strategy divides the long time-series data into fixed-length data segments. The position indices of each segment are reorganized using grouped position mapping or cyclic position mapping. The reorganized data segments are then processed in block parallel processing. The unified semantic embedding space encodes text queries to generate text semantic features through a text encoder, and encodes time-series data to generate time-series semantic features through a core processing layer. The inner product of the text semantic feature vector and the time-series semantic feature vector is calculated in this unified space. The magnitudes of the two vectors are calculated separately, and the similarity is obtained by dividing the inner product by the magnitude product. The multimodal retrieval mechanism supports engineering query templates such as single-hour value query, single-day highest value query, single-day lowest value query, single-day average value query, time period trend query, single-day highest value time query, single-day lowest value time query, and cross-class comparison query.
[0029] This embodiment addresses three core technical challenges faced by existing time-series models in processing and intelligently retrieving long-series hydropower data through the coordinated implementation of the four steps described above. First, addressing the issue that existing time-series models are limited to a maximum context window of 512 points, making it impossible to model long-term dependencies exceeding 8,000 points in hydropower scenarios and resulting in low recall rates for critical events, this embodiment overcomes the short context window limitation through a segmented parallel encoding strategy, achieving effective modeling of long-series data. Second, addressing the problem that static location encoding cannot adapt to the time-varying periodicity of hydropower data determined by wet and dry seasons, and that performance degrades during long-series extrapolation, this embodiment dynamically adjusts the encoding frequency parameters based on the periodic variation characteristics of the data through an adaptive frequency modulation mechanism, enabling the model to adapt to different periodic patterns. Finally, addressing the lack of end-to-end long-series semantic retrieval capabilities in traditional hydropower monitoring systems and the inability of users to query historical time-series data using natural language, this embodiment achieves cross-modal retrieval of text and time-series data by constructing a unified semantic embedding space and performing semantic matching based on engineering query templates.
[0030] Example 2, refer to Figure 2 and Figure 3 As an embodiment of the present invention, based on the previous embodiment, a method for retrieving long hydropower sequences based on a time-series embedded large model is provided, including: In step 1, input multivariate long time series data, which includes at least one type of parameter among the following: upstream water level, downstream water level, inflow, outflow, power generation flow, wastewater flow, total plant output, and areal rainfall.
[0031] In this embodiment, in step 1, the time-series records of hydropower operation parameters are stored in a CSV file, with a sampling interval of one hour per point. Each row in the CSV file records data for one time step, including a timestamp and the corresponding parameter measurement value, and each column corresponds to a parameter type. The CSV file is loaded through a file reading interface, and the parameter values for each time step are parsed in order of timestamp to form multivariate long time-series data.
[0032] In an optional implementation, in step 1, the time-series recording of hydropower operating parameters can establish a real-time connection with the hydropower station's monitoring system via a data interface, continuously acquiring the current measured values of each parameter according to a preset sampling interval. The monitoring system is equipped with monitoring devices such as water level sensors, flow sensors, power sensors, and rainfall sensors. Each sensor collects data according to a synchronized clock and transmits it to the data processing unit via a communication network. The system receives the real-time transmitted parameter data stream, buffers it according to the arrival order, and organizes it into multivariate long-time-series data.
[0033] In another optional implementation, in step 1, the time-series records of hydropower operating parameters can also send a query request to the hydropower station's historical database via a database query interface. The query request includes specified time ranges, parameter types, and sampling intervals. The database retrieves time-series records that meet the query conditions and returns the query results in chronological order. The database receives the query results and parses them into a standard format for multivariate long-time-series data.
[0034] In step 2, the fundamental frequency parameters of the rotating position coding are dynamically adjusted through an adaptive frequency modulation mechanism, and the multivariable long time-series data is segmented into blocks using a segmented parallel coding strategy, including the following steps A1-A6: In this embodiment of the application, in step A1, the modulation function is obtained by: calculating the sine function value based on the ratio of the current timestamp to the hydrological cycle parameter, and then linearly combining the sine function value with the adjustable parameter to obtain the frequency modulation coefficient.
[0035] Specifically, the mathematical expression for the modulation function is: Where τ is the current timestamp, The periodic parameters of hydropower (unit: time step) are extracted from the training set by Fourier transform (e.g., the typical cycle of the wet / dry season is 180 / 365 days). The learnable parameters α and β are optimized by backpropagation. The initial values are set according to the "Hydrological Forecasting Specification" (GB / T22482)
[15] as α=1.2 and β=0.8, which conforms to the characteristics of typical reservoir scheduling curves and solves the defect that static NTK interpolation cannot adapt to the time-varying periodicity of hydropower.
[0036] The frequency adaptive adjustment when the window is extended to 32kHz is achieved by modulating the RoPE rotation angle fundamental frequency, which can be expressed as follows: In an optional implementation, in step A1, the modulation function can be implemented using a cosine function. The cosine function value is calculated based on the ratio of the current timestamp to the hydrological periodic parameter. A phase parameter is introduced to adjust the starting position of the periodic change. The cosine function value is then linearly combined with the adjustable parameter to obtain the frequency modulation coefficient. The cosine function modulation function is mathematically equivalent to the sine function modulation function. By setting the phase parameter, it can be adapted to the actual starting time of the high-water and low-water periods of different hydropower stations. The initial values of the adjustable parameter and the phase parameter can be set according to hydrological forecasting specifications and optimized during the training process.
[0037] In another optional implementation, in step A1, the modulation function can also be obtained by superimposing multiple sine functions with different periods, calculating the corresponding sine function values for each of the multiple hydrological periodic parameters, multiplying each sine function value by its respective amplitude parameter, summing them, and then combining them with the offset parameter to obtain the frequency modulation coefficient. The multiple hydrological periodic parameters correspond to different periodic components in the hydropower data, such as annual and semi-annual periods, and are obtained by identifying multiple dominant frequency components through Fourier transform. This implementation can simultaneously capture the composite periodic characteristics in hydropower data and is suitable for hydropower stations with obvious multi-period characteristics.
[0038] In this embodiment of the application, in step A3, the rotational position encoding calculates the rotation angle fundamental frequency corresponding to each dimension based on the dimension index of the feature vector, multiplies the rotation angle fundamental frequency with the frequency modulation coefficient to obtain the modulated rotation angle fundamental frequency, calculates the rotation angle based on the absolute position index of the input vector and the modulated rotation angle fundamental frequency, converts the rotation angle into cosine and sine values, and performs element-wise multiplication with the input vector to achieve rotation transformation.
[0039] Specifically, the rotational position encoding replaces the original position encoding with the E5-base model, represented as: in, For time step The corresponding dimension is The input vector, For the first The fundamental frequency of the group rotation angle, with respect to the dimension index Increase and decrease The total dimension of the vector. Grouped indexes for rotation dimensions, with values ranging from 1 to 2. This is the absolute position index of the input vector. This represents element-wise multiplication, where t is the absolute index of the input vector.
[0040] The rotation angle fundamental frequency The calculation uses the exponential decay rule, and the calculation formula is as follows: This results in lower-dimensional indices corresponding to higher fundamental frequencies and higher-dimensional indices corresponding to lower fundamental frequencies. In step A2, the frequency modulation coefficient is multiplied by the rotation angle fundamental frequency to obtain the modulated rotation angle fundamental frequency. in, The frequency modulation coefficients calculated in step A1 are used. The rotation angle is determined by indexing the absolute position of the input vector. With modulated rotation angle fundamental frequency Multiplying them together yields the result, i.e. Calculate the cosine value for each rotation angle. Sine value Construct the rotation matrix. The input vector Each dimension of the vector is multiplied element-wise with its corresponding cosine or sine value to perform a rotation transformation, generating the encoded feature vector. This rotational positional encoding method establishes a correspondence between the time step and the feature vector through rotation transformation, exhibiting better extrapolation performance compared to traditional absolute positional encoding.
[0041] In an optional implementation, in step A3, the rotational position encoding can employ a simplified method for calculating the fundamental frequency. The fundamental frequency parameters are set as a fixed geometric sequence. The rotation angles of each dimension are directly calculated based on the time step position index and the modulated frequency parameters. These rotation angles are then converted into trigonometric function values and rotated with the input vector. The common ratio of the geometric sequence can be pre-set based on the total number of dimensions of the feature vector, for example, set to one-half or one-quarter.
[0042] In another optional implementation, step A3, rotational position encoding can also be achieved by dividing the feature vector into multiple groups according to its dimension, and then performing rotational encoding on each group using different frequency ranges. The lower-dimensional group uses a higher frequency range to capture short-term variation features, while the higher-dimensional group uses a lower frequency range to capture long-term trend features. Specifically, the corresponding basic frequency parameters are calculated based on the dimension range of each group, and the basic frequency parameters are multiplied by the frequency modulation coefficients to obtain the modulated frequency parameters for each group. After performing rotational transformations on each group, the results are concatenated to obtain the complete encoding result.
[0043] It should be noted that, as Figure 3 As shown, long sequence block parallel processing is implemented through parallel context window (PCW), including the following steps: First, the long document is segmented into 512-token fragments. Then, a position ID reorganization strategy is adopted: grouping position: fgp(pid) → ⌊pid / s⌋ or cyclic position frp(pid) → (pidmodLo). Combined with the FlashAttention-2 acceleration engine, inference latency is reduced by 40%.
[0044] In step 3, a unified semantic embedding space is output to support cross-modal retrieval of text and time-series data, including the following steps B1-B3: B1: The text query is encoded using a text encoder to generate text semantic features; B2: The core processing layer is used to encode the multivariate long time-series data to generate time-series semantic features; B3: Calculate the similarity between the text semantic features and the temporal semantic features in the unified semantic embedding space.
[0045] Furthermore, calculating the similarity between the text semantic features and the temporal semantic features includes, Calculate the inner product of the text semantic feature vector and the temporal semantic feature vector; Calculate the magnitude of the text semantic feature vector and the magnitude of the temporal semantic feature vector, respectively; The similarity is obtained by dividing the inner product by the product of the magnitude of the text semantic feature vector and the magnitude of the temporal semantic feature vector.
[0046] In this embodiment, in step 4, the multimodal retrieval mechanism performs template matching on the user-input natural language query based on a preset engineering query template, extracts key parameters from the query, encodes the text query into a query vector, calculates the similarity between the query vector and the historical time-series data embedding vector, sorts them from high to low similarity, and returns the previous results. A matching time-series data segment and its associated parameters.
[0047] Specifically, the preset engineering query template includes eight query modes: single-hour value query, single-day highest value query, single-day lowest value query, single-day average value query, time period trend query, single-day highest value time query, single-day lowest value time query, and cross-category comparison query. Parameter categories include upstream water level, downstream water level, inflow, outflow, power generation flow, wastewater flow, total plant output, and areal rainfall.
[0048] The query vector Through steps The text encoder generates the historical time-series data embedding vector. Through steps The core processing layer encodes and generates multivariate long time-series data from the historical time-series database. The similarity calculation uses cosine similarity, and the formula is: The similarity value ranges from negative one to positive one; the closer the similarity is to positive one, the more similar the query vector and the time-series data embedding vector are. Historical time-series data segments are sorted from high to low based on similarity, and the top-ranked segments are selected. The time series data segments with the highest similarity were used as the search results, among which The preset number of returned results. The search results include the time range of the matched time-series data segments, the corresponding parameter values, and other associated parameter information, output in JSON format.
[0049] For example, for the input query: retrieve the dates in 2024 when the daily inflow exceeded 500 m³ / s during the rainy season; the system matches the rainstorm event patterns in the historical sequence; the output is: {"Date":["2024-07-15","2024-08-02"],"Related Parameters":{"Water Level Above Dam":[182.3m,181.9m],"Area Rainfall":[45.2mm,38.7mm]}}.
[0050] In an optional implementation, in step 4, the multimodal retrieval mechanism can extract keywords from the user's natural language query, match the keywords with a preset parameter category dictionary, identify the parameter categories and time ranges involved in the query, convert the keyword combinations into structured query conditions, filter time-series data segments that meet the conditions in a historical time-series database, and return the filtered results after ranking them by similarity. The keyword extraction employs word segmentation and named entity recognition technologies, and the parameter category dictionary contains standard names and common aliases for each parameter category. This implementation is suitable for scenarios where the query statement structure is relatively standardized and the key information is clear, enabling rapid location of the target data range and improving retrieval efficiency.
[0051] In another optional implementation, in step 4, the multimodal retrieval mechanism can also perform retrieval through multiple rounds of interaction. First, it returns preliminary retrieval results based on the user's initial query. Then, based on these preliminary results, it prompts the user with further refined query dimensions. It receives the user's refined query input, performs secondary filtering and similarity re-sorting based on the preliminary results, and returns more accurate final retrieval results. These refined query dimensions include narrowing the time range, adding parameter category constraints, and adjusting numerical thresholds. For example, if the initial query is to retrieve dates with abnormal inflow, after the system returns multiple candidate dates, it prompts the user to further filter by rainfall amount or water level change. If the user selects rainfall greater than 40 mm, the system filters out dates that meet the criteria from the preliminary results. This implementation is suitable for scenarios where the query intent is not clear or requires exploratory analysis. By gradually refining the search conditions through interaction, it improves the accuracy of the search results and user satisfaction.
[0052] Furthermore, the loss function is expressed as: in, Represents the query vector. The vector representing the positive sample time series data is the embedding vector for the correct time series data.
[0053] As shown in Table 1, eight types of project query templates are supported, such as cross-category comparison: "Which has a higher hourly value: {date} for {category1} or {category2}?" Table 1 HydroT-Bench Query Template
[0054] Example 3 is an embodiment of the present invention, which provides a hydropower long sequence retrieval system based on a time-series embedded large model, including: The data input module is used to input multivariate long time-series data, which is a time-series record of hydropower operation parameters; The timing coding module is used to perform timing adaptive coding on the multivariate long time-series data through the core processing layer. The core processing layer uses rotating position coding to establish the correspondence between time steps and feature vectors, dynamically adjusts the basic frequency parameters of the rotating position coding through an adaptive frequency modulation mechanism, and uses a segmented parallel coding strategy to process the multivariate long time-series data in blocks. The semantic analysis module is used to output a unified semantic embedding space to support cross-modal retrieval of text and time-series data; The retrieval and matching module is used to process user queries through a multimodal retrieval mechanism, which performs semantic matching based on a preset engineering query template.
[0055] It should be noted that this embodiment systematically solves the technical problem that traditional models, due to limitations in location encoding, cannot handle long hydropower sequences exceeding 512 points and are difficult to adapt to the dynamic characteristics of hydropower cycles. By integrating RoPE location encoding and dynamic NTK interpolation, a 32K-point long sequence modeling is achieved through a time-series adaptive encoding module; a unified text-time series cross-modal semantic space is constructed, in which hydrological parameters (dam water level, power generation flow, etc.) are time-series encoded and aligned with text query embeddings; semantic-level retrieval of 8 types of engineering query templates (such as time-period trend analysis, cross-parameter comparison), hydropower cycle parameters, etc. The system dynamically adjusts the RoPE base frequency. Deployed on an NVIDIA V100+ GPU, it achieves a response time of 100 seconds for 8760-point sequences, with a recall rate of 91%. It is primarily used for hydropower safety early warning, reservoir scheduling optimization, and multi-parameter intelligent decision-making.
[0056] The system inputs multivariate long-time-series data, including at least one type of parameter from the following: upstream water level, downstream water level, inflow, outflow, power generation flow, wastewater discharge, total plant output, and areal rainfall. It performs time-adaptive encoding through a core processing layer that integrates RoPE location encoding and dynamic NTK interpolation, combined with a parallel context window method, to achieve 32K-point long-series modeling. It outputs a unified semantic embedding space to support text-time-series cross-modal retrieval. Finally, it processes user queries through a multimodal retrieval mechanism that supports semantic-level matching using preset engineering query templates.
[0057] The multimodal retrieval mechanism supports engineering query templates including at least one of the following: single-hour value query, single-day highest value query, single-day lowest value query, single-day average value query, time period trend query, single-day highest value time query, single-day lowest value time query, and cross-class comparison query.
[0058] The cross-category comparison query template is: "Which has a higher hourly value: {date}{category1} or {category2}?" where date is the date parameter, category1 and category2 are different parameter categories, and hour is the hour parameter.
[0059] The hardware deployment uses NVIDIA V100 or higher GPUs and ≥32GB of memory to support 32K point sequence processing. It is used for hourly-level safety early warning, reservoir optimization scheduling, or cross-parameter intelligent analysis in hydropower systems.
[0060] The parallel context window method is used to achieve a sequence inference latency of less than 100 seconds for 8760 points.
[0061] This embodiment also provides an electronic device applicable to a hydropower long sequence retrieval method based on a time-series embedded large model, comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the hydropower long sequence retrieval method based on a time-series embedded large model as proposed in the above embodiment.
[0062] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, it implements a hydropower long sequence retrieval method based on a time-series embedded large model as proposed in the above embodiment.
[0063] The storage medium proposed in this embodiment and the method for retrieving long hydropower sequences based on a time-series embedded large model proposed in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.
[0064] In this embodiment, the hardware deployment of the method includes a GPU and memory. The GPU is an NVIDIA V100 or higher model, and the memory capacity is no less than 32GB to support 32k-point sequence processing. The software flow of the method includes three stages: data input, encoding processing, and retrieval output. In the data input stage, multivariate time-series data in CSV format is loaded. The sampling interval of the multivariate time-series data is 1 hour per point, and the parameters include the upstream water level, downstream water level, inflow, outflow, power generation flow, wastewater flow, total plant output, and areal rainfall. In the encoding processing stage, text paths and time-series paths are processed separately. The text path encodes the natural language query input by the user using an E5-RoPE encoder. The time-series path generates temporal semantic embeddings from the multivariate long time-series data using a dynamic NTK-RoPE encoder. The long sequence is divided into blocks using a parallel context window method, with each block containing 8192 time steps, and FlashAttention-2 is integrated to accelerate computation. In the retrieval output stage, the similarity between text semantic features and temporal semantic features is calculated through similarity retrieval, and the top K most similar matching temporal data segments and their associated parameters are returned.
[0065] Specifically, such as Figure 2 As shown, based on the Transformer architecture, it includes the following core modules: Word embedding layer: converts input tokens into vector representations; Multi-head self-attention mechanism: captures global dependencies; Feedforward network: performs non-linear transformations; Layer normalization: stabilizes the training process; Residual connection: alleviates the gradient vanishing problem.
[0066] Rotational Position Encoding (RoPE): Encodes relative position information through complex field rotation operations; Dynamic Position Bias (DPB): Flexible position encoding adapts to different input sizes; Long-Range Attention (LDA): Handles long-range dependencies; Short-Range Attention (SDA): Focuses on local context information; Cross-Scale Embedding Layer (CEL): Fuses multi-scale feature information; Encoder hierarchy: Multi-layer Transformer block stacking (12 layers); Each layer contains multi-head self-attention and feedforward networks; Hidden layer dimension is 768; The training process includes the following steps: The model constructs approximately 32k query-doc pairs; progressively expands the context length; and employs learning rate scheduling and early stopping strategies. Model parameters are shown in Table 2. Table 2 Model Parameter Table
[0067] Learning rate settings: fine-tuning learning rate: 1e-5 to 5e-6; learning rate scheduling: cosine decay; pre-training batches: 1024; fine-tuning batches: 128; gradient accumulation: adjusted according to GPU memory; regularization parameters: Dropout rate: 0.1; weight decay: 0.01; label smoothing: 0.1.
[0068] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.
[0069] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A hydropower long sequence retrieval method based on a timing embedding large model, characterized by: The method comprises the steps of: inputting multivariate long time series data, which is a time series record of water and electricity operation parameters; performing time series adaptive coding on the multivariate long time series data through a core processing layer, wherein the core processing layer adopts rotary position coding to establish a corresponding relationship between time steps and feature vectors, dynamically adjusts a basic frequency parameter of the rotary position coding through an adaptive frequency modulation mechanism, and adopts a segmented parallel coding strategy to perform block processing on the multivariate long time series data; outputting a unified semantic embedding space to support cross-modal retrieval of text and time series data; processing a user query through a multi-modal retrieval mechanism, which performs semantic matching based on a preset engineering query template.
2. The method of claim 1, wherein the method is based on a time sequence embedding large model. The step of dynamically adjusting the basic frequency parameter of the rotary position coding through the adaptive frequency modulation mechanism comprises the steps of: calculating a frequency modulation coefficient through a modulation function according to the multivariate long time series data; multiplying the frequency modulation coefficient and the basic frequency parameter of the rotary position coding to obtain a modulated frequency parameter; performing rotary position coding on the multivariate long time series data based on the modulated frequency parameter.
3. The method of claim 2, wherein the method is based on a time sequence embedding large model. The step of adopting the segmented parallel coding strategy to perform block processing on the multivariate long time series data comprises the steps of: segmenting the multivariate long time series data into a plurality of fixed-length data segments; reorganizing position indexes of each data segment through a position index mapping strategy; performing parallel processing on each reorganized data segment.
4. The hydropower long sequence retrieval method based on a timing embedding large model according to claim 3, characterized in that: The cross-modal retrieval of text and time series data comprises the steps of: encoding a text query through a text encoder to generate a text semantic feature; encoding the multivariate long time series data through the core processing layer to generate a time series semantic feature; calculating a similarity between the text semantic feature and the time series semantic feature in the unified semantic embedding space.
5. The hydropower long sequence retrieval method based on a timing embedding large model according to claim 4, characterized in that: The step of calculating the similarity between the text semantic feature and the time series semantic feature comprises the steps of: calculating an inner product of a text semantic feature vector and a time series semantic feature vector; respectively calculating a length of the text semantic feature vector and a length of the time series semantic feature vector; dividing the inner product by a product of the length of the text semantic feature vector and the length of the time series semantic feature vector to obtain the similarity.
6. The hydropower long sequence retrieval method based on a timing embedding large model according to claim 5, characterized in that: The rotary position coding is represented as: where, is the query vector, t is the time step, and d is the embedding dimension.
7. The method of claim 6, wherein the method is based on a time sequence embedding large model. The modulation function is represented as: where a and β are adjustable parameters, is the water power cycle value.
8. A hydropower long sequence retrieval system based on a time series embedding large model, applying a hydropower long sequence retrieval method based on a time series embedding large model according to any one of claims 1-7, characterized in that, The method comprises the steps of: a data input module for inputting multivariate long time series data, which is a time series record of water and electricity operation parameters; a time series coding module for performing time series adaptive coding on the multivariate long time series data through a core processing layer, wherein the core processing layer adopts rotary position coding to establish a corresponding relationship between time steps and feature vectors, dynamically adjusts a basic frequency parameter of the rotary position coding through an adaptive frequency modulation mechanism, and adopts a segmented parallel coding strategy to perform block processing on the multivariate long time series data; a semantic analysis module for outputting a unified semantic embedding space to support cross-modal retrieval of text and time series data; and a query processing module for processing a user query through a multi-modal retrieval mechanism, which performs semantic matching based on a preset engineering query template. The retrieval matching module is configured to process the user query through a multi-modal retrieval mechanism, which performs semantic matching based on a preset engineering query template. 9.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-8 when the computer program is executed by the processor. The computer program is executed by the processor to implement the steps of the water and electricity long sequence retrieval method based on the timing embedding large model in any one of claims 1-7.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the water and electricity long sequence retrieval method based on the timing embedding large model in any one of claims 1-7.