Neuro-Symbolic AI (NSAI) in Finance, Markets & Trading

Contributor Image
Written By
Contributor Image
Written By
Dan Buckley
Dan Buckley is an US-based trader, consultant, and part-time writer with a background in macroeconomics and mathematical finance. He trades and writes about a variety of asset classes, including equities, fixed income, commodities, currencies, and interest rates. As a writer, his goal is to explain trading and finance concepts in levels of detail that could appeal to a range of audiences, from novice traders to those with more experienced backgrounds.
Updated

Neuro-Symbolic AI is a field of artificial intelligence and machine learning that combines the strengths of neural networks (for pattern recognition and learning) with symbolic reasoning (for logic and knowledge representation) to create better and more explainable AI systems.

By merging the intuitive pattern recognition capabilities of neural networks with the logical reasoning of symbolic AI, NSAI can provide new ways of understanding financial data, predicting market trends, and automating trading strategies.

 


Key Takeaways – Neuro-Symbolic AI (NSAI) in Trading

  • Enhanced Decision-Making
    • NSAI combines intuitive pattern recognition (neural network part) and logical reasoning (symbolic AI).
    • Offers traders a unique hybrid approach to analyzing market data and making quality decisions.
  • Predictive Accuracy
    • Integrating neural networks with symbolic AI improves the accuracy of financial forecasts or strategic allocation decisions.
  • Risk Management
    • NSAI can help with new risk assessment models.
  • Coding Example
    • We do a coding example that provides a simple prototype for the basic structure of an NSAI model.

 

Understanding Neuro-Symbolic AI

NSAI combines two distinct approaches to artificial intelligence.

Neural networks, inspired by the human brain, excel in handling unstructured data, learning from examples, and recognizing patterns.

Symbolic AI, on the other hand, operates through defined rules and logic, excelling in tasks that require raw calculation, explicit reasoning, and decision-making.

This hybrid approach allows NSAI to leverage the strengths of both methods to provide an understanding of financial phenomena.

In finance, markets, trading, and other fields in which AI is being pushed, there’s a strong interest in combining the strong intuitive and creative abilities of humans – and how to emulate that through machine systems (e.g., neural networks) – with the raw processing and calculation skill of machines that can process data faster, more accurately, and less emotionally than a human could hope to do.

NSAI is one particular approach.

 

Example of How NSAI Might Work in Algorithmic Models

Let’s say we have a few asset classes in our portfolio and want to optimize the allocation to maximize our return relative to our risk:

Neural Network Part

The neural network part simulates the prediction of forward returns and the volatility of each asset class.

In a real-world scenario, the model would be trained on historical data and other forms of data, including various features beyond volatility, to predict returns.

Symbolic AI Part

The symbolic AI part uses these predictions as inputs to optimize the portfolio according to predefined rules (e.g., minimum and maximum allocation constraints) and objectives (maximizing the portfolio’s expected return under these constraints).

 

Hybrid Analysis Techniques in Finance

In general, more and more financial analysis is going the way of various hybrid, “mash-up” techniques.

This leverages the strengths of various approaches while also protecting them from their weaknesses.

For example, some approaches are very good at statistical understanding but don’t have a reasoning engine behind them (e.g., IBM Watson, Zillow’s iBuying program).

Conversely, LLMs like ChatGPT, Google Gemini, and others – out-of-the-box – are good at mimicking human-like intuition and theorizing about what they’re prompted about, but are a mixed bag at determining whether what they say is true. They “hallucinate” and make stuff up.

Accordingly, generative AI tools can be far more useful when combined with statistical tools that make sure whatever they’re generating is actually true and useful in the ways it’s intended – just as statistical tools can be more useful when there’s an actual reasoning engine behind them.

For example, suppose you have an AI system studying your habits in a statistical sense and it sees that you wake up every day when the sun rises and eat breakfast shortly after.

In that case, it might assume that the sun rising causes hunger because there’s no reasoning behind what it’s seeing.

If you were to provide a reasoning engine behind it, it could more carefully consider the cause-effect relationships and be more likely to realize that such statistical considerations are nonsensical/wrong.

Just as in markets, statistical engines don’t understand concepts like “greed” and “fear.”

However, a high-quality LLM, to a point, has read basically everything there is to read about greed and fear, and can understand the statistical makeup of these emotions and conditions in the human context in which they’re created.

 

Enhancing Financial Analysis

Neuro-Symbolic AI can change financial analysis by enabling the processing of vast datasets with a nuanced understanding of market dynamics.

Traditional models often struggle to capture the complexity of financial markets, due to the extreme levels of dimensionality (many input variables affecting the output).

NSAI, with its ability to learn from historical data or any form of data and apply logical rules, can identify subtle patterns and relationships that escape conventional analysis.

 

Predicting Market Movements & Making Trading Decisions

By analyzing data and incorporating rules based on economic theories, NSAI models can anticipate changes in market conditions and make trading decisions.

The general idea is to provide data-driven insights grounded in logical reasoning.

 

Automating Trading Strategies

NSAI can help develop sophisticated algorithms that can execute trades based on a combination of market data analysis and predefined rules.

These algorithms can adapt to changing markets, learn from new data, and make decisions with a level of speed and accuracy unattainable by human traders.

It’s capable of seeing patterns and opportunities imperceptible to humans, and processing and calculating in a way that we can’t.

 

Challenges

Data quality and model interpretability are current challenges.

Ensuring that NSAI models are transparent and their decisions can be explained is important for gaining trust and adhering to regulatory standards.

Like with any AI or machine learning model, it’s important to know how the system is coming up with its decisions and not just blindly following the outputs.

 

As technology evolves and more data becomes available, NSAI models will become increasingly sophisticated.

Some other promising techniques:

Natural Language Processing (NLP)

NLP can extract insights from vast amounts of unstructured text data (news, financial reports, social media).

NSAI can incorporate this extracted knowledge and sentiment into its reasoning process.

Example

Identifying emerging trends or potential risks related to a company based on news sentiment analysis.

Knowledge Graphs

Knowledge graphs provide a structured representation of financial concepts and their relationships (companies, sectors, economic events).

NSAI can leverage these graphs for explainable reasoning and to uncover complex patterns.

Example

Connecting company relationships, supply chain dependencies, and broader market trends for better risk analysis.

Alternative Data

Alternative data sources (e.g., satellite imagery, social media activity, transaction data) provide unique insights into market behavior.

NSAI can process these diverse data types for pattern recognition while incorporating established financial knowledge for robust analysis.

Example

Analyzing satellite imagery of crop yields or social media sentiment alongside traditional financial data to predict commodity prices.

Explainable AI (XAI)

XAI techniques are important for making the decision-making process of NSAI models transparent and auditable, increasing trust in the financial industry.

For decades, algorithmic trading has often been criticized as being “black box” in nature, and that even the owners of the algorithm can’t explain why it’s making the decisions it’s making.

This is one of the ways where generative AI tools can be helpful, translating algorithms and data into transparent explanations of various levels of technical detail to cater to various stakeholders.

Example

Explaining the logic behind a trading recommendation made by an NSAI system.

Allows for better understanding and regulatory compliance.

Quantum Computing

Quantum computing could change financial modeling.

NSAI may leverage its strengths to handle the complexity and computational demands of quantum financial models.

Example

Enabling hyper-realistic simulations of market scenarios and complex portfolio optimization problems that were previously impossible.

 

Coding Example – Neuro-Symbolic AI (NSAI) in Financial Optimization

Let’s do a simple example of an NSAI model in Python.

Like we’ve done in many of our articles, we’ll work on optimizing the strategic asset allocation of this simple 4-asset portfolio with these assumptions:

  • Stocks: +3-7% forward return, 15% annualized volatility using standard deviation
  • Bonds: +1-5% forward return, 10% annualized volatility using standard deviation
  • Commodities: +0-4% forward return, 15% annualized volatility using standard deviation
  • Gold: +2-6% forward return, 15% annualized volatility using standard deviation

Let’s explain how we’ll approach this.

Random Forest Regressor (Neural Network Part)

For the predictive model, we generate synthetic data to simulate a scenario where we have historical features (X) and returns (y).

This data is used to train a Random Forest regressor, a machine learning model capable of capturing patterns in the data without explicit programming.

This step simulates predicting future returns for multiple asset classes based on historical or market data features.

Monte Carlo Simulation (AI Part)

The Monte Carlo simulation step uses the predicted returns to explore various portfolio allocations through simulation – aiming to maximize the Sharpe ratio.

The process involves generating a large number of random portfolios, calculating each portfolio’s expected return and volatility, and then identifying the portfolio allocation that provides the best risk-adjusted return.

This approach provides a predictive model (neural network part) with Monte Carlo simulation (defined logic and rules part) for portfolio optimization in a Neuro-Symbolic AI context.

Explanation

  • The synthetic data generation (X and Y) mimics the process of training a predictive model, with y reflecting the specified forward return ranges for each asset class (Stocks, Bonds, Commodities, Gold).
  • The RandomForestRegressor is trained on this synthetic data. However, for the sake of demonstration, we bypass actual prediction from features (X_test) and use the mean of the generated returns as “predicted returns” for the Monte Carlo simulation. This simplification focuses the example on portfolio optimization.
  • The Monte Carlo simulation explores various portfolio allocations to identify the one with the optimal risk-return balance, quantified by the Sharpe ratio, using the specified volatilities and simulated “predicted” returns for each asset class.

 

import numpy as np
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import train_test_split

np.random.seed(57)

# Generate synthetic feature data (X) & simulate future returns (y) based on given forward return ranges
# Assume 100 samples and 10 features
X = np.random.normal(0, 1, (100, 10))
# Simulate returns for each asset class based on given ranges
y_stocks = np.random.uniform(0.03, 0.07, 100)
y_bonds = np.random.uniform(0.01, 0.05, 100)
y_commodities = np.random.uniform(0, 0.04, 100)
y_gold = np.random.uniform(0.02, 0.06, 100)
y = np.vstack((y_stocks, y_bonds, y_commodities, y_gold)).T

# Split the dataset into training & testing sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Initialize the Random Forest model for multi-output regression
rf_model = RandomForestRegressor(n_estimators=100, random_state=42)

# Train the model
rf_model.fit(X_train, y_train)

# Predict future returns using the trained model (for demonstration, using the mean of the simulated returns)
predicted_returns = np.mean(y, axis=0)

# Monte Carlo simulation for portfolio optimization
risk_free_rate = 0.01
annual_volatilities = np.array([0.15, 0.10, 0.15, 0.15]) # Given volatilities
n_portfolios = 10000

# Generate random portfolio weights
weights = np.random.dirichlet(np.ones(4), size=n_portfolios) # 4 asset classes

# Calculate expected portfolio return and volatility
portfolio_returns = np.dot(weights, predicted_returns)
portfolio_volatilities = np.sqrt(np.sum((weights ** 2) * (annual_volatilities ** 2), axis=1))

# Calculate Sharpe ratio
sharpe_ratios = (portfolio_returns - risk_free_rate) / portfolio_volatilities

# Identify the portfolio with the highest Sharpe ratio
optimal_idx = np.argmax(sharpe_ratios)
optimal_weights = weights[optimal_idx]

print("Optimal Portfolio Allocation:")
print(f"Stocks: {optimal_weights[0]:.4f}, Bonds: {optimal_weights[1]:.4f}, Commodities: {optimal_weights[2]:.4f}, Gold: {optimal_weights[3]:.4f}")

 

Results

Our results of this model:

 

Neuro-symbolic AI (NSAI) model results

 

How does this model do?

The gold allocation looks a bit high relative to what we’ve found with backtesting.

Obviously, this is just a 50-line model we whipped up quickly, so overall it’s not too bad in getting us a reasonable allocation.

 

Conclusion

Neuro-Symbolic AI is a new approach in the application of artificial intelligence and machine learning within finance.

By blending the pattern recognition ability of neural networks with the logical ability of symbolic AI, it offers a new path for understanding financial markets.

As this approach matures, it holds the promise of new potential in financial analysis, market prediction, and automated trading.

 

 

Article Sources

The writing and editorial team at DayTrading.com use credible sources to support their work. These include government agencies, white papers, research institutes, and engagement with industry professionals. Content is written free from bias and is fact-checked where appropriate. Learn more about why you can trust DayTrading.com