|
|
Least-to-Most Prompting - Solving Problems Incrementally
Author: Venkata Sudhakar
Least-to-most prompting solves complex problems by first asking the LLM to identify the simplest sub-problems, then solving each in order from easiest to hardest, using each answer as input for the next. At ShopMax India, onboarding a new vendor involves understanding their product catalog structure, then validating product data quality, then generating compliant listings - each step building on the previous one in increasing complexity.
The technique mirrors how expert problem-solvers work: break the hard problem into tractable pieces, solve the easy ones first to build understanding and context, then use those solutions to tackle the harder pieces. It reduces the cognitive load on each individual LLM call and produces more accurate results on complex multi-step problems than a single all-at-once prompt would achieve.
The example below shows ShopMax India using least-to-most prompting to onboard a new vendor. The LLM first identifies the sub-problems in sequence, then solves each one, building up to a complete vendor onboarding checklist.
It gives the following output,
Sub-problems identified:
1. Validate data completeness - identify missing HSN codes (simplest check)
2. Standardize units - convert weight from lbs to KG for 5 affected SKUs
3. Generate HSN lookup suggestions for the 8 missing codes
4. Produce a corrected, ShopMax-compliant product listing for all 45 SKUs
Solution 1 (validation):
issues = []
for row in data:
if not row.get('HSN_Code'):
issues.append(f"Missing HSN: {row['SKU']}")
if row.get('Weight_Unit', 'KG') == 'lbs':
issues.append(f"Weight in lbs: {row['SKU']} = {row['Weight']} lbs")
Solution 2 (transformation):
for row in data:
if row.get('Weight_Unit') == 'lbs':
row['Weight_KG'] = round(row['Weight'] * 0.453592, 2)
if not row.get('HSN_Code'):
row['HSN_Code'] = 'NEEDS_MANUAL_ENTRY'
Least-to-most works best when sub-problems have a clear dependency order and when earlier solutions genuinely inform later ones. At ShopMax India, use this pattern for vendor onboarding, return dispute resolution (establish facts first, then policy, then communication), and catalog content generation (structure first, then populate). For fully automated pipelines, have the first call identify and number the sub-problems, then loop over them programmatically, passing each prior solution as context for the next call.
|
|