Multimodal LLM Prompt Engineering: A Practical Guide to Structured Prompts and Evaluation

    This article presents a vendor-neutral engineering approach to managing prompts as first-class assets in multimodal generation pipelines. It explains how to use a language model as a prompt compiler, how to design a structured intermediate representation (IR) between business intent and model-specific syntax, and how to layer prompts across subject, scene, camera, lighting, style, and negative constraints. It also covers the four roles of language models in the pipeline, measurable evaluation signals, coordinate-descent iteration, tiered compute scheduling, and safety and compliance gates, along with common anti-patterns to avoid.

    1. Background: From “Can Generate” to “Deliverable”

    In March 2025, a short-video platform announced that its AI creation capabilities had been fully integrated with a general-purpose reasoning model. In scenarios such as video generation and image generation, users could rely on the model to help generate or refine prompts, and link it with an “inspiration word library” type of feature to enhance expressiveness. The technical core of this event is not any specific product, but an engineering paradigm that is becoming an industry consensus: treat the prompt as a first-class citizen, and let the language model act as a “prompt compiler.”

    For developers and enterprise users, the real pain point has never been “can it generate an image or a video,” but rather:

    • Generation results are not reproducible; the same prompt can produce very different outputs twice.
    • Prompts depend on individual experience and cannot be accumulated as team assets.
    • Requesters describe needs vaguely (“make it more premium,” “make it look techy”), and there is no executable translation layer.
    • There is no quantitative evaluation method, so it is impossible to tell whether optimization is actually effective.

    Setting aside product-specific attributes, this article discusses a general technical solution: how to build a closed loop of “natural-language requirements → structured prompts → multimodal generation → automatic evaluation → iterative convergence.”

    2. Technical Principle: Prompts as an Intermediate Representation (IR)

    The multimodal generation pipeline can be abstracted as a compiler model:

    1. User intent (natural language)
    2. ↓ Semantic parsing and completion (language model)
    3. Structured intermediate representation IR (JSON/YAML)
    4. ↓ Rendered into conditioning input the model can read
    5. Generation model (image/video diffusion model)
    6. ↓
    7. Artifacts + evaluation metrics → fed back to the IR layer for iteration

    The key design principle is: do not make end users face the “dialect” of the generation model directly. Generation models are sensitive to the syntax, weights, and ordering of conditioning input, while business users are good at expressing intent. The intermediate representation layer is the decoupling point between the two.

    A practical IR example:

    1. {
    2. "subject": "An engineer inspecting a server room",
    3. "scene": "Cool-toned data center corridor",
    4. "camera": {"shot": "medium", "move": "slow_push_in", "lens": "35mm"},
    5. "lighting": "Overhead cool-white light strips + blue screen reflections",
    6. "style": "Realistic photography",
    7. "palette": ["#0B1F33", "#2E6F95", "#E6F1FF"],
    8. "motion": {"fps": 24, "duration_sec": 5, "loop": false},
    9. "negative": ["Text watermarks", "Distorted hands", "Shaky frames"],
    10. "constraints": {"aspect_ratio": "16:9", "safe_area": "center"}
    11. }

    The value of the IR is that it is verifiable, diffable, and version-controllable. When fields are missing, the language model fills them in with business defaults rather than leaving them to randomness.

    3. Layered Design of Structured Prompts

    In practice, it is recommended to split the prompt into six layers and progressively reduce uncertainty:

    1. Subject layer: the core object and its count, pose, and material. Avoid conflicting subjects; generally no more than two strongly constrained subjects.
    2. Scene layer: environment, time, weather, and spatial depth. Used to constrain the composition background.
    3. Camera layer (especially critical for video): shot size, camera movement, focal length, and transitions. Most of the “cheap feel” in video generation comes from missing camera language.
    4. Lighting and color layer: light direction, color temperature, contrast, and dominant palette. This is the main source of “texture” and is far more effective than piling on adjectives.
    5. Style layer: realistic, illustration, 3D rendering, film grain, and so on. Two or three are appropriate; too many dilute each other.
    6. Negative constraint layer: explicitly list what is not wanted, such as text, watermarks, extra fingers, flicker, and frame tearing.

    An engineering lesson worth emphasizing: concrete nouns and quantifiable parameters are better than abstract adjectives. “35mm, 24fps, color temperature 5600K” reproduces results more reliably than “cinematic” or “premium.”

    4. Four Roles of the Language Model

    A general-purpose reasoning model is not “ghostwriting copy” in the pipeline; it takes on four engineering responsibilities:

    • Intent translation: convert business colloquialisms into IR. The model can be required to output JSON only, making it easy for programs to consume.
    1. System instruction: You are a prompt compiler. Output valid JSON only, no explanations.
    2. If information is missing, fill it in with the default fields; do not add undefined fields.
    3. User input: Make a short video of a server room inspection, keep it cool-toned, not too busy.
    • Constraint solving and conflict resolution: when “wide angle” conflicts with “no subject distortion,” the model provides a compromise and explains the trade-off.
    • Variant generation: derive N candidates with controlled differences from the same IR, used for A/B selection.
    • Failure attribution: combined with evaluation metrics, determine whether the problem lies in the subject, lighting, or camera, and change only the relevant fields.

    Engineering-wise, it is recommended to apply strict-mode validation to model output (JSON Schema validation + enum whitelists). If validation fails, fall back and retry to prevent dirty data from entering the generation stage.

    5. Evaluation and Iteration: Making Optimization Measurable

    Without measurement there is no optimization. Three types of signals can be combined:

    • Rule-based metrics: resolution, duration, frame rate, black-frame ratio, average frame brightness, and colorfulness, computed directly with lightweight programs.
    • Model-based metrics: image-text / video-text semantic consistency scores, aesthetic quality scores, and face and hand structure plausibility detection.
    • Human spot checks: sampled grading (usable / needs fixing / discard), forming an annotation set for regression.

    The iteration strategy follows a “coordinate descent” approach: in each round, adjust fields in only one layer, record metric changes, and keep changes with positive gains. This makes it possible to identify whether the camera or the lighting is having an effect, rather than blindly rewriting the entire prompt.

    1. def optimize(ir, evaluate, max_round=6):
    2. best, best_score = ir, evaluate(ir)
    3. for layer in ["lighting", "camera", "style", "negative"]:
    4. for candidate in propose(ir, layer): # Language model generates variants
    5. score = evaluate(candidate)
    6. if score > best_score:
    7. best, best_score = candidate, score
    8. return best, best_score

    6. Tiered Scheduling for Performance and Cost

    Multimodal generation is a compute-heavy task, and it is recommended to tier by value:

    • First use low resolution and fewer sampling steps for a “composition preview” to confirm the IR is correct;
    • After approval, move on to high-resolution refinement and video frame interpolation and super-resolution;
    • Cache IRs and artifact hashes for high-frequency repeated scenarios, and reuse them on a hit;
    • Decouple asynchronous tasks through a message queue, store artifacts in object storage, write status and metrics to a logging service, and use monitoring and alerting to track failure rates and queue latency.

    If Baidu AI Cloud capabilities are used, they are typically implemented with a general combination such as “a container platform hosting inference services + object storage for artifacts + a logging and monitoring system for observability,” rather than relying on a proprietary interface.

    7. Put Content Safety and Compliance First

    Safety cannot come after generation. Three gates are recommended:

    1. Input side: review both the requirement text and the IR, blocking descriptions that infringe rights, involve sensitive content, or contain identifiable personal information;
    2. Generation side: hard-code filtering of illegal and non-compliant content in negative constraints, and avoid pointing to real identities for person-related content;
    3. Output side: secondary review of artifacts plus generated-content labeling, retaining the IR and review records for traceability.

    All prompt templates, variants, and review conclusions should be placed under version control to form an auditable chain.

    8. Common Anti-Patterns

    • Piling on adjectives: a dozen “premium, beautiful, stunning” terms cancel each other out, and metrics actually drop.
    • One-shot rewriting: overturning the whole thing makes attribution impossible and convergence extremely slow.
    • No negative constraints: hand, text, and watermark defects keep recurring.
    • Skipping the preview: going straight to high-resolution output wastes compute and lengthens the feedback cycle.
    • Prompts scattered everywhere: not templated, not versioned, so the team cannot reuse them.

    9. Conclusion

    The competitive focus of multimodal generation capability is shifting from “can the model generate” to “can prompts be governed through engineering.” By treating the language model as a prompt compiler, using a structured intermediate representation to decouple business intent from model dialect, driving small-step iteration with measurable metrics, and combining tiered compute scheduling with upfront safety review, occasional “lucky outputs” can become stable, deliverable productivity. This methodology is independent of any specific vendor and can be applied directly on top of any image or video generation technology stack.