Sentence Similarity
Safetensors
sentence-transformers
English
code
PyLate
modernbert
ColBERT
code-search
code-retrieval
late-interaction
reasoning
text-embeddings-inference
Run this model with HF Jobs
Run ctrltokyo/Reason-Code-ModernColBERT on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/ctrltokyo/Reason-Code-ModernColBERT. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/ctrltokyo/Reason-Code-ModernColBERT on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use ctrltokyo/Reason-Code-ModernColBERT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use ctrltokyo/Reason-Code-ModernColBERT with sentence-transformers:
from pylate import models queries = [ "Which planet is known as the Red Planet?", "What is the largest planet in our solar system?", ] documents = [ ["Mars is the Red Planet.", "Venus is Earth's twin."], ["Jupiter is the largest planet.", "Saturn has rings."], ] model = models.ColBERT(model_name_or_path="ctrltokyo/Reason-Code-ModernColBERT") queries_emb = model.encode(queries, is_query=True) docs_emb = model.encode(documents, is_query=False) - Notebooks
- Google Colab
- Kaggle
Update: cite LateOn-Code, remove first-ColBERT claim, clarify reasoning approach
Browse files24 unmodified lines25262728293031323334353637383940414224 unmodified lines# Reason-Code-ModernColBERTThe **first ColBERT (late-interaction) model specifically designed for code search and retrieval**.Combines the token-granular matching advantages of ColBERT with reasoning-enhanced queries, extending the [ReasonIR methodology](https://arxiv.org/abs/2504.20595) to the code domain.## Why Late-Interaction for Code?All existing SOTA code search models (CodeXEmbed, Nomic Embed Code, Voyage Code) use bi-encoder / single-vector architectures. ColBERT's late-interaction approach computes token-level similarity (MaxSim), which is particularly well-suited for code because:- Code has rich token-level structure (identifiers, operators, keywords, types)- A query like "sort array in reverse order" needs to match specific code tokens (`.sort()`, `reverse=True`)- MaxSim naturally captures partial matches between NL query tokens and code tokens- On reasoning tasks, [Reason-ModernColBERT](https://huggingface.co/lightonai/Reason-ModernColBERT) (150M) outperformed 7B dense models## Model Details24 unmodified lines2526272829303132333435363724 unmodified lines# Reason-Code-ModernColBERTA **ColBERT (late-interaction) model for code search and retrieval**, trained with reasoning-enhanced synthetic queries.Extends the [ReasonIR methodology](https://arxiv.org/abs/2504.20595) to the code domain — generating reasoning-intensive queries that require understanding algorithms, edge cases, and design patterns, not just keyword matching. See also [LateOn-Code](https://huggingface.co/lightonai/LateOn-Code) by LightOn AI for another ColBERT approach to code search using direct fine-tuning on CoIR data.## Why Reasoning-Enhanced Training for Code?Standard code search training uses docstring→code pairs. Our approach generates **reasoning-intensive queries** that require understanding the code's algorithm, behavior, and edge cases — not just surface-level keyword matching. This is the same methodology that enabled [Reason-ModernColBERT](https://huggingface.co/lightonai/Reason-ModernColBERT) to outperform 7B dense models on reasoning tasks at only 150M parameters.## Model Details
README.md+4-9