Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Put AI on a Token Diet

Put AI on a Token Diet

Speakers: Shubham Kabra & Divyanshu Jain - Software Engineers, Entain India

Session Overview

Every AI interaction comes with a cost. As organizations increasingly adopt AI assistants, coding copilots, and agentic workflows, uncontrolled token consumption can impact both performance and spend. This session explores practical techniques to reduce token waste while improving response quality and system efficiency.

Avatar for Richa Sharma

Richa Sharma

August 28, 2026

More Decks by Richa Sharma

Other Decks in Technology

Transcript

  1. TECHBREW PUT AI ON A TOKEN DIET 01 AI Same

    result, fewer wasted tokens, every single call {} DIVANSHU JAIN × SHUBHAM KABRA Software developers • Daily Kiro users Full thaali for dal-rice? That's token overkill. THE GOAL: FEWER WASTED TOKENS PER CORRECT CHANGE TOK
  2. TOKEN 101 Tokens, context and credits Related — but paid

    for very differently T IN TOKEN INPUT OUTPUT CONTEXT Small unit of text What AI reads What AI writes The working window words • code • JSON history • files • tools answers • code • plans maximum active information THE EASY ANALOGY OUT CX Files + prompts are dishes • Tokens are bites • Context is the plate • Credits are the bill Serve only the dishes and bites this task actually needs. TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA SPEAKER • Divanshu
  3. THE PROBLEM How AI overeats Six patterns. Six scenes. Same

    hidden cost. ONE ENDLESS CHAT VAGUE REQUESTS Unrelated tasks share the same history Guess → generate → correct → regenerate WHOLE REPOSITORY AI Files load before relevance is known POLITE PROMPTING Specific is better. TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA ALWAYS-ON CONTEXT Large rules and docs loaded every turn CONTEXT PLATE OPUS FOR EVERYTHING Maximum reasoning for mechanical work SPEAKER • Shubham
  4. WASTE PATTERN One endless chat A new task arrives. The

    old conversation comes with it. 09:10 LOGIN BUG Login redirect keeps looping. 09:24 DEBUGGING CONTEXT BAGGAGE 42 msgs 17 files old logs Check cookies, routes, and auth state. 09:52 DONE Fixed. Tests are green. NEW TASK + every old decision 09:53 NEW TASK Quick question: add a DB index? Every “quick question” brings the full family WhatsApp history. NEW GOAL → NEW SESSION TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA SPEAKER • Shubham 03A
  5. WASTE PATTERN The whole repository You needed one function. The

    model received the whole city. 12,842 FILES SEARCH EVERYTHING WHAT YOU ACTUALLY NEEDED src/ tests/ PaymentService.retry() docs/ node_modules/ 80,000 in 50 out package-lock.json The model found the needle. You paid for the haystack. TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA SPEAKER • Shubham 03B
  6. WASTE PATTERN Polite prompting Respectful is good. Respectful and specific

    is better. POLITE, BUT VAGUE POLITE + PRECISE Could you please help me improve this when you have a moment? Thanks! ? AI still asks: What should change? Please update retry() to use exponential backoff after 3 failures. Keep the API unchanged. Add tests. 3 FAILURES MORE BACK-AND-FORTH API UNCHANGED ADD TESTS ONE CLEAR PASS “Please” is cheap. Another full retry is not. TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA SPEAKER • Shubham 03C
  7. WASTE PATTERN The vague request room Everybody agrees. Nobody defined

    what “done” means. BUSINESS PRODUCT SDET AI Payments should work. Make it seamless. It should work as expected Expected matlab kya? A I WHAT MUST BE TRUE? TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA No duplicate charge Timeout is safe Retry is idempotent Proof in tests SPEAKER • Shubham 03D
  8. WASTE PATTERN Always-on context The same instructions ride along on

    every single request. SYSTEM PROMPT 2,000 tokens PROJECT RULES CACHE REPEATED CONTEXT loaded again EVERY CALL TOOL DEFINITIONS FRAMEWORK DOCS loaded again loaded again 2,000 × 1,000 users = 2M/day Same intro, every meeting: “Hi, I'm Shubham…” Bhai, we know. TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA SPEAKER • Shubham 03E
  9. WASTE PATTERN Opus for everything The strongest model is not

    the default model. RIGHT MODEL. RIGHT JOB. TINY TASK OPUS rename getUser() → fetchUser() MECHANICAL HAIKU lookup • rename SONNET features • tests OPUS architecture • hard debug Ferrari. Grocery run. Same problem. MAXIMUM REASONING PLAN STRONG → EXECUTE LEAN TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA SPEAKER • Shubham 03F
  10. CONTEXT DIET Give AI a map, not the whole city

    The model finds the needle. You still paid for the haystack. VAGUE SCOPED “Read the complete repository and find why payments are failing.” → “Investigate duplicate charges during retries. Start with PaymentService and the failing retry test. Give a plan before editing.” Likely result • Broad search Exact goal Exact files Plan first No frontend • More files • More corrections POINT TO file • class • test | TRIM logs + generated data | CONVERT text -heavy PDF → clean .md TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA SPEAKER • Divanshu 04
  11. SPEC-DRIVEN Big feature? Build the map first Kiro Specs turn

    an idea into an executable plan requirements.md 01 → What should be built? ? Complex idea O Tiny rename? No wedding planner needed for chai with two friends. 02 design.md How should it work? ✓ Opus plans Human reviews → tasks.md 03 What do we execute? S Sonnet builds ✓ Tests pass Spend a little on the plan → avoid spending a lot on the wrong diff TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA SPEAKER • Divanshu 05
  12. MODEL CHOICE Route the task not every job needs Opus

    You don't hire a wedding photographer for an Aadhaar photo QUICK + MECHANICAL Rename • boilerplate • simple lookup NORMAL DEVELOPMENT Features • tests • known bugs • refactors SONNET HARD DECISIONS Architecture • cross-system plan • hard debugging OPUS NOT SURE Let the platform choose for the task HAIKU / LOW-COST KIRO AUTO Current multipliers: Sonnet ~1.3× • Opus 5 ~2.2×* PLAN with Opus → EXECUTE with Sonnet → VERIFY with tests TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA SPEAKER • Shubham 06
  13. STEERING • SKILLS • AGENTS Stop reteaching the same workflow

    “Hi, I'm Shubham...” — bhai, we know. Cache it. REPEAT + REDO 1 STEERING Stable project-wide rules Architecture • naming • testing Explain task 2 First run miss steps 3 Add corrections 4 S K A Agent redoes work SKILL Reusable task instructions Checklist loads when needed AGENT Specialized role + tools A repeatable end-to-end workflow More turns • repeated reads • wasted credits RELEASE SKILL inspect → update → test → build → verify → report When the same correction appears twice, capture it once — but keep reusable instructions focused. TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA SPEAKER • Shubham 07
  14. SESSION HYGIENE Control the life of the session Kiro CLI

    Keep the decisions. Compress the journey. /COMPACT 1 2 3 4 5 ONE GOAL NEW TASK? LONG TASK? HANDOFF VERIFY Keep related work together Start a fresh session Compact and continue Save a short summary Run focused tests HANDOFF TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA Goal • Decisions • Files changed • Tests • Next step • Constraints SPEAKER • Divanshu 08
  15. PROMPT PATTERN The five-line prompt A little structure prevents a

    lot of wandering 1 2 GOAL What result do we need? SCOPE Where should AI look? 3 CONSTRAINTS What must not change? GOAL: Prevent duplicate charges when a payment request is retried. SCOPE: Inspect PaymentService and payment retry tests first. CONSTRAINTS: Keep the public API and database schema unchanged. OUTPUT: Return a plan of no more than six bullets. Do not edit yet. VERIFY: After approval, run the targeted payment tests. TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA 4 OUTPUT What should it return? 5 VERIFY How do we prove it works? SPEAKER • Shubham 09
  16. REAL EXAMPLES What the numbers look like Three different ways

    to save — and one real monthly number CONTEXT CREDITS A tiny question can still be a large request 30,000 + 100 ────── 30,100 input tokens History + new question API COST Model routing changes the bill Warm cache: same context, lower price 100,000 cached + 50 new OPUS 5 2.2× $0.2001 uncached SONNET ↓ 1.3× ≈ 41% lower multiplier* $0.0201 warm-cache input cost *Figures checked 21 Aug 2026. Cache example excludes first write and output. Pricing changes — refresh before presenting. TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA SPEAKER • Divanshu 10
  17. WRAP UP Things to do on Monday, and the takeaway

    Zero of this requires you to change your tools The Monday Checklist 10 things you can do right now (each < 5 minutes) 1. Start a new session for your next task 2. Point to specific files instead of “look at my project” 3. Use the five-line prompt for non-trivial tasks 4. Specify output format — “respond as JSON” or “code only” The Takeaway The craft shifted. From “can I make it work?” to “can I make it work in one pass?” Old: “How do I get AI to generate this?” New: “How do I get AI to generate this correctly on the first try?” 5. Pick the right model — Haiku/Sonnet/Opus by complexity 6. Trim pasted context — just the error, just the function • Less noise in → better signal out 7. Write ONE steering file for your most common correction • Structured prompts → fewer retries 8. Use /COMPACT when your session gets long • Right model → more done per credit 9. Ask for a plan first on anything bigger than a one-liner • Fresh context → better reasoning 10. Check token count on your next big prompt Works with ChatGPT, Claude, Kiro, Copilot — any AI tool TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA Tokens made AI accessible. Efficient prompting makes AI actually useful. SPEAKER • Shubham
  18. TAKEAWAY Remember the DIET rule Four habits to use tomorrow

    morning Questions now. Chai's on us later. D I E T DEFINE THE OUTCOME INCLUDE ONLY WHAT HELPS EXECUTE IN VERIFIED STEPS TRIM + ROUTE Say what done looks like. Files, symbols, tests, errors. Plan → task → test → continue. Fresh session, compact, right model. Not fewer tokens at any cost — fewer wasted tokens per correct change. TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA SPEAKER • Both 12
  19. REFERENCES Sources and refresh checklist Official documentation checked 21 August

    2026 Kiro Specs Kiro Available Models https://kiro.dev/docs/sp ecs/ https://kiro.dev/docs/models/av ailable-models/ Kiro Steering Claude Code: Models, usage, and limits https://kiro.dev/docs/steer ing/ https://su pport.claud e.com/en /articles/14552983-models-usage-and-limits-in-clau de-code Kiro Skills Anthropic Prompt Caching https://kiro.dev/docs/skills/ https://platfo rm.claude.com/docs/en/build-with-clau de/promp t-caching Kiro Custom Agents Anthropic Token Counting https://kiro.dev/docs/custo m-agents/ https://platfo rm.claude.com/docs/en/build-with-clau de/token-counting Kiro Compaction Anthropic API Pricing https://kiro.dev/docs/compaction/ https://www.anthropic.com/pr icing#ap i Before presenting: refresh model names • credit multipliers • pricing • screenshots TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA 13
  20. LET'S CONNECT Connect with us on LinkedIn Scan a QR

    code, say hello, and keep the conversation going. in ADD LINKEDIN QR HERE in LINKEDIN DIVANSHU JAIN ADD LINKEDIN QR HERE SCAN TO CONNECT Scan with your phone camera LINKEDIN SHUBHAM KABRA SCAN TO CONNECT Scan with your phone camera No tokens required. Just one scan. TECHBREW • DIVANSHU JAIN + SHUBHAM KABRA LINKEDIN • SCAN TO CONNECT 20