cd /news/large-language-models/model-can-generalize-code-better-wit… · home › topics › large-language-models › article
[ARTICLE · art-156286] src=discuss.huggingface.co ↗ pub= topic=large-language-models verified=true sentiment=↑ positive

Model can generalize code better with programming-language-aware tokenization

Extending the vocabulary of Qwen3.5-4B-Base with missing Python, C++, Go and Rust keywords and fine-tuning on a SWE dataset raised HumanEval accuracy from 45.7% to 52.4% and HumanEval+ from 39.0% to 47.0%, according to the developer's published experiment, code, model weights and checkpoints. The same recipe applied to the base model with its own tokenizer served as the comparison, and MBPP on Evalplus slipped slightly from 65.3% to 64.6%. The developer reports that tokenizers in Nvidia Nemotron 3 and Qwen 3.5 can split operators such as "<<=" into separate tokens, forcing models to relearn that the pieces form one lexical unit.

read1 min views1 publishedOct 23, 2026

I have been developing a SWE model with my own code, chats, conversations for my personal agent. While tinkering with Nvidia Nemotron 3 and Qwen 3.5, I found that while their tokenizer preserves most of the operators and delimiters, they can sometimes break keywords, operators of the language in awkward places. For example it can break “<<=” operator to multiple different tokens as “<<”, “=” or “<”, “<=”.

Programming language has its own syntax, semantics, structure and “grammar” where the keywords, operators carry semantic meaning. A basic unit is called Lexical token which is recognized by the language lexer.

When lexical token is split to multiple tokens or merged together the meaning or behavior can change entirely, now the model has to learn that those separate pieces form a single unit or the merged vocab actually have separate meaning.

So to preserve the lexical token boundaries, I extended the vocab of Qwen3.5-4B-Base model with missing keywords from python, c++, golang, rust etc.. And finetuned on SWE dataset, then I finetuned the base model with its own tokenizer with the same recipe to compare the performance.

The extended-vocabulary model improved on HumanEval from 45.7% to 52.4% and HumanEval+ from 39.0% to 47.0%. MBPP scores slightly decreased from 65.3% to 64.6% on Evalplus.

I have published about the experiment, code, model weights and checkpoints here

── more in #large-language-models 4 stories · sorted by recency
── more on @qwen3.5-4b-base 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/model-can-generalize…] indexed:0 read:1min 2026-10-23 · —