The article discusses the theoretical foundations of the analysis and forecasting of financial risk in the banking sector in conditions of market uncertainty. The relevance of the study lies in the fact that the growth of problem debts of commercial banks on loans to legal entities, individual entrepreneurs and individuals is currently the most relevant and debated issue in the banking community. The analysis of the dynamics of assets and the share of overdue loans in 2010–2021 has been carried out, trends in portfolio changes have been identified. The authors considered the advantages of using the VaR indicator as a measure of risk, noting that its weak side is the inability to assess extreme losses (in the tails) if the risk is realized in the range above the confi dence interval. The Perseptron program has been developed for forecasting the dynamics of the share of overdue loans in the portfolio of a commercial bank, which is formed on the Deductor platform. Quantization (grouping) of data was carried out using a neural network on the Deductor platform, which made it possible to identify certain patterns in the change in portfolio quality. It was revealed that the value of the share of overdue loans of commercial banks is influenced by many factors, including factors included in the AI-system, so four parameters are placed on the input layer of the perceptron (%): growth in assets, market share, change in the loan portfolio, dynamics of overdue loans. The output layer has one parameter: forecast of the share of overdue loans (%). In addition to the input layer, the neural network architecture has two hidden layers, and an output layer with one parameter. The neural network shows high forecast accuracy. The error rate for Post Bank was 1.2159 %. The authors consider a wide range of financial mathematics tools proposed by the authors in order to assess and minimize financial risks, including quantile hedging, deficit hedging with minimal risk, and optimal quadratic hedging.