Radar Live
✦ Ask AI
AI INTELLIGENCE & SIGNALS

How we make AI coding more cost efficient without sacrificing task quality

Phân tích đã xử lý trước và các nguồn liên quan.

Tín hiệu Radar

61 RADAR
Coding AI Coding Agents · 1 nguồn đối chiếu · 2026-09-02 18:00:00 +0000 UTC

How we make AI coding more cost efficient without sacrificing task quality

Nguồn: GitHub Blog AI

GitHub Copilot áp dụng 4 cải tiến thực tế nhằm giảm chi phí suy luận (token) mà không làm giảm chất lượng tác vụ: nén có chọn lọc output của các lệnh ồn ào (build/test/lint) nhưng giữ nguyên mã nguồn và kết quả tìm kiếm; loại bỏ tiền tố số dòng thừa khi xem file; rút gọn 50% prompt điều phối sub-agent qua meta-prompting kết hợp kiểm thử hành vi; và gom nhóm để trả trực tiếp kết quả chạy nền vào context mà không tốn thêm lượt truy xuất. Bài học cốt lõi là tối ưu hóa toàn bộ vòng đời tác vụ và luồng điều phối thay vì rơi vào bẫy cắt giảm token cục bộ ở từng tool call.

TÁC ĐỘNG & GIÁ TRỊ THỰC TIỄN

Nghiên cứu thực tế từ GitHub Copilot chỉ ra rằng việc tối ưu chi phí cho AI agent không nằm ở việc cắt giảm token mù quáng tại từng lượt gọi công cụ, mà phụ thuộc vào kiến trúc điều phối (orchestration) và cung cấp ngữ cảnh chuẩn xác. Bốn kỹ thuật được chia sẻ cung cấp giải pháp kỹ thuật cụ thể giúp các nhà phát triển agent cắt giảm chi phí vận hành đáng kể, nâng cao tốc độ phản hồi mà vẫn duy trì độ chính xác cao trong môi trường sản xuất quy mô lớn.

Developer 80
Business 76
Novelty 70
Actionable 90

Nội dung thu thập đã chuẩn hóa

Collected Evidence

Nội dung văn bản được dùng làm dữ liệu đối chứng cho mô hình AI, không phải chỉ thị hệ thống.

Output quality is important when working with AI coding agents, but true efficiency comes from getting work done quickly, efficiently, and with the right context. That’s why token count of individual interactions alone isn’t a meaningful measure of efficiency. The goal shouldn’t be to use fewer tokens, but to tap into the right amount of context to move a task forward. A concise tool response can sometimes require additional calls or work if it leaves out information the agent needs, ultimately making the task slower and more expensive. That’s why we want to optimize for the outcome rather than the tool call. This post examines four changes in GitHub Copilot that put that principle into practice: Preserve useful context while reducing repetitive output. Remove formatting that adds no value to the task. Shorten instructions without changing useful behavior. Deliver completed background work without an extra retrieval step. Possible changes were evaluated offline using agentic coding benchmarks. The most promising changes were then validated through controlled online experiments before shipping. The examples in this post come from GitHub Copilot CLI. Multiple other Copilot products, such as the GitHub Copilot app and Copilot code review, use the same underlying harness and also become more efficient through these improvements. Figure 1: Four independent A/B experiments using the same AI-credit metric. The segments are shown together for comparison; their effects are not necessarily strictly additive.  The local metric trap It’s common to shorten the output from each tool call as a way to reduce agent costs. RTK (Rust Token Killer) is a utility that shortens shell output before an agent reads it. We evaluated its effect on GitHub Copilot using our agentic coding benchmarks. In our harness and benchmark configuration, RTK shortened some responses, but when the omitted text mattered, the model sometimes reopened the original output or reran the command to recover what it needed. Those recovery steps added turns and carried more context forward. The individual tool response was shorter, but on average, the task used more tokens and took longer. We saved tokens locally and spent more globally. Figure 2: A shorter tool response can make the completed task more expensive when missing details force the agent to reread output, rerun commands, and carry more context forward.  This result applies to the integration and workloads we tested, not to every RTK configuration or to output compression in general. This meant that tokens per tool call is the wrong objective. An efficiency change has to be evaluated across the complete task, from the user’s request through the final result. More useful was to look at what can we remove without making the model repeat work. Compress noise, preserve useful information The goal was to shorten repetitive output while preserving the context an agent needs to complete its task without retracing steps. Analysis of benchmark runs showed that install, build, test, and lint output often contains repetitive noise, while source-like output and arbitrary command results are more likely to contain the information an agent needs. That analysis informed a selective output compressor, informed in part by RTK and similar approaches. The prototype was evaluated on agentic coding benchmarks and a range of open source repositories, exercising their build, test, and lint systems. Early versions were too aggressive. They made the model repeat work or read the full saved output, increasing end-to-end cost and reducing task success. For example, we initially compressed git diff but removed that filter after benchmark tasks showed agents reopening the original output to recover missing information. Those early failures led to a three-part policy: Preserve source-like and arbitrary output. Commands such as cat , git diff , git show , and arbitrary scripts are returned unchanged. Reorganize search results without dropping content. Matches and file lists from tools such as grep can be grouped more efficiently while retaining every result. Compress repetitive noise selectively. Install, build, test, and progress output is compressed only when the savings are substantial. The shipped version emerged through repeated evaluation and refinement. It is conservative not because the goal was to build a conservative compressor, but because that is what the evaluations supported. When output is compressed, the agent can still retrieve the complete original through a direct recovery path. Figure 3: The shipped compressor preserves source-like output, reorganizes search results without loss, and compresses only predictable repetitive noise while retaining the full original. That recovery path is both a safety mechanism and an evaluation signal. We tracked whether the agent opened the saved original, reran commands, repeated exploration, narrowed its searches, or took additional turns. Frequent recovery would indicate that the compressor had removed something valuable. On offline tasks where output compression triggered, no statistically significant task-success regression was detected, and agents extremely rarely opened the saved originals. In the online experiment, average cost decreased slightly with no material regression detected in the tracked quality metrics. Remove formatting before removing information One clean token optimization came from the view tool, which agents use to read file contents into context. Previously, view prefixed every line with a number before showing the contents to the model. Earlier file-editing tools used those numbers to target changes, but current tools instead match surrounding code and do not use line numbers. The line-number prefixes remained even though the normal workflow no longer used them. Each prefix was small. Repeated across every line and every file read, however, that unused formatting accumulated throughout a session. So, we removed it. Figure 4: Removing line-number prefixes preserves the source exactly while eliminating formatting that was repeated across every file read. Line numbers remain useful in diffs and short snippets. They were wasteful here because they were attached to every file read without serving the current editing workflow. Removing them caused model-inference cost to fall by roughly 5% in offline agentic coding benchmarks. Success rates stayed within the expected run-to-run variance, and edit failures did not increase. We then tested the change with Copilot CLI users. The online experiment reduced average daily model-inference cost per user by about 3%, with no material regression detected in the quality or satisfaction metrics we tracked. For developers, that means more of the context window is available for the work itself rather than formatting the agent does not use. This was the ideal change: no new instructions for the model, no source of information to recover, and no additional decision to make. The file contents reached the model unchanged. Compress prompts without compressing intent Prompts carry instructions that shape how an agent works, and they are sent to the model on every turn. Shortening them only improves efficiency if the agent keeps the behaviors developers depend on. In GitHub Copilot, the task tool launches specialized agents for parallel work. Its guidance had accumulated across tool descriptions, schemas, agent definitions, system instructions, and companion tools. A meta-prompting loop, in which Copilot iteratively wrote its own prompt, reduced that prompt by roughly half. Copilot produced and refined smaller candidates, and targeted behavioral tests checked the requirements we wanted to preserve. The first online experiment found a regression that the initial offline evaluations had missed. The meta-prompting loop had rewritten cautious parallelism guidance into a hard scheduling policy, causing independent custom agents to run sequentially. We stopped the experiment. Before changing the prompt again, we wrote a regression evaluation for the behavior users had exposed. The eventual fix replaced an explicit allowlist and denylist with one sentence: Independent agents can run in parallel; consider side effects. That sentence was shorter and less restrictive; it deferred the choice of whether to run sub-agents in parallel to the model instead of the previous explicit guidance. With it, our new behavior test passed without causing any existing behavioral tests to fail. Prompt behavior needs tests. If a behavior is not tested, a shorter prompt can remove it without anyone noticing.  Figure 5 Prompt compression became safe only after a regression test exposed serialized agents and a one-sentence fix restored parallelism; the resulting token savings recur on every model turn. The shipped prompt removes about 1,300 task -tool prompt tokens per turn, corresponding to approximately 1.8% fewer total prompt tokens per session and 2.9% lower normalized cost per active hour, with no quality regression detected in the measured evaluations. Deliver completed background work without an extra retrieval turn Agents often run independent work in the background, such as a long-running shell command alongside a sub-agent investigation. Notifications let the agent continue until that work is ready without spending a tool call waiting. If the agent does not explicitly wait for either task, the harness wakes the model and notifies it when the shell command or sub-agent finishes. Previously, that notification did not include the completed result, so the agent had to spend another turn retrieving output Copilot had already received. When several tasks finished close together, that detour could repeat. Copilot now batches eligible completion notifications and delivers completed results directly in the existing tool-result format. The agent can continue with the information it needs, without spending an extra turn asking for it again. Explicit reads for work that is still running behave as before. Figure 6 Before, each background completion could wake a retrieval-only model turn. After, the harness batches eligible completions and delivers completed results in the existing tool-result format. Before this change, each completed task required one model call to request its result and another to process it. For the shell command and sub-agent shown above, that meant four model calls before work could continue. Now, the harness batches both completions and supplies their results together, so a single model call can process both. Removing those retrieval detours also avoids carrying the full session context through unnecessary calls. By delivering completed results directly, without compressing, summarizing, or withholding anything, the harness reduced average token-related usage, as measured in AI Credits, by about 2.3%. Measure changes in context A change that saves tokens in one Copilot workflow can increase costs in another. For example, a tighter set of file-tool instructions was inspired by positive results in Copilot code review. In a Copilot CLI online experiment, it increased cost, so we did not ship it. By contrast, removing line-number prefixes and selectively compressing output each reduced average prompt tokens per review by roughly 5% in independent evaluations across a large set of Copilot code review tasks using the production model. We detected no material change in the tracked review-quality metrics. These findings are separate from the earlier migration of Copilot code review to the shared file tools , which, together with review-instruction tuning, reduced code review cost by about 20%. Each change needs to be measured in the workflow where it runs. Five lessons for building efficient AI coding agents Optimize the completed task, not the tool call. Shorter output is not cheaper if the agent spends more turns recovering what was removed. Optimize orchestration, not just model output. Eliminate model turns that perform work the harness can complete deterministically. Compress by what the output represents. Preserve exact content, prefer lossless transformations, and measure how often agents use the recovery path. Prompt rewrites sometimes have unintended consequences. Validate that intended behavior is preserved. Evidence is local to the workload. Re-evaluate changes in offline benchmarks, online experiments, and every product surface where they ship. None of these changes made the model smarter. They removed work the model never needed to do. The changes described in this post are shipping across GitHub Copilot experiences that use the same underlying harness. Bring agentic workflows to your terminal with GitHub Copilot CLI > The post How we make AI coding more cost efficient without sacrificing task quality appeared first on The GitHub Blog .

Các nguồn đối chiếu cho sự kiện này

1 nguồn
Thông tin phân tích AI & Model Details
Provider: openai-compatible · Model: gemini-3.8-flash-high · Version: analysis-v1 · Time: 2026-09-18 01:15:05 +0000 UTC
{"tags": ["GitHub Copilot", "AI Coding Agents", "Cost Optimization", "Context Window", "Token Efficiency", "Agent Orchestration", "Prompt Compression", "Local Metric Trap"], "risks": ["Bẫy chỉ số cục bộ (Local metric trap): Nén output quá mức khiến model thiếu ngữ cảnh, phải đọc lại file hoặc chạy lại lệnh, dẫn đến tốn nhiều token và thời gian hơn tổng thể.", "Rủi ro suy thoái hành vi khi rút gọn prompt: Tối ưu prompt qua meta-prompting có thể vô tình làm mất tính năng quan trọng (như biến cơ chế chạy song song thành tuần tự) nếu thiếu kiểm thử hồi quy.", "Tính phụ thuộc vào ngữ cảnh (Context-dependent): Một thay đổi giúp tiết kiệm token ở workflow này có thể làm tăng chi phí ở workflow khác (như trường hợp giữa Copilot code review và Copilot CLI)."], "category": "Coding", "entities": ["GitHub Copilot", "GitHub", "Copilot CLI", "Copilot code review", "RTK (Rust Token Killer)"], "summary_vi": "GitHub Copilot áp dụng 4 cải tiến thực tế nhằm giảm chi phí suy luận (token) mà không làm giảm chất lượng tác vụ: nén có chọn lọc output của các lệnh ồn ào (build/test/lint) nhưng giữ nguyên mã nguồn và kết quả tìm kiếm; loại bỏ tiền tố số dòng thừa khi xem file; rút gọn 50% prompt điều phối sub-agent qua meta-prompting kết hợp kiểm thử hành vi; và gom nhóm để trả trực tiếp kết quả chạy nền vào context mà không tốn thêm lượt truy xuất. Bài học cốt lõi là tối ưu hóa toàn bộ vòng đời tác vụ và luồng điều phối thay vì rơi vào bẫy cắt giảm token cục bộ ở từng tool call.", "key_changes": ["Chuyển dịch mục tiêu đo lường từ giảm token cục bộ ở từng tool call sang tối ưu hóa chi phí và tỷ lệ thành công của toàn bộ tác vụ (end-to-end task).", "Áp dụng bộ nén output có chọn lọc: giữ nguyên dữ liệu dạng mã nguồn (cat, git diff, git show) và gom nhóm kết quả tìm kiếm; chỉ nén log lặp lại (build, test, lint) và luôn duy trì đường dẫn phục hồi (recovery path) bản gốc.", "Loại bỏ tiền tố số dòng trong công cụ đọc file (view), giúp giảm ~3% chi phí suy luận hàng ngày trên Copilot CLI và ~5% trên offline benchmark mà không ảnh hưởng chất lượng sửa code.", "Rút gọn khoảng 50% prompt của task tool (~1.300 token/lượt) bằng meta-prompting kết hợp kiểm thử hồi quy hành vi, đảm bảo sub-agent duy trì khả năng chạy song song.", "Gom nhóm và chuyển giao trực tiếp kết quả tác vụ nền (background work delivery) vào context, loại bỏ các lượt gọi mô hình trung gian chỉ để lấy kết quả, giảm ~2,3% lượng tiêu thụ AI Credit."], "sub_category": "AI Coding Agents", "novelty_score": 70, "business_score": 85, "research_score": 65, "why_it_matters": "Nghiên cứu thực tế từ GitHub Copilot chỉ ra rằng việc tối ưu chi phí cho AI agent không nằm ở việc cắt giảm token mù quáng tại từng lượt gọi công cụ, mà phụ thuộc vào kiến trúc điều phối (orchestration) và cung cấp ngữ cảnh chuẩn xác. Bốn kỹ thuật được chia sẻ cung cấp giải pháp kỹ thuật cụ thể giúp các nhà phát triển agent cắt giảm chi phí vận hành đáng kể, nâng cao tốc độ phản hồi mà vẫn duy trì độ chính xác cao trong môi trường sản xuất quy mô lớn.", "developer_score": 90, "importance_score": 85, "possible_use_cases": ["Tối ưu hóa chi phí token và độ trễ cho các hệ thống AI coding agent và trợ lý lập trình quy mô doanh nghiệp.", "Thiết kế harness điều phối multi-agent hiệu quả, bàn giao kết quả background tasks mà không phát sinh thêm roundtrip gọi LLM.", "Tối ưu công cụ đọc/sửa file cho agent dựa trên đối sánh ngữ cảnh (context matching) thay vì đánh số dòng gây lãng phí context window.", "Thiết lập quy trình kiểm thử hồi quy hành vi (behavioral regression testing) khi nén và tinh chỉnh prompt điều phối agent."], "actionability_score": 90}
← Trang trước Trang 1