[Paper Review] Dynamic Prediction Length for Time Series with Sequence to Sequence Networks
This paper proposes a dynamic prediction length mechanism for sequence-to-sequence models in time series forecasting, enabling variable-length output predictions based on model confidence. By introducing a novel confidence-based loss function with tailored gradient computation, the model outperforms static-length baselines, achieving an F1 score of 0.503 on ETF data—over 2x higher than a standard LSTM—while naturally adjusting prediction length according to security volatility.
Recurrent neural networks and sequence to sequence models require a predetermined length for prediction output length. Our model addresses this by allowing the network to predict a variable length output in inference. A new loss function with a tailored gradient computation is developed that trades off prediction accuracy and output length. The model utilizes a function to determine whether a particular output at a time should be evaluated or not given a predetermined threshold. We evaluate the model on the problem of predicting the prices of securities. We find that the model makes longer predictions for more stable securities and it naturally balances prediction accuracy and length.
Motivation & Objective
- Address the limitation of fixed-length output prediction in RNNs and seq2seq models for time series forecasting.
- Enable models to generate variable-length predictions during inference based on confidence in each output step.
- Develop a new loss function that balances prediction accuracy and output length by incorporating confidence estimation.
- Improve forecasting performance on volatile financial time series by allowing dynamic prediction horizons tailored to individual securities.
- Demonstrate that dynamic prediction length leads to better F1 scores and more robust predictions than static-length models, especially on datasets with skewed volatility distributions.
Proposed method
- Propose a confidence distance (CD) metric to quantify model confidence in each prediction step without relying on Bayesian methods.
- Design a novel loss function that combines prediction accuracy and output length, using a thresholded confidence score to determine when to stop generating predictions.
- Implement a sigmoid masking function to dynamically suppress low-confidence predictions, allowing variable-length outputs independent of input sequence length.
- Use a sequence-to-sequence architecture with attention, where the decoder generates predictions step-by-step and applies confidence-based stopping criteria.
- Tailor gradient computation to handle variable-length sequences during backpropagation, ensuring stable training despite differing output lengths.
- Train the model on financial time series data with multiple securities, using walk-forward validation to simulate real-world prediction scenarios.
Experimental results
Research questions
- RQ1Can a sequence-to-sequence model dynamically adjust its prediction length during inference based on confidence, without requiring fixed-length output sequences in training?
- RQ2How does the proposed confidence-based loss function compare to standard loss functions in balancing F1 score and prediction length across different time series?
- RQ3Does the model’s ability to generate longer predictions for low-volatility securities and shorter ones for high-volatility securities lead to improved overall forecasting performance?
- RQ4What is the impact of different confidence functions (CD, TV, EMD) and masking strategies (indicator vs. sigmoid) on model performance and robustness?
- RQ5Can the dynamic prediction model outperform static-length models across diverse financial time series with varying volatility profiles?
Key findings
- The dynamic prediction length model achieved an F1 score of 0.503 on the ETF dataset, significantly outperforming a standard LSTM model with a single prediction (F1 = 0.209).
- The model with confidence distance (CD) and sigmoid masking achieved the highest performance, improving F1 by 6.45% over the best static model on the ETF dataset.
- On the five-commodity dataset, the dynamic model outperformed all static models (1, 4, 7, 10-step predictions), with a 21.2% relative F1 improvement over the best static baseline.
- The model naturally generates longer predictions for low-volatility securities and shorter ones for high-volatility securities, reflecting its adaptive behavior to market conditions.
- The sigmoid masking function consistently outperformed the indicator function, though it required careful tuning of the threshold parameter τ.
- The optimal configuration uses τ ∈ [0.05, 0.5] and λ ≤ 1.0 with the CD metric and sigmoid masking, achieving the best trade-off between F1 score and prediction length.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.