AI in Finance: Practical Implementation of ESG Scoring and Fraud Detection
This article examines how AI is implemented in financial services through two representative scenarios: ESG scoring and fraud detection. It explains why financial use cases require customized data pipelines and evaluation frameworks, then walks through data layer design, feature extraction, industry neutralization, modeling strategies under label scarcity, real-time architecture, class imbalance handling, and adversarial drift. It closes with shared engineering practices for explainability, traceability, canary rollout, privacy compliance, and observability.
1. Why Finance Needs Customized AI Solutions
Financial businesses share two defining traits: data is dense but labels are scarce, and risk is highly asymmetric relative to reward. This means general-purpose large models or generic classifiers cannot be dropped in as-is. The data pipeline and evaluation system have to be rebuilt around a specific business objective. ESG scoring and fraud detection illustrate this well: the first is a quantification problem under the absence of a unified standard, the second is a real-time decision problem in a strongly adversarial environment. Together they cover the two most typical engineering challenges in AI deployment: extracting information from unstructured text and running inference at extremely low latency.
From an infrastructure standpoint, these systems usually combine a few general capabilities: a data lake or object storage to hold raw data from multiple sources, a message queue to buffer real-time event streams, a container platform to host model services, and logging plus monitoring and alerting for observability. The general-purpose capabilities offered by Baidu AI Cloud can serve as a reference model when making architecture choices.
2. ESG Scoring: Turning Unstructured Information into Comparable Numbers
2.1 The Core Problem
The goal of ESG scoring is to compress environmental, social, and governance performance into a single comparable number. The difficulty is not the algorithm but three other things: inconsistent definitions, incomplete disclosure, and highly subjective wording in text.
2.2 Data Layer Design
- Structured data: emission intensity, energy consumption, water usage, workforce composition, board independence, litigation and penalty records.
- Semi-structured data: sectioned disclosures in annual reports, sustainability reports, and prospectuses.
- Unstructured data: news, announcements, public sentiment, and policy text.
The recommended engineering approach is a layered model of raw, cleaned, and feature layers. The raw layer stays immutable so decisions can be traced back, and the feature layer records a version number and a definition note at write time.
2.3 Feature Extraction and Alignment
Unstructured text typically goes through three steps: entity recognition, relation extraction, and sentiment polarity classification. To make companies across industries comparable, industry neutralization is required: replace absolute values with industry percentiles.
import numpy as npdef industry_neutralize(score, industry_scores):"""Convert an absolute score into an industry percentile to remove systematic industry differences"""arr = np.array(industry_scores, dtype=float)pct = (arr < score).mean()return float(pct)
2.4 Modeling Strategy
When labels are scarce, a combination of weak supervision and learning-to-rank works well: use rules to generate weak labels for a first model version, then calibrate with a small amount of human annotation. Optimize relative ordering with a pairwise ranking loss rather than forcing the model to fit absolute values.
2.5 Evaluation and Governance
Beyond standard AUC and NDCG, add stability metrics (consistency across periods) and explainability output (the contribution of each dimension to the final score) to meet the traceability requirements of investment research and compliance review.
3. Fraud Detection: Real-Time Decisions in an Adversarial Environment
3.1 Scenario Differences Drive the Architecture
Transaction fraud prevention demands millisecond-level responses, while account takeover and organized fraud can tolerate near real time. A dual-channel design is therefore common: a streaming channel for real-time interception and an offline channel for graph relationship mining and feeding results back into watchlists.
3.2 Key Feature Engineering
- Frequency and velocity: transaction count per unit time, sudden changes in amount.
- Device and network: device fingerprint stability, deviation of IP from usual locations.
- Relationship: connectivity of groups formed by shared receiving accounts or shared devices.
def velocity_risk(events, window_sec=60, threshold=5):"""Score rate risk based on a sliding window"""recent = [e for e in events if e.ts >= window_sec]return min(1.0, len(recent) / threshold)
3.3 Handling Class Imbalance
Fraud samples are often below one in a thousand. Cost-sensitive learning is preferable to simple oversampling: set the cost of a miss to several times the cost of a false positive, and choose the threshold to minimize expected business loss rather than defaulting to 0.5.
3.4 Adversarial Drift and the Feedback Loop
Fraud patterns migrate quickly as rules change. This requires feature drift monitoring, shadow models running in parallel, and a mechanism to feed human review conclusions back, forming a detect-review-retrain loop.
4. Shared Engineering Practices
- Explainability first: financial decisions must be justifiable to regulators and customers, so model output should include the key factors behind it.
- End-to-end traceability: data version, feature version, and model version are bound together so any historical decision can be reproduced.
- Canary release and rollback: a new model first runs on shadow traffic, then ramps up to a small percentage once metrics meet targets.
- Privacy and compliance: mask sensitive fields, collect only the minimum necessary data, and make access auditing routine.
- Observability: set alert thresholds for inference latency, feature missing rate, and score distribution drift.
5. Conclusion
ESG scoring and fraud detection represent two problem classes: low labels with strong explainability, and strong adversarial pressure with low latency. What successful deployments have in common is that data and definitions are governed first, and model complexity comes second; an evaluation and monitoring loop is established before pursuing higher accuracy. With this methodology in hand, teams can extend it to more financial AI scenarios such as credit assessment, anti-money laundering, and automated advisory services.
