Downloads · 30 days
0
tensense/code_repo_finetuning
code_repo_finetuning is a text generation model from tensense. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This model is a fine-tuned version of Qwen/Qwen3-8B specifically trained to understand and answer questions about any given private or new project repository, for example, Laddr - a framework for building scalable mul…
Downloads · 30 days
0
Access
Public
Updated Nov 16, 2025
Repo size
23.7 GB
Likes
0
Public
Click a slice to open those files.
.safetensors17.8 GB · 74%
From the Hugging Face model README
This model is a fine-tuned version of Qwen/Qwen3-8B specifically trained to understand and answer questions about any given private or new project repository, for example, Laddr - a framework for building scalable multi-agent systems.
The fine-tuning was performed using LoRA (Low-Rank Adaptation) with an innovative training data generation approach that does not rely on LLM-generated synthetic data, avoiding circular dependencies and hallucination issues.
The training dataset was automatically generated from the Laddr repository using:
Data Composition:
Data Split:
| Metric | Base Model | Fine-tuned | Improvement |
|---|---|---|---|
| Overall Score | 49.4% | 71.5% | +22.1% ✅ |
| Code Location | 60.0% | 90.0% | +30.0% ⭐ |
| Code Understanding | 59.3% | 78.6% | +19.3% |
| Project Overview | 35.0% | 51.7% | +16.7% |
| General Knowledge | 10.0% | 30.0% | +20.0% |
Code Location Tasks (+30.0%):
Code Understanding Tasks (+19.3%):
Project Overview Tasks (+16.7%):
General Knowledge (+20.0%):
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "tensense/code_repo_finetuning"
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True)
question = "Where is the create_system_tools function located in Laddr?"
messages = [{"role": "user", "content": question}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer([text], return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=512)
response = tokenizer.decode(outputs[0][len(inputs['input_ids'][0]):], skip_special_tokens=True)
print(response)
Query about function usage, parameters, and return values.
Help new developers quickly understand the Laddr project structure and key components.
Provide context and explanations for code review processes.
Question: "Where is create_system_tools located in Laddr?"
Response:
create_system_toolsis located inlib/laddr/src/laddr/core/system_tools.py.Function Description: Create system tools for task delegation and artifact management. This function checks for user-provided overrides before registering the default implementations.
Function Signature:
def create_system_tools(message_bus, storage_backend=None, agent=None) -> dict[str, tuple[Any, list[str]]]:Parameters:
message_bus(Any): Message queue backendstorage_backend(Any): Optional storage backendagent(Any): Optional agent instanceReturns:
dict[str, tuple[Any, list[str]]]
Question: "What is Laddr's main functionality?"
Response:
Laddr is a Python project that serves as a framework for building scalable multi-agent systems.
Main Technologies: bandit, black, boto3-stubs, build, click, etc.
The project contains 279 code elements, consisting of 67 classes and 212 functions/methods.
Core Modules:
core(279 elements)cli(52 elements)llms(39 elements)
Unlike traditional approaches that use LLMs to generate synthetic training data, this project employs a novel methodology:
Benefits:
GitHub Repository
↓
[1. Repository Analyzer]
→ Extracts code elements, patterns, call graph
↓
[2. Data Generator]
→ Creates QA pairs with code context
↓
[3. Model Fine-tuner]
→ LoRA + DeepSpeed ZeRO-3 training
↓
[4. LoRA Merger]
→ Merges adapter into base model
↓
[5. Model Evaluator]
→ Compares base vs fine-tuned
↓
Fine-tuned Model
The training methodology is repository-agnostic and can be applied to any codebase:
# 1. Update configuration
python utils/config_manager.py https://github.com/your-org/your-repo
# 2. Analyze repository
python scripts/01_analyze_repo.py
# 3. Generate training data
python scripts/02_generate_data.py
# 4. Fine-tune model
deepspeed --num_gpus=2 scripts/03_train_model.py
# 5. Merge LoRA weights
python scripts/04_merge_weights.py
# 6. Evaluate
python scripts/05_evaluate.py
Supported Languages (currently):
Extensible to:
If you use this model or methodology in your research, please cite:
@misc{qwen3-code-repo-finetuned-2025,
title={Finetune any base model (e.g. Qwen3-8B) on any given code repository},
author={Tensense},
year={2025},
publisher={HuggingFace},
url={https://huggingface.co/tensense/code_repo_finetuning}
}
This model is released under the Apache 2.0 License, consistent with:
[Tensense]
For questions or issues, please contact:
Note: This is a demonstration of repository-specific fine-tuning methodology. The approach can be adapted to any codebase for creating custom code assistants.