Case study · HSBC · 2022–2024
Natural-language → SQL copilot for financial reporting
Putting an LLM between analysts and the warehouse — safely. Plain-English questions become validated, production-quality SQL inside a regulated banking environment, built before "AI copilot" was a product category.
01The problem
In a bank, the people with the questions — analysts, finance teams — usually aren't the people who can write the SQL to answer them. Every reporting request became a queue: analyst asks, engineer translates to SQL against a sprawling enterprise schema, iterate, repeat. The engineering team became a human query compiler, and data-driven decisions waited days.
02Approach
- NL → SQL with schema grounding: the copilot supplies GPT with curated schema context and business-term mappings, so "Q3 transaction volume by segment" resolves to the right tables and joins — not a hallucinated schema.
- Validation before execution: generated SQL passes through validation and safe-execution layers before touching data. In a regulated environment, "the model is usually right" is not a control.
- Integrated, not bolted on: output flows into the existing enterprise data pipelines used for financial reporting, so copilot-generated queries live in the same governed path as hand-written ones.
- Iterate with real users: prompt design and term mappings evolved against actual analyst phrasing — the gap between demo and production NL→SQL is closed by vocabulary, not model size.
grounding + validation on both sides of the model — the copilot pattern, shipped in a bank
03Key decisions
- Treat the LLM as a component, not the system. The model does one job — translation. Everything that makes it production-grade (grounding, validation, governance) is deliberate engineering around it.
- Meet analysts in their vocabulary. Mapping business terms to schema was worth more than any prompt trick — it's what made generated SQL correct on the first try often enough to build trust.
- Ship inside the governed path. Routing output through existing pipelines meant compliance came free, instead of being a launch blocker.
04Impact
- 80% reduction in development time for reporting queries — days of back-and-forth became minutes of self-service.
- Democratized data access for financial reporting: analysts self-serve; engineers build systems instead of translating questions.
- Alongside this: transaction APIs optimized to 5× throughput for 300K+ daily users, and a microservice redesign cutting infra cost 20% at 99.9% uptime.
Architecture shown at the pattern level; internal implementation details are generalized to respect HSBC confidentiality. Figures are from my resume.
Next case study
Agentic BigQuery Optimizer — $2.4M in projected annual savings at Ford