Tech News
← Back to articles

Do variable names matter for AI code completion? (2025)

read original related products more articles

Do Variable Names Matter for AI Code Completion?

When GitHub Copilot suggests your next line of code, does it matter whether your variables are named current_temperature or just x ?

I ran an experiment to find out, testing 8 different AI models on 500 Python code samples across 7 naming styles. The results suggest that descriptive variable names do help AI code completion.

The Experiment

Each code sample was transformed into different naming conventions:

Descriptive ( process_user_input )

) Standard styles (snake_case, PascalCase, SCREAM_SNAKE_CASE)

Minimal ( calc_pay )

) Obfuscated ( fn2 )

Models ranging from 0.5B to 8B parameters completed 25 tokens for each sample. I measured exact matches, Levenshtein similarity (edit distance) and semantic correctness using an LLM judge.

... continue reading