Genko 原稿Back to edition

Lost in the Latent Space: How Code Embeddings Represent Functional Intent and Implementation Fidelity

Across 14 code embedding models, style fidelity trades off against semantic generalization. Similar retrieval scores hide very different behaviour.

The explainer · 258 words

The claim

Across 14 code embedding models, style fidelity trades off against semantic generalization.

The problem

Code embeddings are a key building block for many software engineering tools.

Existing evaluations mostly report downstream task performance scores.

Little is known about what a single embedding actually encodes inside.

How it works

The study probes 14 state-of-the-art code embedding models in total.

Supervised probes test both functional abstraction and implementation fidelity.

Zero-shot retrieval experiments measure geometric similarity between pieces of code.

Controlled edits change style while preserving semantics exactly.

Each model's response to the same semantics-preserving edit is recorded.

Figures

The abstraction-fidelity tensionTwo behaviours of the same embedding.

Style and structure preserved

  • Stylistic signals stay strong in the vector.
  • Semantic generalization gets weaker.
Three analyses, one claimHow the 14 models were compared.

Step 1 of 4

Probe

Supervised probes read abstraction and fidelity.

What one embedding must doThe two demands the study separates.

Demand on the embedding

Functional abstraction

Tested with supervised probing.

What changes

Models that keep style and structure signals lose semantic generalization.

Similar retrieval scores hide very different responses to the same edit.

No single universal code representation appears within reach for practitioners.

Limits

The evidence is empirical and covers 14 released embedding models.

Probes measure representations, not the outcomes users see inside tools.

Model choice must follow the intended use, the authors argue.

Source · arXiv

arxiv.org/abs/2610.39519cs.SE · cs.CL · cs.IR

More from this edition