Learn / Using AI
AI prompts for credit risk analysts: what works and what to check
An AI assistant can write a first draft of credit risk SQL in a minute. It cannot tell whether the draft matches your policy. These prompts give it your table names and your definitions, never your data, and each comes with the check you should run on the answer.
What rules should you follow before pasting anything?
- Give the assistant table names, column names and definitions. Never paste customer rows, names, phone numbers or account numbers.
- Use only an AI tool that your institution has approved.
- State your definitions in the prompt: what counts as an NPA, where a bucket starts, what pos_amt means. The assistant will otherwise guess.
- Ask it to list its assumptions before the code. Read them before you read the code.
The guide on using AI for credit risk without sharing data explains the approach in more detail.
Prompt 1: write a query from definitions
I work in credit risk at an NBFC. I will not give you any customer data.
My tables:
loan_month(loan_id, month_end, mob, dpd, bucket, overdue_amt, pos_amt)
Task: write a PostgreSQL query for the gross NPA ratio by month,
based on principal (pos_amt). An NPA is a loan with dpd greater than 90.
Before the code, list your assumptions in plain words.
After the code, give three validation queries.
Ask at most two questions, and only if you cannot proceed without the answer.Check: run it on a month you can compute by hand, then compare the total with finance. The three validation queries it gives you test its own logic, not yours.
Prompt 2: review a query you already have
Here is a SQL query I use for a roll rate matrix. I will not paste any data.
[paste your query]
Review it for: wrong join keys, double counting, loans missing in one of the
two months, boundary errors on the 90 day cut-off, and anything that depends
on the database. List each problem, say why it matters, and show the fix.Check: confirm each problem it lists on a small table before you change the query. Assistants sometimes report a bug that is not there.
Prompt 3: read a regulatory paragraph
Here is the text of a paragraph from a public RBI direction:
[paste the paragraph]
Explain it in plain English for a credit risk analyst. Then list the
three things in it that I must apply in a query, as short rules.
Do not add rates or thresholds that are not in the text I pasted.Check: read the paragraph yourself. The assistant should use only what you pasted. If it adds a rate or a threshold, the number came from its memory and not from the text.
Prompt 4: build a test table of awkward cases
Create a small test table for this query: [paste your query].
I need 20 rows that contain the awkward cases: a loan with DPD exactly 90,
a loan with DPD 91, a loan that appears in one month only, a duplicate row,
and a loan with zero principal. Show the expected output for each row
so I can compare it with what my query returns. All values must be invented.Check: invented data only. Run your query on the table and compare each row with the expected output. This is the fastest way to find a boundary error.
Prompt 5: list reasons a ratio moved
My query returns gross NPA of 6.6% for September and 4.4% for August.
The portfolio has three products. I will give you the product-level
percentages only, no loan data: Personal 6.8%, Business 6.3%, Two-wheeler 6.8%.
List five reasons the ratio could rise that month, in the order I should check them,
and the query I would run for each check.Check: use the output as a checklist of what to look at. Verify each reason with your own query, because the assistant is guessing from three numbers. Share aggregates only if your policy allows it.
What checks apply to every AI answer?
- Does it use more than 90 for the NPA test, not 90 and above?
- Does every join key match the data type and grain of both tables?
- Does the row count match the number of loans you expect?
- Do the totals tie to a figure from finance or MIS?
- Is any rate, date or threshold in the answer something you have not seen in the source text?
When should you not use an AI assistant?
- When the question needs data you cannot describe without sharing it.
- When the answer will go to a regulator or an auditor without a second person checking the logic.
- When you cannot say how you would check it.
Try it on your own tables
The free tools give you the prompt, the checks and how to present the result. You enter table names only.
See the free toolsFrequently asked questions
Can I use ChatGPT for credit risk analysis?
You can use an AI assistant to draft SQL and explain concepts if your institution approves the tool. Give it table names and definitions, never customer data, and check every answer.
What should I never paste into an AI prompt?
Customer rows, names, phone numbers, account numbers, and anything your policy treats as confidential. Describe the schema instead.
How do I check SQL that an AI wrote?
Run it on a month you can compute by hand, tie the totals to finance, test it on a small table with edge cases, and trace ten loans through it.
Why does the assistant need my definitions?
Because it does not know whether your NPA test is more than 90 days or 90 and above, or how you allocate payments. It will pick one without telling you.
Keep reading
How to check AI-written credit-risk SQL before you trust it
AI tools write SQL that runs but may be wrong. Ten checks to run on any credit-risk query: row counts, duplicates, DPD edges, bucket totals and a hand trace.
Using AIUsing AI for credit-risk work without sharing customer data
You can get useful credit-risk SQL and analysis from an AI tool by sharing only table and column names. How the method works and what to keep out of the chat.
Data guideSQL for credit risk: 10 queries every analyst should know
Ten tested SQL queries for credit risk analysts: bucket distribution, gross NPA, roll rates, vintages, cure rate, concentration, collection efficiency and data checks.