AI in Fintech: Complete Guide
Fintech AI Landscape
Fraud Detection Architecture
Fraud Scoring in Practice
A fraud model does not classify, it ranks a queue under a fixed review budget. With base rates near one in a thousand, accuracy is meaningless: a model predicting "legitimate" for every transaction is 99.9 percent accurate and completely useless. The operating point is set by review capacity rather than by the ROC curve, so teams choose a threshold that sends the top few percent of scores to analysts, then measure precision at that cut together with recall against fraud that later settles.
Two structural choices matter more than the algorithm choice. Labels arrive late, because a chargeback can take weeks, so training rows must be assembled as of the decision date or the future leaks into the features. And every feature must be computable in real time: a value only knowable after settlement belongs in training only, and serving it at inference creates a gap that appears as silent degradation rather than as an error.
import pandas as pd
from sklearn.metrics import precision_recall_curve, average_precision_score
def operating_point(scores, labels, review_rate=0.02):
threshold = scores.quantile(1 - review_rate)
flagged = scores >= threshold
precision = labels[flagged].mean() if flagged.any() else 0.0
recall = labels[flagged].sum() / labels.sum() if labels.sum() else 0.0
return threshold, precision, recall
precision_curve, recall_curve, thresholds = precision_recall_curve(labels, scores)
print(f"average precision {average_precision_score(labels, scores):.3f}")
thr, prec, rec = operating_point(scores, labels, review_rate=0.02)
print(f"threshold {thr:.4f} -> precision {prec:.3f} at recall {rec:.3f}")
Algorithmic Trading Strategies
Backtesting Without Fooling Yourself
A backtest is an argument that a strategy would have survived history, and most backtests fail on arithmetic rather than on theory. Three defects account for nearly all of it. Leakage happens when information that arrived after the decision point appears in the features, including adjusted prices that were revised retroactively. Selection bias happens when the strategy was chosen because it already looked good on this same sample, which silently turns in-sample fit into an expected return. And unrealised costs decide profitability: a strategy with a one basis point edge disappears once spread, slippage, borrow fees, and market impact are applied.
Walk-forward evaluation is the discipline that catches all three. Train on a window, trade on the next window, roll both forward, and concatenate only the out-of-sample segments. Report Sharpe alongside maximum drawdown and turnover, because a high Sharpe earned by trading constantly is a different product from one earned by holding, and it costs more to run.
import numpy as np
import pandas as pd
def walk_forward_returns(signal, prices, train=252, test=63):
returns = []
for start in range(train, len(signal) - test, test):
mu = signal.iloc[start - train:start].mean()
scores = (signal.iloc[start - train:start] - mu).abs()
chosen = scores.nlargest(10).index
forward = prices.pct_change().iloc[start:start + test][chosen]
weights = signal.iloc[start - train:start].reindex(chosen)
weights = weights / weights.abs().sum()
returns.append((forward * weights).sum(axis=1))
out = pd.concat(returns)
sharpe = out.mean() / out.std() * np.sqrt(252)
drawdown = (out + 1).cumprod().cummax().sub((out + 1).cumprod()).max()
return {"sharpe": sharpe, "max_drawdown": drawdown, "days": len(out)}
print(walk_forward_returns(signal, prices))
Risk Models and Their Limits
Value at Risk answers a narrow question: how bad is a bad day at a chosen confidence level, such as the fifth percentile of losses over ten trading days. It does not describe what happens beyond that percentile, which is exactly where losses become painful, so expected shortfall, the average loss in the worst cases, is reported beside it. Both inherit whatever the covariance estimate assumes, and those assumptions fail together during a liquidity crisis when every position correlates toward one.
Models also inherit the window they were fitted on. A covariance matrix estimated over a quiet decade understates the risk of the decade that follows, and volatility regimes shift faster than most risk frameworks are recalibrated. The honest use of a risk model is as a constraint input: position limits, drawdown triggers, and circuit breakers that act on the number without pretending the number is certain. Where possible, stress scenarios written as narratives â a rate shock, a funding freeze, a counterparty default â cover the tail that history has not sampled.
Explainability Requirements
Credit and insurance decisions are governed, and a model that cannot explain itself cannot be deployed regardless of its accuracy. Two levels of explanation are usually required. A reason code for the applicant, expressed in plain language and naming the dominant factors, and an internal attribution for auditors, typically computed with SHAP values on the model's own features, that shows how each variable moved the score away from the baseline.
Three constraints shape the implementation. Explanations must be computed on the same features the model actually consumed, or they describe a different model. Categorical features with many levels need grouping into meaningful buckets before attribution, otherwise the explanation fragments into noise. And the set of reason codes shown to customers must be stable enough to be actionable, because an explanation that changes wording on every request satisfies neither the applicant nor the auditor. Log the model version, the feature values, and the attributions together on every decision, so a complaint can be reconstructed years later.
Where Scoring Systems Fail in Production
Common Mistakes
Reporting accuracy on a dataset with a one in a thousand base rate
Fix: Report precision and recall at the review threshold you actually operate at
Fitting and evaluating on prices revised after the decision date
Fix: Build every feature as of the decision timestamp and walk the test window forward
Computing explanations on a different feature set than the model uses
Fix: Attribute on the consumed features, group them into stable reason codes, and log them with the model version
Interview Q&A
Q1: How do you handle class imbalance in fraud detection?
Answer: Fraud datasets are typically 99.9% legitimate. Use SMOTE for oversampling, random undersampling, or hybrid approaches. Apply class weights in model training. Use precision-recall AUC instead of ROC AUC. Focus on minimizing false negatives (missed fraud) while keeping false positives manageable. Consider anomaly detection approaches that don't require balanced labels.
Q2: What features are most predictive for credit risk scoring?
Answer: Payment history (35%), amounts owed (30%), length of credit history (15%), new credit (10%), credit mix (10%). Additional AI features: transaction velocity, income estimation, employment stability, social signals (with consent), alternative data (rent, utilities). Use SHAP values for explainability requirements.
Q3: Explain the difference between high-frequency trading and algorithmic trading.
Answer: Algorithmic trading uses computer programs to execute trades based on predefined rules. High-frequency trading (HFT) is a subset that executes thousands of trades per second with minimal latency. HFT requires co-location with exchanges, specialized hardware, and ultra-low latency networks. Most algorithmic trading is not HFT.
Q4: How do you ensure model explainability in regulated financial environments?
Answer: Use inherently interpretable models (linear, decision trees) where possible. Apply SHAP or LIME for post-hoc explanations. Maintain model documentation and audit trails. Implement challenger models for validation. Provide feature importance rankings. Generate human-readable explanations for each decision. Comply with SR 11-7 model risk management guidance.
Q5: What are the key challenges in building a robo-advisor?
Answer: Risk profiling accuracy, portfolio optimization under constraints, tax-loss harvesting, rebalancing algorithms, regulatory compliance (Investment Advisers Act), client communication during drawdowns, handling edge cases (inheritances, emergencies), and maintaining fiduciary duty while scaling.
Q6: How do you detect money laundering patterns with AI?
Answer: Use graph neural networks to identify suspicious transaction networks. Apply rule-based systems for known patterns (structuring, layering). Use clustering to detect unusual behavior. Monitor for rapid fund movements across accounts. Flag transactions with high-risk jurisdictions. Implement dynamic risk scoring that updates based on new intelligence.
Q7: What is the role of NLP in financial analysis?
Answer: Sentiment analysis of news and social media for trading signals. Earnings call transcript analysis. Regulatory filing comprehension (10-K, 10-Q). Customer complaint analysis. Contract review and extraction. Market research summarization. Risk report generation from unstructured data.
Q8: How do you handle concept drift in financial models?
Answer: Monitor model performance metrics continuously. Implement automated retraining pipelines. Use online learning for rapid adaptation. Track feature drift with statistical tests. Maintain champion-challenger model comparisons. Implement model versioning and rollback capabilities. Set performance thresholds that trigger retraining.
KnowledgeCheck
Key Takeaways
- Fraud and credit models are ranked queues under a fixed review budget, so the threshold comes from capacity rather than from the ROC curve
- Late labels and retroactively adjusted prices are the two leakage paths that make both scoring and backtests look better than they are
- Walk-forward evaluation, explicit costs, and drawdown beside Sharpe are what separate a tradeable strategy from a curve fit
- Value at risk describes one percentile, so expected shortfall and written stress scenarios have to cover everything beyond it
- Governed decisions need an applicant-facing reason code, an internal attribution, and a log tying both to the model version