| 1 | --- |
| 2 | title: "How Autocomplete Works" |
| 3 | description: "Autocomplete is a that uses a combination of retrieval methods and response processing techniques. The system can be understood in roughly three parts." |
| 4 | --- |
| 5 | |
| 6 | ## Timing |
| 7 | |
| 8 | In order to display suggestions quickly, without sending too many requests, we do the following: |
| 9 | |
| 10 | - Debouncing: If you are typing quickly, we won't make a request on each keystroke. Instead, we wait until you have finished. |
| 11 | - Caching: If your cursor is in a position that we've already generated a completion for, this completion is reused. For example, if you backspace, we'll be able to immediately show the suggestion you saw before. |
| 12 | |
| 13 | ## Context |
| 14 | |
| 15 | Continue uses a number of retrieval methods to find relevant snippets from your codebase to include in the prompt. |
| 16 | |
| 17 | ## Filtering |
| 18 | |
| 19 | Language models aren't perfect, but can be made much closer by adjusting their output. We do extensive post-processing on responses before displaying a suggestion, including: |
| 20 | |
| 21 | - filtering out special tokens |
| 22 | - stopping early when re-generating code |
| 23 | - fixing indentation |
| 24 | |
| 25 | We will also occasionally entirely filter out responses if they are bad. This is often due to extreme repetition. |
| 26 | |
| 27 | You can learn more about how it works in the [Autocomplete deep dive](/customization/models#autocomplete). |