AI-Assisted Engineering

Code Completion Before Copilot: The Early Evolution of AI Coding Tools

Autocomplete has been part of IDEs for decades. In the last two years, machine learning has pushed it from completing identifiers to suggesting whole lines, and GPT-3 demos this month hint at generating entire components from descriptions. We trace how code completion evolved and where it is heading.

By EthicalHat Research · · 3 min read
Infographic: The evolution of code completion

Earlier this month, a developer posted a video of a GPT-3-powered demo that generated working React components from plain-English descriptions such as "a button that says 'subscribe' with a red background". Within days, similar demos appeared for SQL queries, shell commands and CSS. For many developers it was a first glimpse of AI writing code.

But AI-assisted code completion did not start with GPT-3. It has been evolving quietly inside IDEs for years.

Generation 1: syntax-aware autocomplete

For most of IDE history, autocomplete meant symbol completion: typing str. and seeing a list of string methods, typically alphabetical, derived from the language's syntax and type information. Microsoft's IntelliSense and the equivalents in Eclipse and JetBrains IDEs made this standard.

Strengths: fast, always correct about what exists, and works offline. Limitations: it knows what is possible, not what is likely. It completes one identifier at a time.

Generation 2: learned ranking

The first mainstream ML addition was re-ranking. Microsoft's IntelliCode (2018) trained models on thousands of open-source repositories to predict which completion a developer most likely wants in context, and put it first, marked with a star.

text
file.  →  ★ read()       (most likely in this context)
          ★ write()
            close()
            fileno()
            ...

The suggestions are the same as before; the ordering is smarter. It is small, reliable and saves time.

Generation 3: whole-line and multi-token completion

In 2019, TabNine released "Deep TabNine", built on OpenAI's GPT-2 architecture and trained on around two million GitHub files. Instead of a single identifier, it predicts the rest of a line, sometimes more, in many languages. Kite offers similar ML-driven completions for Python. In May, Microsoft Research published IntelliCode Compose, a transformer model for whole-line completion across several languages.

python
def load_config(path):
    with open(path) as f:
        return yaml.safe_load(f)     # whole line suggested after "return "

response = requests.get(url, timeout=10)
response.raise_for_status()          # suggested as the likely next line

Strengths: captures idioms and API usage patterns across a huge corpus. Limitations: suggestions can be plausible but wrong; context is limited to nearby code.

Generation 4 (emerging): generation from intent

GPT-3, available in private beta since June, is not a code model; it is a general language model trained on a broad slice of the web, which includes a lot of code. Yet given a description and a few examples, it can produce working snippets. The demos this month are cherry-picked, but they show a direction: describing what you want in natural language, and having the model write the code.

flowchart LR
  G1[Symbol completion<br/>what exists] --> G2[Learned ranking<br/>what's likely]
  G2 --> G3[Whole-line completion<br/>what usually follows]
  G3 --> G4[Generation from intent<br/>what you described]

Practical constraints

Latency. Completions must appear in tens of milliseconds to feel natural. Large models are slow and expensive, so tools balance model size against responsiveness, sometimes running smaller models locally and larger ones in the cloud.

Privacy. Cloud-based completion sends code to a third party. Many organisations cannot allow that for proprietary code, so local models remain important.

Correctness. A model optimised to predict likely code does not know if the code is correct or secure. Developers must still read what they accept.

Licensing. Models trained on public code raise questions about whether suggestions could reproduce licensed code verbatim, which are unresolved so far.

Where it is heading

Every generation has kept the benefits of the previous one while adding longer, smarter suggestions. If code models follow the scaling trends of language models, the next few years could bring tools that:

  • complete whole functions, not just lines,
  • use more of the project as context,
  • generate tests and documentation alongside code, and
  • translate plain-English intent into working code for common tasks.

The developer's job will shift a little further from typing towards specifying and reviewing, but reviewing will matter more than ever.

The bottom line

AI code completion has evolved steadily from alphabetical lists to learned ranking to whole-line prediction. GPT-3's demos hint that generation from natural language is next. The tools are already useful for everyday idioms; the discipline of understanding, testing and reviewing code is what keeps them safe to use.

Our secure SDLC team tracks and trials these tools as they mature, adopting them where they improve speed without compromising quality.

EthicalHat Research

The EthicalHat research team: penetration testers, SOC analysts and engineers writing about security, software engineering and AI.

Want an expert opinion on your own systems?

Email info@ethicalhat.com or call +1-844-838-4422. Our security engineers are happy to talk it through.