The Evolution of LLM Application Patterns: From Chat to Workflows

    This article examines how LLM applications are moving beyond simple question-and-answer interfaces toward orchestrated workflows. It breaks down four core capabilities—no-code visual UI generation, multi-model and multi-tool workflows, retrieval-augmented generation over private knowledge bases, and ephemeral sessions with context governance—and offers a reference architecture, common pitfalls, and a pre-launch checklist for building reliable production systems.

    1. Background: Why “Q&A Only” Wastes LLM Capabilities

    Many teams evaluate LLMs as nothing more than a chat box that takes a question and returns an answer. The problem with this approach is that the model’s output is a “fragment of text,” while the business actually needs “a deliverable result.” When a user asks something like “recommend a few books and give me purchase links,” a pure chat interface can only return descriptive text. The user still has to search, copy, organize, and format everything themselves. A large amount of value is lost at that final step.

    From an engineering perspective, LLM application patterns have gone through roughly three stages:

    1. Single-turn Q&A: prompt-centric, with text as both input and output.
    2. Retrieval augmentation: introducing external knowledge sources to mitigate hallucination and stale knowledge.
    3. Workflow orchestration: treating the model as one node in a pipeline, working alongside tools, interfaces, and other models to produce structured results.

    The phenomenon described above is essentially the third stage beginning to be productized. Below, the key capabilities of this stage are abstracted into four categories, with reusable implementation approaches.

    2. Capability One: No-Code Visual Interface Generation

    In the traditional approach, the model outputs plain text, and developers must build the pages in advance for the frontend to display. A more advanced approach is to have the model output an “interface description,” which the runtime then renders into an actual graphical interface containing interactive elements such as buttons, input fields, and cards.

    The key abstraction here is “UI as data.” Instead of producing markup directly, the model produces a structured interface description (think of it as a component tree), and the runtime handles rendering and event binding. An example:

    1. {
    2. "type": "Card",
    3. "props": { "title": "Ingredient List" },
    4. "children": [
    5. { "type": "List", "items": ["Main ingredient A", "Main ingredient B", "Seasoning C"] },
    6. { "type": "Button", "props": { "label": "Generate Steps", "action": "next_step" } }
    7. ]
    8. }

    This yields three engineering benefits. First, the interface is decoupled from the model: the model handles only semantics, while styling is uniformly constrained by the runtime, avoiding style drift. Second, the output can be validated: component types and properties can go through schema validation, and illegal structures are rejected outright. Third, it is testable: the interface description is pure data, so assertions can be made in a headless environment.

    One boundary to keep in mind: do not let the model freely generate executable scripts, or you introduce injection risk. The safe approach is to use a restricted whitelist of components and an enumeration of actions, and require explicit user confirmation for any side-effect operation (writing data, initiating a payment).

    3. Capability Two: Workflows Chaining Multiple Models and Tools

    A single model struggles to simultaneously handle text reasoning, image generation, video generation, and retrieval. A more sensible architecture treats them as orchestrable nodes, with a workflow engine controlling data flow.

    A typical “recommendation” workflow can be abstracted as:

    • Node A (text model): parse user input, extract constraints, output structured query parameters;
    • Node B (retrieval tool): retrieve a candidate set based on the parameters;
    • Node C (text model): filter, rank, and generate reasons for the candidate set;
    • Node D (rendering node): map results into a card interface.

    Pseudocode expressing the orchestration logic:

    1. def workflow(user_input):
    2. query = llm_parse(user_input) # structured extraction
    3. items = search(query) # external retrieval
    4. ranked = llm_rank(items, query) # ranking and reasoning
    5. return render_cards(ranked) # interface rendering

    Several practical lessons are worth emphasizing in orchestration design. First, passing structured data between nodes rather than natural language significantly reduces error accumulation. Second, set timeouts and retry policies for each node; in a long chain, jitter in any single node is amplified into a user-perceived failure. Third, design “failure-tolerance” into the flow—for example, degrade to pure model suggestions when retrieval returns empty, rather than throwing an error outright. Fourth, instrument the entire chain, logging each node’s input summary, latency, and status, so you can pinpoint whether a quality problem lies in extraction, retrieval, or generation.

    4. Capability Three: Combining a Private Knowledge Base with Reasoning

    An LLM’s knowledge comes from public corpora; internal enterprise documents, research reports, and project materials are not part of it. Using a private knowledge base as a context source is the mainstream approach to improving answer reliability, commonly known in the industry as retrieval-augmented generation.

    Engineering-wise, this involves several stages: document parsing and chunking, dual indexing with vectorization and keywords, recall and reranking, context assembly, and answer generation with citation annotation. “Citation annotation” is the most easily overlooked yet critically important: only when the answer cites the source document and passage can users verify it and teams locate erroneous data.

    A simplified retrieval call example:

    1. def answer(question, top_k=5):
    2. hits = hybrid_retrieve(question, top_k) # vector + keyword
    3. context = "\n".join(f"[{h.doc}] {h.text}" for h in hits)
    4. resp = llm(f"Answer based on the following material and cite sources:\n{context}\n\nQuestion: {question}")
    5. return resp, hits # return citations too

    Practical recommendations: chunk by semantics rather than fixed character count; handle tables and code blocks separately; set up isolated indexes for different knowledge domains to avoid cross-domain contamination; and filter permission-sensitive documents at the recall stage rather than trimming after generation.

    5. Capability Four: Ephemeral Sessions and Context Governance

    Long conversations bring two problems: context bloat that drives up costs, and historical information interfering with the current task. Ephemeral sessions (a session mode that is not persisted and does not enter history) are one countermeasure, suited to scenarios such as sensitive data exploration, one-off debugging, and A/B prompt comparison.

    A more systematic approach is context governance: being explicit about what information enters the context, how long it is retained, and how it is compressed. Common strategies include sliding windows, summary compression, switching sessions per task, and desensitizing sensitive fields before they enter the model. In scenarios requiring auditing, ephemeral mode should be turned off in favor of structured retention of inputs, outputs, and citation sources.

    6. Reference Architecture

    Combining the capabilities above yields a general architecture:

    • Access layer: a unified session entry point distinguishing regular sessions from ephemeral ones;
    • Orchestration layer: a workflow engine handling node scheduling, timeout retries, and degradation;
    • Capability layer: text models, multimodal generation, and retrieval tools registered through standard interfaces;
    • Knowledge layer: a document processing pipeline plus indexing service and permission filtering;
    • Runtime layer: a container platform hosting stateless services, object storage holding artifacts, a message queue for peak shaving, and logging and monitoring/alerting covering the full chain.

    On Baidu AI Cloud, the layers above can map to general-purpose capabilities in categories such as containers, object storage, message queues, logging, and monitoring, advancing an experimental prototype into a production system that can be operated and maintained sustainably.

    7. Common Pitfalls and a Checklist

    • Pitfall one: treating the model as a search engine. Without citations and recall evaluation, hallucination is hard to control.
    • Pitfall two: passing natural language between nodes. Errors amplify along the chain, making troubleshooting difficult.
    • Pitfall three: ignoring cost. Chaining multiple models and long contexts multiplies overhead, so budgets and caching are needed.
    • Pitfall four: no evaluation system. Build an offline evaluation set covering extraction accuracy, citation correctness, and task completion rate.

    Before going live, check the following: whether all side-effect operations require user confirmation; whether a failure-degradation path exists; whether the full chain is observable; whether content safety and desensitization are applied to inputs and outputs; and whether a session data retention policy is defined.