逐日AI

面试题库

共 328 题,当前筛选 1 题。

14 天用 Agent 搭一条 AI 短剧生产线

D1 一条 AI 短剧生产线长什么样:工序拆解、任务图架构与四类生成模型选型

  • 把一条多步生成流程建成任务图,比一串顺序 await 多拿到了什么?代价是什么?What does modeling a multi-step generation pipeline as a task graph buy you over a chain of sequential awaits, and what does it cost?
    国内高频海外高频进阶#task-graph#pipeline-design

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

    1. 这题的题眼在「多拿到了什么」,不在「什么是 DAG」。背出有向无环图定义的人拿不到分,答对的人会给出三样顺序版拿不到的能力,并各配一个具体场景。
    2. 怎么拆:把顺序版的三个痛点倒过来说。第一,并行的可能性被图结构直接表达——配音只依赖台词、和画面无关,顺序版里它却要排在四十次视频生成后面。第二,有断点——每个节点的产物落在磁盘固定位置,第三十七个镜头失败时前三十六个还在。第三,可观测——你能回答「现在卡在哪个节点」,顺序版只能回答「卡在某个 await」。
    3. 补一条区分度更高的:环检测。拓扑排序在发现依赖成环时抛错,这是「无环」两个字唯一的执行者;没有它,依赖写错只会表现成漏跑一步或者顺序错乱,非常难查。
    4. 结论与代价:任务图不是免费的,你必须为每个节点定义清楚输入产物与输出产物,否则它只是一张漂亮的依赖声明。这份产物契约同时也是后面做幂等与断点续跑的前提。
    5. 可预期的追问:那是不是应该直接上工作流引擎?判据是节点数与失败率——十几个节点、失败率高、需要人工介入时才值得;三五个节点的流程用一张手写的图加拓扑排序就够,引入引擎反而多一套要运维的东西。

    How to reason about it · think before answering

    1. The question is what you gain, not what a DAG is. Reciting the definition scores nothing; name three capabilities the sequential version cannot have, each with a concrete scenario.
    2. Break it down by inverting the three pains of sequential code. First, parallelism is expressed by the graph itself — voice-over depends only on the lines, yet a sequential run queues it behind forty video jobs. Second, resumability — each node writes artifacts to a fixed path, so shot 37 failing does not destroy the first 36. Third, observability — you can say which node is stuck, not merely that some await is pending.
    3. Add the higher-signal point: cycle detection. Topological sort throws when dependencies form a cycle, and that is the only thing enforcing the acyclic part. Without it, a wrong dependency silently skips a step or reorders execution, which is painful to debug.
    4. Conclusion and cost: a task graph is not free. Every node needs a declared input and output artifact set, otherwise the graph is decorative. That artifact contract is also the precondition for idempotency and resume later on.
    5. Likely follow-up: should you adopt a workflow engine instead? Judge by node count and failure rate — worth it at a dozen-plus nodes with high failure and human review; for three to five nodes a hand-written graph plus topological sort is cheaper than another system to operate.

    答题要点

    • 三样顺序版拿不到的:并行由图结构表达、失败后有断点、能说清卡在哪个节点
    • 拓扑排序顺带做环检测,这是「有向无环」里「无环」的唯一执行者
    • 代价是必须为每个节点声明输入产物与输出产物,否则图只是装饰
    • 这份产物契约同时是后续做幂等与断点续跑的前提
    • 上不上工作流引擎按节点数与失败率判断,三五个节点手写图更划算

    Key points

    • Three things sequential code cannot give: parallelism expressed by structure, resumability after failure, and knowing which node is stuck
    • Topological sort also detects cycles, the only mechanism enforcing the acyclic property
    • The cost is declaring input and output artifacts per node; without that the graph is decorative
    • That artifact contract is the precondition for idempotency and resume
    • Adopt a workflow engine based on node count and failure rate; a hand-written graph wins for three to five nodes