Building a Security Architecture for LLM Assistant Personal Finance Query Features
As large language model assistants move from general Q&A into vertical scenarios, personal finance queries have emerged as a high-risk, high-value application. This article outlines a security-first architecture for read-only finance features, covering capability boundaries, a five-layer reference architecture, least-privilege account connection, privacy isolation, explainable natural language analysis, and a practical checklist of security risks and mitigations. It is aimed at developers and product teams building finance query capabilities into AI assistants.
As large language model (LLM) assistants move beyond general-purpose Q&A into vertical domains, personal finance queries have become a high-risk, high-value use case. These features let users ask about account balances, transactions, and spending patterns in natural language, with the assistant aggregating, categorizing, and explaining data across accounts. Unlike payments, transfers, or investment advice, the core positioning is “understanding the numbers, not moving the money.” The engineering focus, therefore, is not on making the model better at spending, but on turning authorization, data minimization, privacy isolation, explainable output, and audit monitoring into a reusable security architecture.
1. Capability Boundaries: Read-Only Queries, Not Fund Operations
The first step is to define the capability boundary clearly. A typical design uses read-only permissions: the assistant can read account names, account types, balances, credit limits, and transaction records, but cannot initiate transfers, modify account settings, manage assets, or execute investment actions. The product should be positioned strictly as a financial information query and analysis tool, not a transaction gateway or investment advisor.
At the output layer, the assistant can perform tasks such as: summarizing spending over a time range, breaking down expenses by category, calculating available balance before payday, identifying recurring charges and unexpected fees, generating weekly spending charts, bill calendars, or custom dashboards, and explaining financial terms like APR before doing any calculation. At the same time, the system must tell users that model answers may contain errors and that key figures should be confirmed with the bank or card issuer. This “queryable, explainable, non-operational” boundary is the first line of defense against financial and compliance risk.
2. Reference Architecture: Five Layers with Policy Front-Loading
A robust implementation typically consists of five layers: an access and authorization layer, a data aggregation and normalization layer, a query orchestration and policy engine, a model inference and output layer, and an audit and observability layer. The authorization layer handles user identity verification and read-only token management; the aggregation layer pulls data from authorized accounts and unifies field schemas; the orchestration layer parses natural language intent and determines time ranges and account scopes; the model layer generates summaries and explanations within a controlled context; and the audit layer records accesses, queries, and outputs to support traceability and revocation.
An illustrative flow:
FINANCE_SCOPES = {"accounts:read", "balances:read", "transactions:read"}def handle_finance_query(user, question):assert user.consent_grantedassert user.token.scope <= FINANCE_SCOPESassert not user.token.allow_transferintent = parse_intent(question) # time range, account scope, query typeaccounts = list_linked_accounts(user, only_authorized=True)data = fetch_readonly_data(accounts, fields=minimal_fields(intent))normalized = normalize_and_mask(data) # masking, categorization, aggregationcontext = build_limited_context(normalized, intent)answer = llm_generate(question=question,context=context,policy="no_advice_no_transaction",require_disclaimer=True)audit_log(user, intent, accounts, answer)return answer
The flow emphasizes policy front-loading: authorization scopes are checked before data is fetched, context is constrained before model generation, and audits are recorded after output. Any request involving transfers, payments, or investments should be rejected by the policy engine, with the user directed to their bank’s official channels instead.
3. Account Connection and Least-Privilege Design
Account linking should go through a neutral financial data aggregation service or a bank’s open authorization mechanism. Users log in to their bank accounts themselves and grant read-only access on the authorization page; the AI platform never obtains bank credentials. Tokens should be short-lived, refreshable, and revocable, stored encrypted. Access scope should be limited along two dimensions—fields and accounts—for example, providing only the bank name, account name and type, last four digits of the account number, balance and credit limit, and transaction records within a bounded lookback window.
Engineering teams should adhere to least-privilege and minimum-field principles: do not fetch fields unrelated to the query intent by default; mask sensitive information such as account numbers and merchant names; and let users unlink at any time, immediately invalidating tokens and stopping access. The permission model should also support dynamically trimming capabilities by subscription tier, region, and user consent state, avoiding “authorize once, full access forever.”
4. Privacy Isolation and Model Training Boundaries
Financial data is highly sensitive, so privacy design must span the full lifecycle: collection, transmission, storage, inference, and deletion. A common approach is that conversations within the dedicated personal finance feature are not used for model training, while interactions outside it follow the user’s regular privacy settings. The finance zone should have independent data partitioning, session isolation, and access controls. Raw transaction data should not be persisted where avoidable, caches should have short TTLs, and logs should be stored in masked form.
The model context should contain only the aggregated results needed for the current query, not full transaction details; free-text fields like merchant names and memos should be masked and truncated; and outputs should never echo complete account numbers. On compliance, the design should follow general principles: informed consent, purpose limitation, data minimization, revocability, and auditability. For infrastructure, developers can build isolated runtime environments on general-purpose cloud services (such as the compute, object storage, logging, and monitoring capabilities of Baidu AI Cloud), but the core remains permission and data governance design, not reliance on any particular infrastructure.
5. Natural Language Financial Analysis and Explainable Output
The key to natural language querying is converting vague questions into executable analysis plans. The system must identify query type (balance, spending summary, category breakdown, anomaly detection, chart generation), time range, account scope, and output format. For a question like “Where did my money go this month?”, the assistant should aggregate across accounts and break spending down by category. For “How much will I have left before payday?”, it should compute available balance after planned expenses. For annual percentage rate questions, it should explain the term first, then calculate the actual interest cost.
Explainability requires that outputs include methodology notes: the statistical period, accounts included, categorization rules, exclusions, and data cutoff time. Anomaly detection can combine rules with statistical baselines—for example, flagging duplicate charges, unexpected fees, or steadily rising recurring bills—and present evidence and confidence levels rather than definitive conclusions. All charts and dashboards should support parameter adjustments and clearly state that they are “for informational reference only.”
6. Security Risks and Mitigation Checklist
The main risks for this type of feature include unauthorized access, token leakage, prompt injection, model hallucination, sensitive data echo, and log leakage. Mitigations should cover: read-only tokens and field-level permissions; a policy engine that rejects fund operations; context minimization and output filtering; masking of account numbers, merchant names, and similar fields; access rate limiting and anomaly behavior detection; end-to-end auditing with user-revocable authorization; and error disclaimers on key figures advising users to defer to bank records.
7. Monetization Boundaries and Engineering Trade-Offs
Monetization should remain transparent: the query and analysis phase should not embed ads or paid recommendations, and should not sell financial products such as credit cards, loans, or savings accounts to users. Any future expansion into payments, investment advisory, or partnerships with financial institutions would require additional licenses, risk controls, and user authorization mechanisms. For developers, the priority is to build auditable, revocable, explainable read-only query capability first, then gradually deepen the analytics. Only by making permissions, privacy, and error disclaimers product defaults can LLM assistants achieve a safe, trustworthy, and sustainable rollout in personal finance scenarios.
