Long-Horizon Coding Tests for LLMs: Instruction Following and Multimodal Generation

    This hands-on report looks at how large language models handle long, multi-turn coding sessions. It covers instruction following, token cost measurement, and video input, and it walks through a front-end fluid simulation experiment. The article also provides checklists for testing, performance monitoring, and context management, and it recommends measuring results on your own tasks rather than relying on general claims.

    Bottom line first: in one front-end experiment, the model kept the existing code structure across several rounds of added requirements and produced a working demo. However, the exact context window range and the token savings need to be measured on your own tasks before you rely on them.

    1. Why the Context Window Size Alone Is Not Enough

    Some current code models support 256K tokens or longer context windows. Supported ranges vary by model, version, and deployment method, so check the official vendor documentation when choosing a model. A window length only tells you how much input the model can accept. It does not tell you whether the model can find and follow key instructions within that input. In real development, three things matter: whether key constraints get forgotten, whether changes are made incrementally on the existing code, and how response speed changes as input grows.

    2. Instruction Following: Incremental Edits or Full Rewrites

    In long coding sessions, developers keep adding requirements, fixing logic, and attaching system prompts and business context. In this experiment, each round asked for one change. We then checked whether the model kept the earlier function names, state variables, and drawing loop. Two criteria applied: whether the scope of the change matched the request, and whether existing features still worked.

    One successful run does not show stability. Run the same set of instructions three to five times at different times, and record the pass rate and failure causes for each run.

    3. Token Consumption: Measure It Instead of Trusting a Single Number

    Some models with deep reasoning capabilities think for a long time before generating code. This increases token usage and wait time. Some articles and vendors cite figures such as “about 30% lower,” but these often lack a consistent measurement basis, including model version, task type, sample size, and statistical method. This article does not cite that figure.

    To compare the token cost of two models, fix the following conditions: the same task set, the same prompt, the same number of conversation turns, and the same temperature setting. For each task, record input tokens and output tokens. If the API returns reasoning tokens as a separate field, record those too. Use the median result, not the value from a single run.

    4. Multimodal Input: What Video and Images Can Do

    The model can take images and video as input. In this experiment, we gave it a front-end fluid animation demo video. From it, the model summarized the motion trajectories, color changes, and the link between the animation and the music rhythm. It then produced a technical plan. This result applies only under these input conditions and does not generalize to all videos.

    Before using multimodal input, confirm these limits:

    • Supported formats: common image formats (png, jpeg, webp) and video formats (mp4, mov, webm).
    • Limits on video duration, resolution, and file size. If a video exceeds them, trim it to the key segments first.
    • Fine visual details may not be reproduced accurately, such as subtle changes in transparency or fast motion between frames.
    • Generated code still needs to be checked item by item against the original video. The overall look alone is not enough.

    5. Case Study: A Physics-Based Fluid Interaction Simulator

    The goal was to have the model generate a fluid and smoke effect page that changes with the music rhythm. The model first proposed a technical plan centered on physics-based simulation of fluid and smoke motion. It then generated a single-file HTML page. Rendering uses Canvas or WebGL. Audio uses the Web Audio API for spectrum analysis, so the fluid motion stays in real-time sync with the sound.

    After the first version, we added three requirements over several rounds: a custom mixing interface, local music file upload, and real-time recording from the browser microphone. After each round, we checked whether the original simulation logic still worked. We also recorded which files and functions each change touched. The model kept the earlier code structure and connected the new UI components and event listeners to the existing logic.

    Compared with the original demo, the visuals did not match exactly. In the demo scenario, however, the fluid motion and smoke trails were usable. This conclusion covers only the feature scope of this experiment.

    The following still need verification:

    • Rendering performance across different browsers and devices, especially mobile.
    • Fallback messages when microphone permission is denied or the device is unavailable.
    • Memory use during long sessions, including whether AudioContext objects or animation frames are released properly.
    • Whether the delay between audio and visuals stays within an acceptable range.

    6. Minimum Reproduction Checklist

    To reproduce pages like this, follow these steps:

    1. Test on the latest stable versions of modern browsers on both desktop and mobile.
    2. Run the page on localhost or over HTTPS, because the microphone API requires a secure context.
    3. Audio contexts usually need a user click before they can start. Call resume inside the button’s click event handler.
    4. Drive the animation with requestAnimationFrame, and pause or lower the frame rate when the page is hidden.
    5. Record average frame rate, CPU usage, and memory growth as performance metrics.
    6. Save the prompt and generated code for each round so you can compare outputs across models.

    7. Context Management: A Three-Step Process for Truncation and Summarization

    Long conversations can cause a model to ignore information in the middle of the context. This phenomenon is often called “lost in the middle.” Use these three steps:

    Step 1: Split the task into stages. List the fixed constraints, such as the tech stack, interface names, and performance requirements, separately. Put them at the top of the prompt every time.

    Step 2: When each stage is complete, ask the model to write a summary. It should cover the completed features, the key file structure, and any open issues.

    Step 3: When the context approaches its limit, delete the old conversation that the summary has replaced. Keep only the summary and the code related to the current task.

    8. Running and Monitoring

    If you connect a model to your own service, track these metrics: time to first token, output speed, total tokens per task, task pass rate, and failure causes. You can collect this data with general logging and monitoring systems, without depending on a specific cloud vendor. Do not log API keys or user private data.

    Model Selection Advice

    If your project mainly involves multi-turn revisions, test instruction-following stability first. If call volume is high, measure token cost first. If requirements come from design mockups or videos, verify the limits of multimodal input first. Run all three kinds of tests on the same task set so the results are easier to compare.

    Conclusion

    Evaluation of long-horizon coding is shifting from “Can the model generate code?” to “Can the model modify code reliably over a long conversation?” When choosing a model, test it on your own tasks. That gives more reliable results than general conclusions.