IP Library › Granted Patent US 12,524,210
Granted Patent B2
US 12,524,210 · App. 18/241,244 · Granted Jan 13, 2026

Hybrid inference system for COGS reduction

Inventors: Shengyu Fu (Redmond, WA); Jin Woo Jang (Kirkland, WA); Neelakantan Sundaresan (Bellevue, WA); Alexey Svyatkovskiy (Bellevue, WA)
Assignee: Microsoft Technology Licensing, LLC
G06F8/35G06F11/3608
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,524,210
App. No.
18/241,244
Filed
Sep 1, 2023
Granted
Jan 13, 2026
Kind
B2
Art Unit
2151
USPC
717/106
Abstract

A hybrid inference system for a coding assistant utilizes a routing model to predict whether output generated by a large language model for a given prompt would be accepted by a user of the coding assistant. The routing model routes the prompt when the routing model indicates that the output generated by the large language model is likely to be accepted. The routing model routes the prompt to a local model when the output generated by the large language model is not likely to be accepted. The routing model is trained on the historical output generated by the large language model for various prompts and the acceptance or rejection of the output by users of the coding assistant.

Claims (50)

1 . A system comprising:

a processor; and

a memory that stores a program configured to be executed by the processor, the program comprising instructions that when executed by the processor perform acts that:

obtain, from a user interface of a coding assistant, a prompt to a large language model (LLM) for the LLM to generate a code generation candidate, wherein the LLM resides on an external host;

determine, from a routing model, whether the LLM will generate a low-return output not accepted by a user;

upon the routing model determining that the LLM will generate the low-return output: route the prompt to a local model in proximity to the coding assistant;

receive the code generation candidate from the local model; and

return the code generation candidate to the user interface; and

upon the routing model determining that the LLM will not generate the low-return output:

route the prompt to the LLM;

receive the code generation candidate from the LLM; and

return the code generation candidate to the user interface.

2 . The system of claim 1 , wherein the local model is stored in a computing device of the coding assistant.

3 . The system of claim 1 , wherein the routing model is stored in a computing device of a user of the coding assistant.

4 . The system of claim 1 , wherein the user interface is part of a software development environment.

5 . The system of claim 1 , wherein the routing model is trained on historical data comprising output generated by the LLM for a respective prompt and acceptance/rejection of the output by a respective user of the coding assistant.

6 . The system of claim 1 , wherein the routing model comprises an encoder neural transformer model with attention.

7 . The system of claim 1 , wherein the local model is a neural transformer model with attention.

8 . The system of claim 1 , wherein the large language model is a neural transformer model with attention.

9 . A computer-implemented method, comprising:

receiving, from a user interface of a coding assistant, a prompt to a large language model (LLM), wherein the LLM resides on an external host, wherein the prompt comprises a context for generation of a code generation candidate;

determining, from a routing model, whether the prompt is a low-return prompt that will result in the code generation candidate not accepted by a user of the coding assistant;

upon the routing model determining that the prompt is a low-return prompt: routing the prompt to a local model in proximity of the coding assistant;

causing the local model to generate the code generation candidate given the prompt;

receiving the code generation candidate from the local model; and

returning the code generation candidate to the user interface; and

upon determining that the prompt is not a low-return prompt: routing the prompt to the LLM.

10 . The computer-implemented method of claim 9 , wherein the local model is a neural transformer model with attention.

11 . The computer-implemented method of claim 9 , further comprising:

receiving the code generation candidate from the LLM; and

returning the code generation candidate to the user interface.

12 . The computer-implemented method of claim 9 , wherein the routing model is trained on telemetry data of the LLM, wherein the telemetry data comprises a plurality of training prompts and associated user responses to output of the LLM given a training prompt.

13 . The computer-implemented method of claim 9 , wherein the routing model is trained on historical acceptance of candidates output from the large language model.

14 . The computer-implemented method of claim 9 , wherein the routing model is trained on historical rejections of candidates output from the large language model.

15 . The computer-implemented method of claim 9 , wherein the routing model is an encoder neural transformer model with attention.

16 . A hardware device having stored thereon computer executable instructions that are structured to be executable by a processor of a computing device to thereby cause the computing device to perform actions that:

host a local neural model on the computing device to interact with a coding assistant;

access a large language model to generate an output given a prompt;

obtain a target prompt from a user interface of the coding assistant;

determine from a routing model whether a target output from the large language model given the target prompt has a high probability of being accepted by a user of the coding assistant, wherein the determination is based on historical acceptances and rejections of historical outputs generated by the large language model given different prompts;

upon the routing model indicating that the target output from the large language model given the target prompt has a high probability of being accepted by the user of the coding assistant:

route the prompt to the large language model;

obtain a response from the large language model; and

display the response in the user interface; and

upon the routing model indicating that the target output from the large language model given the target prompt does not have a high probability of being accepted by the user of the coding assistant, route the target prompt to the local neural model.

17 . The hardware device of claim 16 , wherein the routing model is pre-trained on natural language text and source code and fine-tuned on telemetry data of the large language model.

18 . The hardware device of claim 16 having stored thereon computer executable instructions that are structured to be executable by a processor of a computing device to thereby cause the computing device to perform actions that:

utilize a binary classifier as the routing model to determine to predict whether the output from the large language model given the target prompt is likely to be has a high probability of being accepted by the user of the coding assistant.

19 . The hardware device of claim 16 , wherein the binary classifier resides on the computing device of the coding assistant.

20 . The hardware device of claim 16 , wherein the binary classifier is a neural transformer model with attention.

Assignments (2)
CORRECTIVE ASSIGNMENT TO CORRECT THE ATTORNEY DOCKET NUMBER PREVIOUSLY RECORDED ON REEL 064781 FRAME 0386. ASSIGNOR(S) HEREBY CONFIRMS THE ASSIGNMENTS.. Recorded Sep 15, 2023
From: FU, SHENGYU; JANG, JIN WOO; SUNDARESAN, NEELAKANTAN; SVYATKOVSKIY, ALEXEY
To: MICROSOFT TECHNOLOGY LICENSING, LLC.
Reel/Frame 064913/0516 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 1, 2023
From: FU, SHENGYU; JANG, JIN WOO; SUNDARESAN, NEELAKANTAN; SVYATKOVSKIY, ALEXEY
To: MICROSOFT TECHNOLOGY LICENSING, LLC.
Reel/Frame 064781/0386 →
Continuity (2)
Provisional Application 63467309 · May 17, 2023
Related Publication 20240385814A1 · Nov 21, 2024
References Cited (48)
US 11726750B1 · Arcadinho · 2023 [cited by examiner]
US 11954602B1 · Mulcahy · 2024 [cited by examiner]
US 12039295B2 · Allamanis · 2024 [cited by examiner]
US 12141553B2 · Athiwaratkun · 2024 [cited by examiner]
US 12147765B2 · Bhardwaj · 2024 [cited by examiner]
US 12254008B2 · Zorn · 2025 [cited by examiner]
US 20200249918A1 · Svyatkovskiy · 2020 [cited by examiner]
US 20200364408A1 · Lao · 2020 [cited by examiner]
US 20210271455A1 · Svyatkovskiy · 2021 [cited by examiner]
US 20220139380A1 · Meng · 2022 [cited by examiner]
US 20220398071A1 · Allamanis · 2022 [cited by examiner]
US 20230342116A1 · Dibia · 2023 [cited by examiner]
US 20230418567A1 · Athiwaratkun · 2023 [cited by examiner]
US 20240020491A1 · Chen · 2024 [cited by examiner]
US 20240095077A1 · Singh · 2024 [cited by examiner]
US 20240127112A1 · Ziegler · 2024 [cited by examiner]
US 20240143289A1 · Pandita · 2024 [cited by examiner]
US 20240143296A1 · Hasabnis · 2024 [cited by examiner]
US 20240144922A1 · Pandita · 2024 [cited by examiner]
US 20240248686A1 · Garg · 2024 [cited by examiner]
US 20240256423A1 · Zhang · 2024 [cited by examiner]
US 20240273294A1 · Shakeri · 2024 [cited by examiner]
US 20240281218A1 · Masad · 2024 [cited by examiner]
US 20240289606A1 · Wang · 2024 [cited by examiner]
US 20240311093A1 · Schaefer · 2024 [cited by examiner]
US 20240329948A1 · Yuan · 2024 [cited by examiner]
US 20240361996A1 · Fu · 2024 [cited by examiner]
US 20240362209A1 · Almaer · 2024 [cited by examiner]
US 20240378399A1 · Gandhi · 2024 [cited by examiner]
US 20250094145A1 · Weber · 2025 [cited by examiner]
US 20250094814A1 · Wang · 2025 [cited by examiner]
US 20250103300A1 · Le · 2025 [cited by examiner]
US 20250111220A1 · Jones · 2025 [cited by examiner]
US 20250117195A1 · Rieken · 2025 [cited by examiner]
US 20250123812A1 · Zhao · 2025 [cited by examiner]
Ciniselli, Matteo, et al. “An empirical study on the usage of transformer models for code completion.” IEEE Transactions on Software Engineering 48.12 (2021). [cited by examiner]
Husein, Rasha Ahmad, Hala Aburajouh, and Cagatay Catal. “Large language models for code completion: A systematic literature review.” Computer Standards & Interfaces 92 (2025). [cited by examiner]
Svyatkovskiy, Alexey, et al. “Intellicode compose: Code generation using transformer.” Proceedings of the 28th ACM joint meeting on European software engineering conference and symposium on the foundations of software e… [cited by examiner]
Bareiß, Patrick, et al. “Code generation tools (almost) for free? a study of few-shot, pre-trained language models on code.” arXiv preprint arXiv:2206.01335 (2022). [cited by examiner]
Devlin, et al., “BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding”, In Proceedings of Conference of the North American Chapter of the Association for Computational Linguistics: Human Lang… [cited by applicant]
Liu, et al., “ROBERTa: A Robustly Optimized BERT Pretraining Approach”, In Repository of arXiv:1907.11692v1, Jul. 26, 2019, 13 Pages. [cited by applicant]
Sun, et al., “Don't Complete It! Preventing Unhelpful Code Completion for Productive and Sustainable Neural Code Completion Systems”, In Proceeding of IEEE/ACM 45th International Conference on Software Engineering: Comp… [cited by applicant]
Svyatkovskiy, et al., “IntelliCode Compose: Code Generation using Transformer”, In Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engin… [cited by applicant]
Vaswani, et al., “Attention Is All You Need”, In Proceedings of 31st Conference on Neural Information Processing Systems, Dec. 4, 2017, pp. 1-11. [cited by applicant]
International Search Report and Written Opinion received for PCT Application No. PCT/US2024/026715, Jul. 15, 2024, 13 pages. [cited by applicant]
Weiss, et al., “Adopting Two Supervisors for Efficient Use of Large-Scale Remote Deep Neural Networks,” arXiv, Apr. 5, 2023, pp. 1-29. [cited by applicant]
U.S. Appl. No. 63/467,309, May 17, 2023. [cited by applicant]
International Preliminary Report on Patentability (Chapter I) received for PCT Application No. PCT/US2024/026715, Mailed on Nov. 27, 2025, 09 Pages. [cited by applicant]