Trillion-Parameter Models and Million-Token Contexts: The Engineering Behind Long-Horizon Agents

    Recent large-model competition has centered on two dimensions: parameter scale and context window. Both are quickly becoming standard on flagship models, with parameters reaching the trillion scale and contexts expanding into the millions of tokens. But "more parameters, a longer window" is not the same as "gets the job done." What truly separates models is whether they can work continuously for tens of minutes or even hours with minimal human intervention: completing a cross-file refactor, running an end-to-end industry research workflow, or iterating a parameterized model to a renderable, deliverable state. This article draws on a recent flagship release to distill three engineering pillars for long-horizon agents: post-training at scale, efficient ultra-long-context inference, and robust runtime design. It also covers sandboxing, scheduling, environment quality, context engineering, cost control, and risk management.

    1. Introduction: Competition Moves to Long-Horizon Task Delivery

    Recent large-model competition has focused on two dimensions: parameter scale and context window. Both are quickly becoming standard on flagship models—parameters reaching the trillion scale, and contexts expanding to the millions of tokens. But “more parameters, a longer window” is not the same as “gets the job done.” What truly separates models is whether they can work continuously for tens of minutes or even hours with minimal human intervention, such as:

    • Completing a cross-file refactor;
    • Running a complete industry research workflow;
    • Iterating a parameterized model to a renderable, deliverable state.

    In October 2026, a Chinese model provider released a trillion-parameter flagship model that supports million-token contexts and emphasizes code, 3D creation, financial research, and long-horizon agent capabilities. It also launched an accelerated version with the same level of intelligence and 2–3x faster output. On the training side, the most notable change was a larger post-training compute budget and an expansion of reinforcement learning to hundreds of downstream domains.

    (Note: the original page for this release could not be accessed. The information above is based on the provided source text; all metrics are vendor-published and have not yet been independently verified by third parties.)

    This signals a clear shift: the competitive center of gravity is moving from “single-turn answer quality” to “long-chain task completion rate.”

    Long-task failures are usually not because the model “can’t do it,” but because errors accumulate along a long chain and only surface at the end. A simplified probability estimate illustrates why:

    • If each step succeeds with probability p, a task chain has n steps, and the steps are independent, then the end-to-end success rate is pⁿ;
    • At p = 0.95 and n = 100, the success rate is only about 0.6%;
    • If p rises to 0.99, the success rate is about 36.6%;
    • Even then, more than 60% of tasks still fail.

    A small gain in single-step accuracy is amplified exponentially across a long chain. Long-horizon agent capability therefore cannot be obtained just by swapping models; it depends on system-level engineering across post-training methods, the inference engine, sandboxes, scheduling, and the runtime framework.

    This article does not evaluate any specific product. Instead, it distills three engineering pillars from the release above:

    1. Training: how to make models learn to complete long tasks;
    2. Inference: how to maintain efficiency and quality across ultra-long contexts;
    3. Runtime: how to keep agents running stably over long durations and across multiple agents.

    2. Post-Training: Extending Reinforcement Learning to Real Working Environments

    2.1 Why larger-scale post-training is needed

    Pre-training solves “what to know”; post-training solves “how to use it.” One of the most notable changes from the previous generation (K3) to the newer model (K3.1 Pro) was a substantial increase in post-training compute and an expansion of reinforcement learning across hundreds of downstream domains. The reasoning has three parts:

    • Training data is converging. Pre-training corpora across mainstream models overlap heavily, and the marginal returns from larger parameter counts are diminishing. Post-training has become the key lever for separating capabilities.
    • Capability gains require environments. Whether tasks in code, finance, or 3D can be completed depends on the model’s ability to repeatedly trial, receive feedback, and correct itself in real tool environments. Such capability cannot be learned from static corpora; it must be trained in interactive environments.
    • There is a trade-off between scale and generalization. Over-training in a single domain (such as code) can produce impressive scores while causing regressions elsewhere. Joint training across hundreds of domains is essentially trading breadth for robustness.

    2.2 Four core challenges of long-trajectory reinforcement learning

    The reinforcement learning paradigm holds no secret: the model acts in an environment, receives a reward, and updates its parameters accordingly. But in agent scenarios, a single trajectory may contain dozens or even hundreds of inference and tool calls, and the difficulty rises by an order of magnitude:

    1. Long trajectories, expensive sampling. A single trajectory may consume tens of thousands to hundreds of thousands of tokens, and one training round often samples thousands of trajectories, making rollouts the main source of training cost.
    2. Sparse rewards. Long tasks often yield only a “success/failure” signal at the end, with little feedback on intermediate steps. The model struggles to determine which step was right or wrong—the credit assignment problem.
    3. Insufficient differentiation. If a batch of samples is either all correct or all wrong, the advantage estimate is zero and the gradient carries almost no useful signal. Difficulty grading and curriculum design are needed to keep tasks in the “model can partially solve” range.
    4. Reward hacking. The model may find shortcuts that “score well without actually solving the problem,” such as hard-coding return values to pass test cases, skipping failing cases, or directly modifying the validation script. This is especially dangerous in agent training, because agents inherently have permission to modify their environment.

    2.3 Engineering approaches

    These problems are typically addressed on four fronts:

    • Decouple the training framework from sampling. Split sampling and parameter updates into separate roles and run an asynchronous pipeline so that GPU training overlaps with CPU-heavy environment interaction; sampling precision can be reduced to speed things up.
    • Combine process rewards with verifiable rewards. For tasks that can be objectively judged by a program (whether code passes tests, whether a model renders correctly, whether numbers reconcile), prioritize verifiable rewards; for harder-to-judge parts, add process or model rewards as an aid. The key is that reward signals should come from the external environment as much as possible, not from the model’s self-assessment.
    • Curriculum and difficulty sampling. Dynamically bucket tasks by pass rate and prioritize sampling tasks with mid-range pass rates, keeping training within a “learnable zone.”
    • Auditing against reward hacking. Continuously check for behaviors such as skipping tests, tampering with validation logic, or exploiting loopholes in evaluation scripts, and iterate the rewards and environment accordingly.

    The quality of the task environment itself is equally critical: whether it is reproducible, whether validation is rigorous, and whether loopholes allow “copying the answer” all directly determine what reinforcement learning actually learns.

    3. Infrastructure for Long Tasks: Sandboxes, Scheduling, and Environment Quality

    The essential difference between an agent and a chatbot is that an agent has to “act”: run code, read and write files, call external tools, and operate graphical interfaces. Running thousands of agents in parallel and for long durations requires a complete infrastructure.

    3.1 Sandboxes: the agent’s “hands” and “guardrails”

    Sandboxes solve two problems at once:

    • Providing agents with a real execution environment—shell, Python runtime, filesystem, and browser;
    • Preventing accidental or malicious actions from affecting the host system or other tenants.

    Isolation is usually chosen in tiers by strength:

    Isolation method Startup overhead Isolation strength Typical scenarios
    Process-level isolation (kernel mechanisms such as namespace, cgroup, seccomp) Very low Medium Short-lived, low-risk code execution
    Container Low Medium-high Most general tasks
    Lightweight virtualization (micro VMs, etc.) Medium High Untrusted code, multi-tenant environments

    Sandbox design should balance three dimensions:

    • Reproducibility: the task environment is fixed to an image snapshot, with pinned dependency versions and controlled randomness;
    • Concurrency: a single node runs hundreds or thousands of instances, with layered image caching and on-demand warm-up;
    • Reclaimability: idle timeouts and resource quotas prevent “zombie sandboxes” from consuming resources indefinitely.

    Network access should also be designed in layers: egress is disabled by default, and only trusted dependency sources and API domains are allowed on demand, with rate limiting.

    3.2 Scheduling: resource allocation under mixed workloads

    Agent training workloads have two notable characteristics:

    • Heterogeneous resources: model training is GPU-intensive, while environment interaction and tool calls are CPU-intensive—two very different resource profiles;
    • Long-tail load: long tasks may run for hours, while short tasks take only seconds.

    With static allocation, either GPUs idle while waiting on the environment, or CPUs idle while waiting on GPUs. Common approaches include:

    1. Manage the two resource types in separate pools, decoupled through a message queue, and scale environment instances elastically based on queue length;
    2. Priority-based preemption and quotas to protect the responsiveness of interactive requests and priority tasks;
    3. Checkpoints and resume-from-interruption so long tasks can continue from where they stopped rather than restarting from scratch after a node failure or preemption.

    3.3 Environment quality checks: avoiding “high scores on the wrong problem”

    The upper bound on reinforcement learning effectiveness is set by the environment. An environment quality-checking platform typically covers three layers:

    • Environment availability: whether tasks initialize stably, whether dependencies install correctly, and whether network jitter causes instability;
    • Validation integrity: whether test cases truly cover the task goals, and whether there are paths to “inflate scores” by tampering with tests;
    • Data health: whether training and evaluation sets overlap, and whether task difficulty distribution drifts across versions.

    Without this layer, even the largest post-training compute budget can be amplified in the wrong direction.

    4. Inference: Making Million-Token Contexts Usable, Not Just Visible

    4.1 A long context is not an effective context

    A mainstream model’s “context window” usually refers to the maximum number of input tokens. Existing research has generally found that models do not use information at different positions within a long context uniformly: content at the beginning and end gets more attention, while middle content tends to be ignored. This is often called “lost in the middle.” A more reasonable metric for long-context capability is therefore the “effective context”: the range of information the model can reliably retrieve and reason over at a given length.

    Available engineering optimizations include:

    • Paged KV cache management to reduce memory fragmentation;
    • Prefix cache reuse to cache and reuse the computation of invariant parts such as system prompts and tool definitions;
    • Chunked prefill, which splits long inputs into chunks and schedules them alongside decode requests, avoiding long requests blocking short ones;
    • KV cache compression, quantization, and grouped-query attention to reduce memory and bandwidth overhead.

    4.2 Context engineering: design to compensate for model limits

    Even if a model supports a million tokens, that does not mean all material should be stuffed into the context at once. Common strategies in practice:

    • Place important information first or last. Put key instructions at the beginning and end, and repeat them appropriately;
    • Structure and trim tool returns. Search and browsing tools often return thousands of tokens; extract only the task-relevant snippets;
    • Write long content to disk. Store logs, data, and documents as files that the agent reads on demand, rather than loading them all at once;
    • Rolling summaries. Periodically compress earlier history into a structured summary that keeps decisions, constraints, and unfinished items while discarding redundant detail;
    • Staged generation. Structured outputs such as 3D scenes follow a “generate code first, then render and verify, then iterate” flow, avoiding a single overly long output.

    A simple, well-validated principle: every token in the context should be attended to—either trusted or verified.

    5. Runtime: Harness Design for Long-Horizon Agents

    5.1 What a harness is

    A harness can be understood as an agent’s “runtime environment.” It drives the “model inference → tool call → result feedback” loop and manages context, tools, state, and exceptions on top of it. The model is the “brain”; the harness is the “nervous system and muscles.”

    Recently, several vendors have begun offering the harness as cloud infrastructure, such as managed agent services that support 24/7 long tasks and multi-agent collaboration. For developers, this is both a capability supply and a signal: the engineering quality of the harness itself is becoming a decisive factor in the success or failure of long tasks.

    5.2 Core components

    A production-grade harness usually includes the following modules:

    1. Loop control: defining maximum steps, per-step timeout, total budget, and termination conditions;
    2. Context management: rolling summaries, retrieval injection, and tool-result trimming;
    3. Tool layer: unified parameter validation, timeout control, structured returns, and error messages;
    4. State management: checkpoint persistence, supporting resume-from-interruption and shared workspaces across agents;
    5. Verification layer: using objective signals such as compilation, tests, rendering, and reconciliation to decide whether a task is truly complete;
    6. Human-in-the-loop: triggering human intervention when the budget is exhausted, on risky operations, or after repeated failures.

    5.3 A key design: an execution loop with a verification gate

    The following illustrative code shows a minimal long-task execution skeleton, emphasizing three points: budget control, context compression, and an objective verification gate.

    1. async def run_long_task(task, agent, sandbox, verify, budget, mem):
    2. """Long-task execution skeleton: budget control + context compression + objective verification gate"""
    3. workspace = await sandbox.create(resources=budget.resources) # isolated environment
    4. await workspace.upload(task.files)
    5. memory = mem.load(task.id) # cross-session memory (e.g., previous failure reasons)
    6. ctx = build_context(task.goal, task.constraints, memory)
    7. await checkpoint(task.id, stage="init", ctx=ctx)
    8. for step in range(1, budget.max_steps + 1):
    9. if budget.consumed(step): # any of step count / time / cost exceeded
    10. return await handoff_to_human(task, workspace, reason="budget_exceeded")
    11. action = await agent.decide(ctx, tools=workspace.tools)
    12. result = await workspace.run(action, timeout=budget.step_timeout)
    13. ctx = append(ctx, action, result)
    14. if ctx.tokens > budget.ctx_limit: # roll up (compress) when over limit
    15. summary = await summarize(ctx, keep=["goal", "constraints",
    16. "decisions", "failures"])
    17. ctx = rebuild(summary, tail=ctx.last_k_turns(5))
    18. if step % budget.verify_every == 0: # periodically verify with objective signals
    19. report = await verify(workspace) # compile / test / render / reconcile
    20. if report.passed:
    21. memory.save(task.id, outcome="success", lessons=report.lessons)
    22. return finalize(workspace, report)
    23. ctx = append(ctx, "VERIFICATION", report.failures)
    24. await checkpoint(task.id, stage=f"step_{step}", ctx=ctx)
    25. return await handoff_to_human(task, workspace, reason="no_convergence")

    5.4 Five easily overlooked points

    1. Self-checking is not verification. Having the model “check itself once” only catches some problems; external signals such as compilation, tests, and rendering are what make completion criteria trustworthy.
    2. Tool error messages must be actionable. Instead of “command failed,” a better message is “exit code 1: undefined variable x referenced on line 42.” The quality of error messages directly determines an agent’s ability to self-repair.
    3. Fault-injection testing. Randomly introduce failures such as network timeouts, missing dependencies, and full disks in a development environment, and observe whether the agent can recognize and recover from them.
    4. End-to-end observability. Record each step’s input, output, latency, and token consumption so that, after the fact, you can pinpoint “which step first went off track.”
    5. Multi-agent collaboration needs clear boundaries. Effective ways to divide work include:
      • Splitting by subtask, such as research, coding, and review as independent roles;
      • Giving each agent its own sandbox and exchanging artifacts through a message queue or shared files;
      • Setting merge and conflict-resolution rules to avoid mutual overwrites.

    6. Scenario Practice: Three Typical Long-Horizon Tasks

    6.1 Code: long-horizon refactoring and bug fixing

    Code is one of the best-suited scenarios for agents because it has the most complete verification means: compilation, unit tests, static analysis, and sandbox execution.

    • Task characteristics: cross-file and cross-module, requiring an understanding of call relationships, with existing behavior preserved after changes;
    • Recommended flow:
      1. First have the agent produce a change plan and impact analysis;
      2. Implement changes module by module;
      3. After each module, run compilation and tests;
      4. After all changes, run a full regression.
    • Engineering points:
      • Treat tests as “guardrails,” not “targets,” and forbid modifying test cases to “pass tests”;
      • Create a separate branch or workspace for each task so failures can be discarded directly;
      • For large-scale changes, use differential review and hand only the changed parts to human reviewers.

    6.2 Financial research: long-document processing and cross-validation

    A typical input for financial research is hundreds of pages of filings, annual reports, and research notes; the output is a research memo with data and conclusions. The difficulty lies in numerical accuracy and source traceability.

    • Recommended flow:
      1. Parse documents, preserving table structure and page locations;
      2. Extract key financial metrics and time series;
      3. Cross-validate (for example, assets = liabilities + owners’ equity, and year-over-year / quarter-over-quarter logic);
      4. Produce a structured summary with citations.
    • Engineering points:
      • Bind every number to its source document and page for “traceable conclusions”;
      • Use deterministic scripts for numerical calculations rather than relying on the model’s mental math;
      • In a multi-agent setup, use an “extract–validate–write” pipeline, with an independent validation stage responsible for catching errors;
      • Be clear about boundaries: AI output is research-assistance material, not investment advice, and sensitive data must follow compliance requirements.

    6.3 3D creation: a closed loop of procedural generation and rendering

    3D creation is moving from “manual modeling” toward “describing a scene in natural language or code, then having the agent generate and iterate.” A common approach is for the model to generate a parametric modeling script (for example, based on a Python modeling API), which a rendering engine then executes and returns as an image.

    • Verification loop: script execution → geometry generation → render preview → check composition, materials, and lighting with the model or a multimodal model → adjust parameters → re-render;
    • Engineering points:
      • Rendering takes time, so use low-resolution quick previews and high-resolution final output;
      • Manage scene descriptions and parameters separately for easy version comparison and rollback;
      • Use geometric validity checks (such as whether non-manifold structures exist or normals point correctly) as objective validation;
      • Preserve editable project files from the generated results, rather than outputting only images or meshes.

    7. Service Forms, Cost, and Risk Control

    7.1 Accelerated versions and cache-based billing

    The value of an accelerated version is to decouple “intelligence level” from “response speed.” In interactive coding, the model waits for a response after each code segment, so a 2–3x increase in output speed means shorter waits and more room to iterate.

    Cache-based billing is key to controlling long-task cost. In this release, the cached-input price is about 1/10 of the non-cached price, while the output price is about 5x the non-cached input price. This price relationship sends three signals:

    • Repeated long contexts (system prompts, project background, history summaries) should be cached and reused as much as possible;
    • Model output is the main cost source, so reducing verbose output directly lowers cost;
    • Prices vary widely across vendors and tiers, so enterprises should make selections based on measured testing against their own workloads.

    An example of cache-friendly design:

    1. [Cache segment: system prompt + tool definitions + project conventions + domain knowledge (invariant across requests)]
    2. [Incremental segment: current task description + recent turns + tool returns]

    In practice, avoid embedding volatile content such as timestamps or random IDs in the cache segment; the incremental segment follows a “newest content evicted first” principle, with length controlled through rolling summaries.

    7.2 Managed agents vs. self-built harness

    Enterprises face a practical choice: use a cloud vendor’s managed agent service or build a harness themselves.

    • Managed services: ready to use, eliminating environment setup and operations, suitable for rapid validation and long-tail business;
    • Self-built harness: deeply controllable, easy to integrate with internal systems (ticketing, code hosting, data platforms), and able to meet compliance requirements such as keeping data on-premises;
    • Hybrid model: build the core path yourself, and use managed services for elastic tasks (such as batch research and batch generation).

    Whatever the model, it is advisable to accumulate evaluation sets, guardrails, and observability systems as “own assets” to avoid being locked into a single service. In the domestic cloud market, general-purpose products such as container services, object storage, message queues, logging, and monitoring and alerting can serve as common building blocks for a self-built harness; for example, the Baidu AI Cloud Qianfan platform offers capabilities such as model invocation, application development, and agent tooling, and can serve as one candidate for evaluation.

    8. Risks and Limitations: Caution About “the Strongest”

    Vendor-published benchmark results have important reference value, but the following points deserve attention:

    1. Benchmarks are not production. Terminal-task benchmarks and internal long-horizon code tests measure specific capabilities, which differ greatly from a real business’s data distribution, toolchain, and permission model;
    2. Uneven capability and verbosity. Imbalanced capability structure and verbose output are common issues in many models today. Developers should build evaluation sets on their own business data, focusing on task success rate, average steps, average latency, and average cost;
    3. Data and compliance. In long tasks, agents touch sensitive information such as code, financial data, and design assets, so isolation, transport encryption, access auditing, and data-retention policies should be planned in advance;
    4. Cost overruns. Long tasks without budget constraints can “grow more expensive as they run.” Step limits, token budgets, and per-task cost alerts should be default configuration;
    5. Over-trust. High-risk operations (such as deleting data, sending externally, or executing financial transactions) must retain a human-confirmation step.

    9. Conclusion

    Trillion-parameter models and million-token contexts mark a new stage for the “foundational capability” of large models; extending reinforcement learning to hundreds of domains and offering the harness as infrastructure signal that competition has entered a “systems engineering” stage.

    For developers, what matters may no longer be “which model is the strongest,” but rather three things:

    • How to design verifiable task environments;
    • How to build a reliable runtime framework;
    • How to control cost with caching, budgets, and accelerated options.

    Models will keep iterating, but this engineering methodology will remain effective over the long term.