- Finance
NatWest Quantum Machine Learning for SME Credit Scoring
NatWest Group
NatWest Group partnered with IBM Quantum to apply quantum kernel SVMs to SME credit scoring, where limited labeled data makes classical ML unreliable. Quantum kernels can surface patterns in small datasets that classical kernels miss, offering a potential edge in the data-scarce world of small business lending.
- Key Outcome
- Quantum kernel SVM outperformed XGBoost by 3.2% AUC on small-data regime (200 samples); advantage disappeared with 2000+ samples, confirming quantum kernel edge for data-scarce lending.
The Problem
Lending to small and medium-sized enterprises (SMEs) is one of the hardest credit problems in banking. Unlike consumer loans, where millions of historical records train reliable models, SME portfolios are thin: NatWest might have only 150-300 examples of defaults for a specific business segment (e.g., hospitality startups, regional manufacturers). Classical gradient-boosted models such as XGBoost overfit badly in this regime, and logistic regression lacks the expressive power to capture nonlinear interactions between financial features.
The five core features used in NatWest’s SME scoring model are annual turnover, net cash flow, sector risk index, years since incorporation, and director personal credit score. These features interact in complex, nonlinear ways. A director with a mediocre personal credit score running a high-turnover logistics firm may be a better credit risk than a director with a pristine score running a loss-making restaurant. Classical kernels (RBF, polynomial) struggle to express this geometry cleanly at low sample counts.
Quantum kernel methods offer a route around this. The quantum kernel implicitly maps data into an exponentially large Hilbert space through angle encoding followed by a parameterized feature map. If the true decision boundary lives in a region of that Hilbert space that is hard to reach with classical kernels, a quantum kernel SVM can find it with fewer training samples.
Quantum Kernel Construction
NatWest encoded each SME record as a 5-qubit quantum state using angle encoding: each feature is normalized to [0, pi] and applied as a rotation angle. A ZZ feature map then entangles the qubits, creating cross-feature correlations in the quantum state.
import pennylane as qml
import numpy as np
from sklearn.svm import SVC
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import roc_auc_score
from sklearn.preprocessing import MinMaxScaler
# Simulated SME dataset: 200 samples, 5 features
np.random.seed(0)
n_samples = 200
n_features = 5
X = np.random.randn(n_samples, n_features)
y = (X[:, 0] * X[:, 2] + X[:, 1] ** 2 - X[:, 3] * X[:, 4] > 0.5).astype(int)
scaler = MinMaxScaler(feature_range=(0, np.pi))
X_scaled = scaler.fit_transform(X)
n_qubits = n_features
dev = qml.device("default.qubit", wires=n_qubits)
@qml.qnode(dev)
def feature_map(x):
# Angle encoding layer
for i in range(n_qubits):
qml.RY(x[i], wires=i)
# ZZ entanglement layer
for i in range(n_qubits - 1):
qml.IsingZZ(x[i] * x[i + 1], wires=[i, i + 1])
# Second angle encoding layer (depth-2 feature map)
for i in range(n_qubits):
qml.RY(x[i], wires=i)
return qml.state()
def quantum_kernel(x1, x2):
"""Fidelity-based quantum kernel: |<phi(x1)|phi(x2)>|^2"""
state1 = feature_map(x1)
state2 = feature_map(x2)
return float(np.abs(np.dot(np.conj(state1), state2)) ** 2)
def build_kernel_matrix(X_a, X_b):
n_a, n_b = len(X_a), len(X_b)
K = np.zeros((n_a, n_b))
for i in range(n_a):
for j in range(n_b):
K[i, j] = quantum_kernel(X_a[i], X_b[j])
return K
# 5-fold cross-validation on 200-sample SME dataset
cv = StratifiedKFold(n_splits=5, shuffle=True, random_state=42)
auc_scores = []
for fold, (train_idx, test_idx) in enumerate(cv.split(X_scaled, y)):
X_tr, X_te = X_scaled[train_idx], X_scaled[test_idx]
y_tr, y_te = y[train_idx], y[test_idx]
K_train = build_kernel_matrix(X_tr, X_tr)
K_test = build_kernel_matrix(X_te, X_tr)
clf = SVC(kernel="precomputed", probability=True, C=1.0)
clf.fit(K_train, y_tr)
probs = clf.predict_proba(K_test)[:, 1]
auc_scores.append(roc_auc_score(y_te, probs))
print(f"Fold {fold + 1} AUC: {auc_scores[-1]:.4f}")
print(f"\nMean AUC (quantum kernel SVM, n=200): {np.mean(auc_scores):.4f}")
Comparison to Classical Baselines
NatWest compared three approaches on the same 200-sample SME dataset using identical 5-fold stratified cross-validation:
| Model | Mean AUC (n=200) | Mean AUC (n=2000) |
|---|---|---|
| Logistic Regression | 0.713 | 0.741 |
| XGBoost | 0.748 | 0.821 |
| Quantum Kernel SVM | 0.780 | 0.819 |
At 200 samples the quantum kernel SVM led by 3.2 percentage points in AUC over XGBoost. At 2,000 samples the advantage vanished: XGBoost matched the quantum kernel, consistent with theoretical predictions that quantum kernel advantage is concentrated in low-sample regimes where the quantum feature space provides a richer inductive bias.
The feature map was run on IBM Eagle 127Q via Qiskit Runtime with shot-based kernel estimation (4,096 shots per kernel entry). The shot noise introduced a small variance in kernel matrix entries which was partially mitigated by post-processing symmetrization of the kernel matrix.
Implications for Small Business Lending
The practical upshot for NatWest is narrow but real. SME segments with fewer than 300 historical defaults (new market entrants, post-COVID sectors with limited pre-pandemic data) are exactly where quantum kernels showed the advantage. For mainstream SME segments with thousands of labeled examples, classical gradient boosting remains the optimal tool.
NatWest’s research group identified three near-term applications where the data-scarce regime is structural rather than temporary: lending to pre-revenue startups, green finance (insufficient default history for new ESG-linked products), and trade finance in frontier markets. Hardware scaling and noise reduction on future IBM devices are the prerequisites before production deployment.