Long-Context LLMs in Practice: Are They Actually Usable, and Where Are the Pitfalls?

    Long-context windows have grown from hundreds of thousands of tokens to over a million, but a bigger window does not guarantee better real-world results. This article separates nominal window size from effective context length and long-horizon ability, then draws on hands-on coding experience to explain why context compaction is unavoidable in long-running tasks. It walks through seven recurring pitfalls—position bias, rule decay, information loss during summarization, cross-model behavior shifts, version drift, non-linear cost, and the compaction paradox—and lays out actionable engineering practices: layered context construction, externalized state files, structured compaction templates, subagent orchestration, explicit planning, built-in verification, and evaluating the post-compaction continuation rate instead of the window size.

    Introduction: First Ask Whether It Works, Then How Big the Model Is

    Long-context capability is one of the most hotly contested directions in large-model competition of late, with windows pushed from a few hundred thousand tokens all the way to the million-token range. Yet developers’ questions are becoming more pragmatic: are these models actually stable in coding and long-horizon tasks? Are there hidden traps?

    This discussion is often dominated by benchmark scores and marketing language, but engineering practice cares about two other things. First, can the model take over a task directly within a real workflow? Second, after a task has run for hours and a compaction has been triggered, does the model still remember the goal?

    This article first calibrates a few core concepts, then draws on typical experiences from real coding scenarios to analyze what actually determines success beyond the window itself, and finally offers concrete engineering solutions and a self-check list.

    1. First, Calibrate the Basics: Window Length Is Not Context Ability

    Nominal window, effective length, and output limit are three different things

    The nominal window is the maximum input length a single request can hold—it is only a capacity ceiling. What matters more is the “effective context length”: the ability to accurately retrieve and use key information when you approach that ceiling. Industry research (for example, work on “lost in the middle”) has found that as the context grows, the model’s utilization of information located in the middle section drops noticeably, showing a degree of positional bias. In practice there is also a common state of “not actively restating the earlier context, but actually remembering it”: the model does not repeatedly recite early information, yet can retrieve it when asked, without volunteering it. So when evaluating long-context ability, you should treat window size, output length limits, and effective memory depth as three independent metrics.

    “Long context” is not the same as “long-horizon”

    Long context describes the information capacity of a single request; long-horizon ability describes whether the model can maintain a consistent goal across multiple turns, multiple tool calls, and tasks spanning hours—and self-correct after mistakes. In long-horizon tasks, the context goes through a repeated cycle of “grow → compact → grow again.” What the model really needs is “consistency and recoverability before and after compaction,” and this rarely shows up in marketing specs.

    Empirical conclusions have a shelf life

    Model iteration cycles are often measured in months or even weeks. A version update can change the reasoning style, the length of the chain of thought, and how closely the model follows rules and early context. Behavior you validated today may not hold a few months later, so evaluation mechanisms must be normalized.

    2. From Real Experience: How Long Context Actually Performs in Coding

    A note: the experiences below come from everyday coding and long-horizon tasks, and the goal is to distill common patterns rather than to evaluate any specific product.

    “Seamless usability” is the best state for long context

    In tasks at the 100K–200K token level, the ideal state is that the model “does not restate the earlier context, but genuinely remembers it”: it neither repeats requirements nor drops key constraints, and only retrieves them accurately when needed. This stability does not rely on frequently “waking up the memory,” but on sensible context organization and reliable task-state management.

    Rule-following can be made explicit, but it can also be overdone

    Rule-type information (such as project convention documents) is inherently disadvantaged: it is provided early, stays static, and has low density, so it easily gets diluted in a long context. Some implementations visibly re-check and confirm the original rules within the long context, showing higher adherence—this may be the result of targeted training, and it shows that rule-following itself can be an optimizable objective. But overdoing it has a cost: some toolchains do not allow rule files to be modified during reasoning, and if the model reads them frequently, it tends to repeatedly confirm and re-output, consuming budget, and may even treat “confirming the rules” itself as task progress. Therefore, the metric for rule-following should be the “violation rate,” not the “number of mentions.”

    There is often an efficiency tradeoff between “specialized” and “general”

    Many teams have observed that within the same product family, the general version tends to be more vivid in expression and occasionally offers some humor, while the coding-specialized version behaves like a “relentless tool,” outputting only according to spec. This is not a regression but a deliberate tradeoff between style and efficiency. Coding scenarios value stability, restraint, and predictability, not expressiveness.

    Cross-model relay has become a common way of working

    Under long context, model performance converges, and differences show up mostly in details: command-generation habits, the size of edits, and the level of explanation. When you switch models, a task can often continue seamlessly—not because the model happens to “remember the previous vendor’s context,” but because the process files and task state have been well externalized. From this angle, the value of the “long-context competition” is diminishing; what really separates tools is context-engineering ability.

    Heard conclusions are not always reliable

    The industry circulates an inequality about model choice: a model with a smaller nominal window is considered more practical than a model with a much larger nominal window but a completely different internal architecture. This claim probably originated two or three years ago: back then, certain models were genuinely ahead at long-text processing for a while and were repeatedly labeled a “killer feature.” Once these articles entered the public corpus and went through several rounds of training, they became “common knowledge” in the model’s knowledge base. So when users ask, the model will earnestly recite that claim—while the real long-context landscape has long since shifted. This is a reminder that the “industry consensus” offered by an AI also needs fact-checking.

    3. Why Long-Horizon Tasks Inevitably Trigger Context Compaction

    Long context being “usable” does not mean it is “sufficient.” Consider a set of token-growth figures under typical tasks (hypothetical values set only to illustrate the magnitude):

    Task phase Main input sources Approx. context growth
    Task initialization System prompt, project rules, directory structure 10K–30K
    Code retrieval Full file contents, search results, historical summaries Thousands to tens of thousands per round
    Execution & debugging Command output, build and test logs Hundreds to tens of thousands per call
    Periodic summary Phase summaries, task state Thousands per round

    At a rough estimate of 10K effective tokens per round and about one round per minute, you would reach 500K tokens in under 10 hours and 1M tokens in under 20 hours. And read-only retrieval plus search-style tool calls can burn through hundreds of thousands of tokens in just a few minutes. This kind of consumption is something you run into every day in long tasks.

    From this we can derive an almost unavoidable conclusion:

    • Context compaction is an inevitable event in long-horizon tasks, not an anomaly;
    • What really determines whether a task completes reliably is not how big the window is, but whether the harness can resume correctly when compaction happens;
    • In other words, if a task never triggers compaction, it has probably not yet earned the name “long-horizon task.”

    The value of long context shifts accordingly: from “holding more history” to “losing as little information as possible when compaction happens.” The core metric becomes the task-resumption success rate after compaction.

    4. The Pitfalls to Watch For: Seven Recurring Problems

    Position bias and “lost in the middle”

    Information at the head and tail of the context is more likely to be used, while key constraints in the middle section are easily overlooked. A rule buried in the middle of a long document—say, “do not use a particular syntax”—can get drowned out by large blocks of code that follow.

    Rule decay and “reappearance of old information”

    The layout of “rules first, content after” means rules get diluted. Worse, a failed command output from earlier can remain in the context, and the model may later treat it as a factual basis.

    Information loss in compaction summaries

    Compaction loses three kinds of information: fine-grained process details, the reasons rejected options were eliminated, and the key clues that “even the model did not realize were important.”

    Long-context “discounting” and cross-model style differences

    A model’s behavior under long context is not necessarily consistent with its short-context behavior; different models also differ in their preferences for command style, edit size, and explanation detail. During a cross-model relay, these differences get amplified into “sudden behavior changes.”

    “Felt changes” caused by version drift

    Users often attribute post-update changes to “dumbing down.” In reality, adjustments to chain-of-thought length, specialized training, and default-parameter changes can all produce perceived differences, and these factors are hard to separate in a single test.

    Non-linear growth in cost and latency

    Most model services bill by input token volume. Long context is not only expensive per request but also lengthens time-to-first-token, and the benefits of compaction are not always positive.

    The “compaction paradox”: repeated summarization consumes budget

    Some implementations auto-summarize when nearing the window limit, but if the summary is still not concise, it repeatedly triggers a “summarize → summarize again” loop, with budget consumption outweighing the actual gains.

    5. Engineering Practices That Make Long Context Actually Work

    Build context in layers and control the “effective length”

    Layering the context by “stability × importance” helps mitigate position bias:

    1. ┌───────────────────────────────────────────────────────────┐
    2. │ L0 System layer: role, behavioral bounds, output format │ Retained throughout; never overwritten by summaries
    3. ├───────────────────────────────────────────────────────────┤
    4. │ L1 Project layer: coding conventions, directory layout, │ Structured and resident; injected on demand
    5. │ dependency contracts │
    6. ├───────────────────────────────────────────────────────────┤
    7. │ L2 Task layer: goal, plan, done, todo, decisions │ Held in a process file; re-injected periodically
    8. ├───────────────────────────────────────────────────────────┤
    9. │ L3 Evidence layer: retrieved snippets, command output, │ On-demand, traceable, disposable
    10. │ log summaries │
    11. └───────────────────────────────────────────────────────────┘

    The corresponding strategy:

    • Keep L0 and L1 complete in every request;
    • Maintain L2 as a structured file, re-injecting it once each phase is completed;
    • Retrieve L3 on demand only when needed, and attach source and timestamp to avoid stale results leaking in.

    Externalize state with “process files” instead of relying on model memory

    Process files are the cornerstone of long-horizon reliability. They should be structured and machine-parsable, containing at minimum the task goal, completed items, in-progress items, decision records, and key artifact paths:

    1. {
    2. "task": "Add idempotency control and retry logic to the order service",
    3. "done": [
    4. { "step": "Map the payment callback flow", "artifact": "docs/analysis-callback.md" },
    5. { "step": "Implement an idempotency table keyed by a business key", "artifact": "src/order/idempotent.py" }
    6. ],
    7. "in_progress": [
    8. { "step": "Add a retry backoff strategy", "blocker": "Awaiting confirmation of the max retry count" }
    9. ],
    10. "decisions": [
    11. { "choice": "Idempotency key = order ID + payment channel", "reason": "The same order may be paid across different channels" }
    12. ],
    13. "artifacts": ["docs/design.md", "src/order/idempotent.py"],
    14. "updated_at": "2026-01-01T00:00:00Z"
    15. }

    Three companion principles:

    • Have the model write after each step, not wait until the task ends to fill it in;
    • Treat this file as the first input of any new session;
    • Decision records must state “why this choice”—compaction summaries cannot retain that kind of reasoning chain.

    Define the compaction summary with a structured template

    Compaction is not “making old content shorter”; it is “turning old content into executable context.” The summary should use fixed fields and enforce output:

    1. ## Goal
    2. <One-sentence description of the final deliverable>
    3. ## Done (with artifact paths)
    4. - ...
    5. ## In progress
    6. - Current step / blocking reason
    7. ## Key decisions (with rationale)
    8. - ...
    9. ## Open issues and risks
    10. - ...
    11. ## Next steps (no more than 3)
    12. 1. ...

    Recommended compaction strategy:

    • Prefer “replacing the original dialogue with a summary” over “truncation”;
    • Keep code, commands, and other key content as original text or artifact paths, without paraphrasing them into prose;
    • Retain the original text of the most recent N rounds to preserve dialogue continuity;
    • Set an upper bound on the compaction budget to avoid the summary itself bloating and triggering compaction again;
    • Run a check after compaction: is the key information complete, and is the goal consistent with the original?
    1. def compact(messages, rules, state):
    2. """Compress message history into a structured summary while retaining recent context and system rules."""
    3. summary = build_structured_summary(messages, state) # Extract per the fixed template
    4. recent = select_recent_turns(messages, max_turns=5) # Keep the most recent turns
    5. return [system_prompt(rules)] + [summary] + recent + [state.refresh_hint()]

    Break long-horizon tasks into “subtask orchestration” instead of forcing one context to carry everything

    A reference-worthy architectural idea in the field is: rather than making one context carry the entire history, introduce subagent scheduling. The main agent handles planning, integration, and acceptance, while subagents handle a single task within isolated contexts and return only structured conclusions and artifact paths. This both controls the growth of the main context and prevents information from different phases from interfering with each other.

    1. User goal
    2. │
    3. ▼
    4. ┌─────────────────┐ task list ┌────────────────┐
    5. │ Main agent / │ ────────────▶ │ Subagent A │ Retrieval & understanding
    6. │ orchestrator │ ◀──────────── │ Subagent B │ Implementation & edits
    7. └─────────────────┘ conclusions └────────────────┘
    8. │ + artifact paths │ Subagent C Testing & verification
    9. ▼ └────────────────┘
    10. Process file (persisted task state)

    Subagents return only conclusions and artifact paths; the raw process stays in each subagent’s own context and does not enter the main context. Compared with a single context, this approach usually has three benefits: main-context growth is more controllable; compaction has less impact on task continuity; and task progress does not depend on any single model’s memory. In practice, you can also have subagents use a “write results to file, do not return the full text” tool protocol, further compressing cross-layer information volume.

    Make the model “write it out,” not just “say it”

    This is the most stable and reliable technique across different vendors. Capabilities like “plan mode,” “to-do lists,” and “task lists” in mature toolchains are essentially about externalizing the implicit thinking process into structured text:

    • A to-do list keeps the goal always visible and reduces the risk of forgetting;
    • Plan mode enforces “plan first, then execute,” reducing the ad-hoc tendency to change things as you go;
    • A task list makes “done/undone” status clear at a glance, making it easy to recover quickly after compaction.

    For tools that lack these capabilities, you can build a lightweight implementation yourself—for example, generating a Markdown to-do file during the process, which the model reads at the start of each round and updates at the end.

    Design “verification” into the task rather than patching it afterward

    In long-horizon tasks, the model’s self-correction ability is limited, and external verification cannot be skipped:

    • Executable acceptance criteria (tests pass, build succeeds, API contract validation);
    • Change-scope checks (only agreed files modified, a cap on lines changed per file);
    • Phase-artifact review (review design docs and API definitions before moving on).

    Write verification results into the process file as the input basis for the next phase.

    Evaluate the “post-compaction continuation rate,” not whether the window is big enough

    It is recommended to build a three-tier evaluation:

    Level Evaluation method Focus metrics
    Synthetic benchmark Multi-hop retrieval, long-document QA, variable tracking, position-sensitive tests Effective context length, degree of position bias
    Real tasks Coding tasks lasting hours to days, with tool calls and version iterations Post-compaction continuation rate, task completion rate
    Cost perspective Account for call count and token consumption Total cost per task, cost per unit of effective output

    The “post-compaction continuation rate” can be defined as: the proportion of cases in which, after compaction is triggered, the model can still continue the task according to the process file and pass acceptance. This metric is closest to the real experience of long-horizon tasks.

    6. Back to the Original Question: Usable or Not, and Where Are the Pitfalls?

    The conclusions can be split into three layers:

    • On “whether it can be used directly”: for tasks at the 100K-to-several-hundred-K token level, mainstream large models can already achieve “seamless usability.” They do not restate the earlier context but do remember it, and this is enough to support the vast majority of everyday development work.
    • On “long-horizon stability”: the real risk is not in the model itself but in context management. Compaction is an inevitable part of long-horizon tasks, and rather than worrying about whether the model “can’t remember,” you should ensure the task state can be resumed correctly when compaction happens.
    • On “hidden pitfalls”: position bias, reappearance of old information, summary information loss, cross-model style differences, version drift, and non-linear cost are all problems that need to be avoided through engineering means rather than model marketing.

    For enterprise developers, these ideas can be combined with model services from platforms such as Baidu AI Cloud, as well as the practices behind Baidu’s own intelligent coding tools, to build a long-horizon task workflow that is observable, evaluable, and reusable.

    In one sentence: instead of asking “how big is this model’s window,” ask “after my task has compacted ten times, does it still remember what it is doing?” Get that right, and long context stops being a “killer feature” in marketing copy and becomes genuinely usable productivity.