Improving generated SQL when no reference queries exist
MLA-C02ML Model and Foundation Model (FM) DevelopmentHardQuestion 20 of 30
A retailer uses a foundation model on Amazon Bedrock to turn analysts' questions into SQL for its sales warehouse. The prompt already includes the full schema, but about 30% of the generated queries return wrong results. The team has 20,000 real analyst questions but no verified SQL for them, and writing reference queries by hand would take months. A validation service can run any generated query against a test copy of the warehouse and score whether its totals match the finance system.
Which model customization approach will meet these requirements?
Show answer and explanation
BReinforcement fine-tuning with an AWS Lambda reward function that calls the validator
Reinforcement fine-tuning meets the requirements. Instead of labeled input-output pairs, it learns from reward functions that grade each response, and Amazon Bedrock accepts reward functions written as Lambda functions. AWS recommends it when success can be verified programmatically and labeled examples are expensive, which describes a validator that runs each query. Supervised fine-tuning needs labeled examples, and questions without verified SQL are not labeled. Distillation teaches a student to match its teacher, and the teacher here is the model that is wrong 30% of the time. A knowledge base would retrieve table definitions that the prompt already contains, so it does not address the logic errors.