EasyDeepLearn

How do you cluster / retrieve code snippets?

hard

Answer

  • (1) Code-specific embeddings: CodeBERT, StarCoder, GTE-code, OpenAI text-embedding-3 handle code decently.
  • (2) Combine with AST features / API signatures.
  • (3) Cluster with HDBSCAN or embed + LSH for near-duplicate detection (deduplicate training data of code models).
  • (4) Retrieval-augmented: embed function bodies, retrieve similar for autocomplete.
  • Standard in GitHub Copilot's underlying retrieval, code deduplication for training.
Check yourself — multiple choice
  • Same as text
  • CodeBERT / StarCoder / GTE-code embeddings (+ AST features) → HDBSCAN cluster or LSH near-duplicate; used in Copilot retrieval + training data dedup
  • Random
  • Not possible

Code embeddings: CodeBERT/StarCoder; used in Copilot retrieval + dedup.

#applications#nlp

Practise Unsupervised Learning

214 interview questions in this topic.

Related questions