逐日AI

面试题库

共 328 题,当前筛选 1 题。

标签
还有 136 个标签
#api-design6#operations6#sse6#deployment5#message-bus5#tool-calling5#agent-loop4#behavioral4#error-handling4#evaluation4#framework-design4#mcp4#routing4#concurrency3#context-engineering3#interview-prep3#langgraph3#llm-basics3#model-routing3#orchestration3#prompt-injection3#protocol3#redis-streams3#scalability3#scheduling3#agent-design2#auth2#checkpointing2#communication2#cost-control2#database2#debugging2#interview-process2#latency2#long-term-memory2#memory2#ordering2#prompt-engineering2#rate-limiting2#react2#resume2#retrieval2#sharding2#state-machine2#state-management2#tool-design2#tool-permissions2#trade-offs2#ux2#agent-basics1#agent-quality1#async1#atomicity1#cancellation1#capacity-planning1#career1#chunking1#compression1#configuration1#consistent-hashing1#context-compression1#context-management1#correctness1#customer-support1#data-modeling1#deliberate-practice1#docker1#documentation1#engineering-tradeoffs1#escalation1#event-driven1#fallback1#fan-out1#fencing-token1#forking1#framework-selection1#frontend1#global-market1#hybrid-search1#interrupt-merge1#isolation1#json-parsing1#jwt1#knowledge-organization1#lease1#least-privilege1#llm-as-judge1#loop-guard1#mobile1#multi-tenancy1#nodejs1#performance1#persistence1#pgvector1#portfolio1#prioritization1#proactive-messaging1#product-engineering1#project-storytelling1#prompt1#provider-abstraction1#quiet-hours1#ranking1#recall1#reconnect1#redis1#reflection1#replay1#reporting1#rerank1#retrieval-quality1#retry1#retry-semantics1#rrf1#sampling1#sandboxing1#schema-design1#secrets-management1#self-assessment1#self-introduction1#self-presentation1#service-architecture1#session-management1#split-brain1#star1#stateless1#storytelling1#structured-output1#system-prompt1#testing1#timezone1#tool-execution1#tools1#tracing1#transport1#vector-database1

30 天从前端工程师到 Agent 工程师

D1 LLM API 基础:messages/roles、token、流式、temperature;Agent 到底是什么

  • 什么是 token 和上下文窗口?它们如何影响 Agent 的设计?What are tokens and the context window, and how do they shape agent design?
    国内高频海外高频基础#llm-basics#context

    分析过程 · 先想清楚再作答

    1. 先判断这题问的是「概念」还是「工程后果」。只答定义会被认为没做过工程,必须落到设计影响上。
    2. 从一条因果链推:token 是计费与长度的计量单位 → 窗口是这个单位的上限 → 模型无状态、历史每轮重发 → 成本随轮数增长 → 所以必须做上下文工程。
    3. 关键要点出在「Agent 比聊天更严重」:Agent 在循环里反复调模型,还要把工具返回结果也塞回历史,增长速度快得多。
    4. 结论给出具体手段:滑动窗口、摘要压缩、长期记忆外置到检索系统,并说明各自代价。
    5. 可以预期的追问:窗口没满为什么也要压缩?答案是长上下文会稀释注意力、抬高延迟与成本,不是塞满了才处理。

    How to reason about it · think before answering

    1. First decide whether this asks for definitions or engineering consequences; a definition-only answer reads as inexperienced.
    2. Follow the causal chain: tokens are the unit of billing and length, the window caps that unit, models are stateless so history is resent every turn, cost grows with turns, hence context engineering.
    3. The differentiator is why agents suffer more: a loop calls the model repeatedly and appends tool results back into history.
    4. Close with concrete tactics: sliding window, summarization, externalized long-term memory, and the cost of each.
    5. Expect the follow-up: why compress before the window is full? Long contexts dilute attention and raise latency and cost.

    答题要点

    • token 是模型处理文本的最小单位,大致 1 个汉字 ≈ 1–2 token,1 个英文单词 ≈ 1.3 token
    • 上下文窗口是一次请求里输入 + 输出 token 的上限;超出就要截断或压缩
    • 模型没有记忆,历史必须每轮重新塞进 messages,所以长对话的成本随轮数线性增长
    • Agent 设计因此要做上下文工程:滑动窗口、摘要压缩、把长期记忆外置到检索系统

    Key points

    • A token is the smallest unit the model processes; roughly 1.3 tokens per English word
    • The context window caps input + output tokens per request; beyond it you truncate or compress
    • Models are stateless, so the full history is re-sent every turn and cost grows with length
    • Hence context engineering: sliding windows, summarization, and external long-term memory