Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • Getting Started with AI for VLSI Engineers5
  • Just Enough AI: Models and Context15
  • Prompting13
  • Trust and Verification14
  • Using AI for Engineering Work17
  • Engineering Walkthroughs7
  • Practical Foundations for AI Workflows4
  • Engineering Data5
  • Retrieval-Augmented Generation6
  • Agents and Tool Use18
  • Agent Design8
  • MCP and Skills6
  • Multi-Agent Design6
  • Practical Capstone6
  • Tokens, Cost and Latency12
    • Cost Arithmetic
    • Latency and Throughput
      • Time to First Token and Decode Speed
      • A Simple Latency Model
      • Streaming, Batching and Interactive Use
      • Rate Limits and Retries
    • Reducing Tokens
  • Agentic Workflows for Chip Teams18
  • Interview and Judgment10
  • AI Skills: Full Course Index
  • Working with AI Glossary
  • Working with AI Cheatsheet
Loading lesson

‹Latency and Throughput
  1. Topics
  2. AI Skills for VLSI Engineers
  3. Tokens, Cost and Latency
  4. Latency and Throughput
  5. Rate Limits and Retries

Reference: Tokens, Cost and Latency · Beginner to Intermediate

Rate Limits and Retries

Request and token budgets, doubling backoff, and retries that stop in time.

On this page

    Two budgets

    A hosted service caps usage while it stays up. Two common caps are requests per minute and tokens per minute.

    Both caps are properties of the service tier, and both vary between services. Design for the lower of the two on the expected traffic.

    Budget

    Counts

    Binds when

    Requests per minute

    Calls, whatever their size

    Many small calls arrive at once.

    Tokens per minute

    Input plus output tokens

    Few large calls carry long prompts.

    Backoff spreads retries out

    A rejected request waits and tries again with a longer wait each time. Doubling the wait is a common pattern, and a small random extra spreads out retries from many clients at once.

    The pattern below uses a base wait of 1.0 s and doubles it: 1.0 s, 2.0 s, 4.0 s. These are example parameters, not figures from any real service.

    plaintext
    example parameters: base wait 1.0 s with doubling waits
    success on attempt 3: waits 1.0 + 2.0 = 3.0 s of waiting, then the reply is used
    limit of 3 attempts, all busy: waits 1.0 + 2.0 + 4.0 = 7.0 s, then the caller stops and reports

    Bound the total work

    Every retry policy needs a limit: a maximum attempt count, a maximum total wait, or both. Past the limit the caller stops and reports, instead of retrying without end.

    The program below stands in for a service with a FAKE scripted outcome list. It checks both endings: success on the third attempt, and a clean stop at the attempt limit.

    example.py
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    import sys
    
    def run(plan, limit, base_wait_s):
        waits = []
        attempts = 0
        result = "busy"
        for outcome in plan[:limit]:
            attempts += 1
            result = outcome
            if outcome == "ok":
                break
            waits.append(base_wait_s * (2.0 ** (attempts - 1)))
        return attempts, waits, result
    
    a1, w1, r1 = run(["busy", "busy", "ok"], 4, 1.0)
    a2, w2, r2 = run(["busy", "busy", "busy", "busy"], 3, 1.0)
    ok = (a1 == 3 and w1 == [1.0, 2.0] and r1 == "ok"
          and a2 == 3 and w2 == [1.0, 2.0, 4.0] and r2 == "busy"
          and a1 <= 4 and a2 <= 3)
    if not ok:
        print("FAIL: retry counts or waits differ from the worked values")
        sys.exit(1)
    print("PASS: bounded retries give 3 attempts then stop in both cases")

    Common mistakes

    Common pitfall

    Retrying without a limit, or retrying a request that fails the same way every time. Rejections caused by bad input need a fix, not another attempt; only transient rejections deserve a retry.

    Interview

    Likely probes: what is bounded and why doubling helps.

    • Bound attempts and total wait together, so neither runs without end.

    • Doubling waits give the service room to recover between attempts.

    • A small random extra keeps many clients from retrying in lockstep.

    Check yourself Base wait is 1.0 s with doubling, and the third attempt succeeds. How long is spent waiting?

    1.0 + 2.0 = 3.0 s. The third attempt succeeds, so no wait follows it.

    Check yourself The limit is 3 attempts and every attempt is busy. How many attempts run, and what happens next?

    3 attempts run with waits 1.0, 2.0 and 4.0 s. The caller stops and reports instead of trying a fourth time.

    Related topics

    • Streaming, batching and interactive use

    • Reducing tokens

    Previous

    138 / 173

    Next: Reducing Tokens

    Up next

    Up nextReducing Tokens

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Time to First Token and Decode Speed
    • A Simple Latency Model