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
    • What a Language Model Does
    • Tokens and Tokenization
    • Context Window and Attention for Users
      • What Counts Against the Window
      • When the Window Fills
      • Attention in One Picture
      • Long Inputs and the Lost Middle
      • A Context-Budget Planner
  • 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
  • Agentic Workflows for Chip Teams18
  • Interview and Judgment10
  • AI Skills: Full Course Index
  • Working with AI Glossary
  • Working with AI Cheatsheet
Loading lesson

‹Context Window and Attention for Users
  1. Topics
  2. AI Skills for VLSI Engineers
  3. Just Enough AI: Models and Context
  4. Context Window and Attention for Users
  5. What Counts Against the Window

Just Enough AI · Beginner to Intermediate

What Counts Against the Window

Input and output share one token budget; learn what spends it and how to estimate it.

On this page

    One shared budget

    The context window holds input tokens AND output tokens together. Every token the model reads and every token it writes spends the same budget.

    A long answer leaves less room for input on the next turn. Budgeting must reserve space for the reply, not just the prompt.

    What spends the budget

    Five contributors spend the budget on a typical assisted task. All five are input except the generated reply.

    Contributor

    Example

    Counts as

    System prompt

    Role and rules set by the tool

    Input tokens.

    Conversation history

    Earlier turns kept for context

    Input tokens.

    Pasted material

    RTL, logs, specs, tool output

    Input tokens.

    Tool and retrieval results

    Files an agent reads back

    Input tokens.

    Generated reply

    The answer being written

    Output tokens.

    Estimating before pasting

    Token counts are tokenizer-dependent, so estimation uses approximate EXAMPLE rates. A common rough rule is about 3 to 4 characters per token for English prose with common tokenizers, and fewer for code, numbers, hex and non-Latin text.

    The calc block plans an EXAMPLE session with 4 chars per token for prose and 3 for code. Real counts vary by model and tokenizer: measure them on the tool in use.

    plaintext
    1
    2
    3
    4
    5
    6
    7
    EXAMPLE rates (stated parameters; real tokenizers vary):
    prose 4 chars per token, code 3 chars per token
    system prompt: 400 chars prose -> 400 / 4 = 100 tokens
    recent chat: 3000 chars prose -> 3000 / 4 = 750 tokens
    spec extract: 2400 chars code -> 2400 / 3 = 800 tokens
    answer reserve: 2000 chars prose -> 2000 / 4 = 500 tokens
    planned total = 100 + 750 + 800 + 500 = 2150 tokens

    Common mistakes

    Common pitfall

    Counting only the paste and forgetting the answer reserve is the usual overflow. The reply can need hundreds of tokens, so reserve them before judging whether the input fits.

    Interview

    Likely probes: what shares the window, and how to estimate a paste.

    • Input and output share one budget, including history and tool results.

    • Estimate with an approximate chars-per-token rate, then confirm with the tool.

    • Rates differ for prose and code and vary by tokenizer.

    Check yourself A paste holds 2400 characters of code at an EXAMPLE rate of 3 chars per token. About how many tokens is that?

    About 800 tokens. 2400 divided by 3 is 800, approximate because the rate is an EXAMPLE parameter.

    Check yourself The window budget is spent. Which two directions can the next token come from?

    From new input or from generated output. Both draw on the same remaining budget.

    Related topics

    • When the window fills

    • Tokens and tokenization

    • Cost arithmetic

    Previous

    16 / 173

    Next: When the Window Fills

    Up next

    Up nextWhen the Window Fills

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Attention in One Picture
    • Long Inputs and the Lost Middle
    • A Context-Budget Planner