LLM Application Workflows in Practice: Building Six Real-World Scenarios from Scratch

    This article explains why workflow orchestration has become the primary approach for putting large language models into production, then walks through six practical scenarios: self-media content production, fine-tuning dataset construction, news aggregation and summarization, text-to-image collaboration, and multimodal receipt recognition and comparison. Each scenario includes node breakdowns, design considerations, and example prompts or JSON structures. The article closes with general engineering practices for variable naming, prompt versioning, structured output, full-chain logging, cost control, and human-in-the-loop review.

    1. Why Workflow Orchestration Has Become the Main Approach for LLM Deployment

    Once generative AI moved into the engineering phase, relying on a single one-off prompt call became insufficient for real business needs. Real scenarios usually involve multiple stages: data retrieval, content cleaning, model inference, result validation, format conversion, and final delivery. Chaining these stages into a reusable, observable, and debuggable directed flow is the core value of workflow orchestration.

    A certain open-source LLM application development platform (referred to below as “the application development platform”) combines backend-as-a-service with LLM operations capabilities. It provides common features such as a visual canvas, node orchestration, variable passing, plugin extensions, and run logs. For developers, its significance lies in turning “writing code to call APIs” into “drawing a flowchart and configuring parameters,” which significantly lowers the cost of prototype validation. It is worth emphasizing that this type of platform does not replace code; instead, it standardizes high-frequency, repetitive engineering details so developers can focus on business logic and prompt design.

    From an engineering perspective, a reliable workflow typically has four characteristics: clear input/output contracts, single-responsibility nodes, fallback paths for exceptions, and traceable execution. All cases below are built around these four points.

    2. Scenario 1: A Content Production Pipeline for Self-Media

    The pain points of self-media creation are scattered assets, inconsistent style, and repetitive labor. A typical content production workflow can be broken into the following nodes:

    1. Start node: define input variables such as topic, target audience, word count range, and tone.
    2. Topic expansion node: generate several candidate angles based on the topic and output a structured list.
    3. Outline node: convert the selected angle into a hierarchical outline, constraining the number of headings and depth.
    4. Section generation node: expand each section according to the outline while maintaining logical transitions.
    5. Style unification node: unify terminology, person, and sentence patterns to eliminate model output drift.
    6. Review node: check factual statements, sensitive expressions, and formatting issues, then provide revision suggestions.
    7. End node: output the final draft and alternative titles.

    The key design point is “constraints first.” Rather than making major revisions after the draft is complete, it is better to specify word count, structure, and prohibited expressions in the start node. Prompts should use a four-part structure: role definition, task description, constraints, and output format. Example:

    1. Role: You are a senior technical editor.
    2. Task: Expand the given outline into a complete article.
    3. Constraints: Total length 1200±100 words; no exaggerated marketing language; explain terms on first use.
    4. Output: Markdown with level-2 headings and bullet lists.

    3. Scenario 2: Building Fine-Tuning Datasets from Text Models

    The effectiveness of model fine-tuning depends heavily on dataset quality. Raw material often contains noise, inconsistent formatting, and missing annotations, so an automated dataset construction pipeline is needed.

    The recommended flow is: raw text ingestion → cleaning and deduplication → quality scoring → instruction-based rewriting → structured packaging → sampled manual review → export to a common training format. The quality scoring node can use multi-dimensional scoring: information completeness, semantic coherence, professional terminology density, and presence of ambiguous expressions. Samples below the threshold enter a rewrite branch, while samples above the threshold enter a packaging branch, naturally forming a conditional branch structure.

    Instruction-based rewriting should cover multiple task types, such as summarization, extraction, classification, question-answer pair generation, and multi-turn dialogue construction, to avoid a single-task dataset that skews model capabilities. Use consistent field names when packaging, as shown below:

    1. {"instruction": "Answer the question based on the context", "input": "...", "output": "..."}

    Note that if the dataset contains personal information or commercially sensitive data, de-identification should be completed during the cleaning stage. This is a basic requirement of engineering compliance.

    4. Scenario 3: News Trend Scraping and Summary Generation

    Information aggregation workflows require external data retrieval and iterative processing capabilities. The common approach is: use an API request node or a lightweight script node to pull public ranking data → parse it into structured entries → use an iteration loop node to process each entry → generate summaries and tags with a text model → aggregate and sort → output ranking cards.

    There are three key points for using the iteration loop node. First, define the loop variable and termination condition clearly to avoid infinite loops. Second, control concurrency and timeout for each request to prevent external dependency instability from bringing down the entire flow. Third, keep failure retries and fallback output inside the loop body; for example, fall back to a truncated original text if summary generation fails.

    To scrape web page content, a two-stage “request + parse” approach can be used: the first stage only retrieves raw content, and the second stage uses parsing logic to extract the title, body, and publish time. Handling network exceptions and parsing exceptions separately can significantly reduce troubleshooting costs.

    5. Scenario 4: Collaboration Between Text and Text-to-Image Models

    Mixed text-and-image content is a common delivery format. The design focus of a collaboration workflow is “semantic alignment”: the text node first produces a scene description, the image node then generates an image based on it, and finally a text node produces the image caption.

    To avoid unstable image quality caused by overly abstract descriptions, add a “prompt structuring” node in the middle that breaks the description into six dimensions: subject, scene, lighting, composition, style, and aspect ratio. Example:

    1. Subject: An engineer debugging equipment
    2. Scene: A bright laboratory
    3. Lighting: Soft side lighting
    4. Composition: Medium shot, shallow depth of field
    5. Style: Realistic photography
    6. Aspect ratio: 16:9

    This structured breakdown is more controllable than a single long description and is easier to reuse in batches and fine-tune later.

    6. Scenarios 5 and 6: Multimodal Receipt Recognition and Comparison

    Receipt recognition is a typical multimodal task. Two types of problems are often encountered in practice: inaccurate recognition of receipt information, and misaligned fields across multiple receipts. The corresponding evolution path is: single receipt recognition → batch recognition of multiple receipts → structured field extraction → cross-receipt comparison and difference identification.

    The single-receipt workflow is: image input → multimodal model extracts fields → format validation node → output structured result. The validation node should include required-field checks, amount format checks, date validity checks, and total logic validation (such as whether the sum of line items equals the total).

    Batch recognition wraps an iteration loop around the single-receipt flow and attaches a source identifier to each result for traceability. The comparison scenario requires two additional nodes: “field mapping” and “difference calculation.” The former unifies field naming across different receipt types, and the latter compares item by item and outputs a difference list with confidence hints. For fields with low confidence, they should be marked as pending manual confirmation rather than given a direct conclusion, which aligns with the engineering convention for handling model uncertainty.

    7. General Engineering Practices and Troubleshooting Tips

    • Standardize variable naming: use lowercase with underscores for node outputs to avoid losing track of data sources as the canvas grows complex.
    • Version prompts: manage prompts like code, keep change history, and enable regression comparison.
    • Prioritize structured output: have the model return parseable formats to reduce post-processing branches.
    • Full-chain logging: record input summaries, output summaries, and elapsed time for each node, turning troubleshooting from “guessing” into “checking.”
    • Cost and rate-limit awareness: set reasonable maximum iteration counts, timeouts, and retry counts to avoid resource waste.
    • Gradual rollout and human fallback: keep a manual review entry point for high-risk stages to form a human-machine collaboration loop.

    8. Conclusion

    The value of workflow orchestration is not in making the flow complex, but in converging uncertainty into a controllable range. The six scenarios above cover common needs such as content generation, dataset engineering, data aggregation, multimodal collaboration, and structured extraction. The methodology is shared: first define input/output contracts, then split single-responsibility nodes, then add exception and fallback paths, and finally achieve continuous iteration through logging and version management. With this approach, developers can build stable, operable LLM applications on top of general capabilities from cloud platforms such as Baidu AI Cloud, combined with foundational components like object storage, message queues, container platforms, log services, and monitoring alerts.