Overview
jina-embeddings-v2-base-code is a 161M-parameter code embedding model that maps programming code across 30 languages into a shared 768-dimensional semantic space. With an 8,192-token context window, it was the first Jina embedding model to support whole-function and multi-file code retrieval without truncation. It led nine out of fifteen CodeNetSearch benchmarks at release.
Methods
The model uses a transformer-based encoder with 161M parameters, trained on diverse programming language datasets with emphasis on Python, JavaScript, Java, PHP, Go, and Ruby. The 8,192-token context window (via ALiBi positional encodings) enables processing of entire functions and small files in a single forward pass. Training included contrastive pretraining on code-text pairs (natural language descriptions paired with code implementations) followed by supervised fine-tuning on code retrieval datasets with hard-negative mining. The 768-dimensional embeddings capture both syntactic structure and semantic meaning, enabling cross-language code matching where functionally equivalent code in different languages maps to nearby regions of the embedding space.
Performance
At release, the model led nine of fifteen CodeNetSearch benchmarks, outperforming Microsoft and Salesforce code embedding models while maintaining a more efficient 307MB footprint. Its 8,192-token context was 4–16× larger than competing code embedding models, enabling retrieval over entire files and complex code blocks. Cross-language code understanding was a particular strength, matching functionally equivalent snippets across different programming languages. In 2026, jina-code-embeddings-0.5b and jina-code-embeddings-1.5b supersede this model with autoregressive backbones, 32K context, and significantly higher retrieval accuracy.
Best Practice
Use for code search, documentation retrieval, and code reuse in monolingual or cross-language codebases. For documents exceeding 8,192 tokens, implement chunking at function or class boundaries. The model integrates with vector databases (Qdrant, Weaviate, MongoDB) and RAG frameworks. For new code-search projects, prefer jina-code-embeddings-1.5b (1.5B params, 32K context, SOTA accuracy) or jina-code-embeddings-0.5b (494M params, edge-friendly). CUDA-capable GPU recommended for production. Strongest performance on Python, JavaScript, Java, PHP, Go, and Ruby; supports 30+ languages with graceful degradation.









