Abstract:The complexity of grain price fluctuations has significantly increased, profoundly impacting policy formulation, market regulation, and farmers’ incomes. Traditional prediction methods struggle to effectively capture complex nonlinear characteristics, resulting in limitations in both prediction accuracy and applicability. To address this practical issue, a multi-feature variable prediction model based on dual-attention mechanism LSTM was developed. By introducing feature attention and temporal attention mechanisms, the model enhances its capability to identify key variables and improve prediction accuracy from the data level. Additionally, the integration of public attention indices as a new variable, combined with the TFT temporal fusion transformer model and SHAP model under the explainable artificial intelligence (XAI) framework, enables detailed interpretation of the major factors influencing grain prices and their transmission pathways. The research findings demonstrate that the dual-attention mechanism significantly optimizes prediction performance, with the public attention index playing a crucial role in short-term price fluctuations. Domestic futures prices and international oil prices are identified as dominant factors affecting grain price volatility. Further analysis suggests that establishing a multi-departmental collaborative prediction and early warning system, alongside enhanced monitoring of online public opinion dynamics and public sentiment management, can effectively mitigate the risks associated with grain price fluctuations.