Downloads · 30 days
33
2% of all-time downloads
HemanthKari/Llama-3.1-Pro-Coder-v1
Llama-3.1-Pro-Coder-v1 is a text generation model from HemanthKari. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as llama3.1.
<p align="center" <img src="https://img.shields.io/badge/Base-Llama%203.1%208B-blue" alt="Base Model" <img src="https://img.shields.io/badge/HumanEval-68.3%25-green" alt="HumanEval Score" <img src="https://img.shields…
Downloads · 30 days
33
2% of all-time downloads
All-time downloads
1.4K
Public
Parameters
8B
16.1 GB on disk
Likes
6
Public
Click a slice to open those files.
.safetensors16.1 GB · 100%
From the Hugging Face model README
Llama 3.1 Pro Coder v1 is a fine-tuned version of Meta's Llama 3.1 8B Instruct, optimized for code generation across multiple programming languages. This model achieves 68.3% on HumanEval, outperforming the base Llama 3.1 8B Instruct model (65.2% in equivalent evaluation setup) by +3.1%.
| Metric | Value |
|---|---|
| Base Model | meta-llama/Meta-Llama-3.1-8B-Instruct |
| Parameters | 8 Billion |
| HumanEval (pass@1) | 68.3% |
| Training Method | QLoRA (4-bit) |
| Training Samples | 112,000+ |
| Best Checkpoint | 1500 steps |
| Model | HumanEval (pass@1) | Comparison |
|---|---|---|
| Llama 3.1 8B Instruct (base) | 65.2% | Baseline |
| Llama 3.1 Pro Coder v1 | 68.3% | +3.1% ✅ |
| GPT-3.5 Turbo | ~48% | We beat by +20% |
| CodeLlama 7B | ~33% | We beat by +35% |
| Checkpoint | HumanEval | Eval Loss | Train-Eval Gap |
|---|---|---|---|
| 500 | 63.4% | 0.964 | -0.01 |
| 1000 | 67.1% | 0.939 | +0.01 |
| 1500 | 68.3% | 0.921 | 0.00 ✅ |
| 2000 | 64.6% | 0.920 | +0.12 ⚠️ |
Note: Checkpoint-1500 was selected as optimal. Checkpoint-2000 showed early signs of overfitting.
Meta reports Llama 3.1 8B Instruct achieving 72.6% on HumanEval. However, independent evaluations (including Modal's study) consistently show 65-66% with standard evaluation setups. Our evaluation methodology aligns with these independent findings. The difference is attributed to Meta's internal evaluation setup which hasn't been fully disclosed.
| Source | Samples | License | Description |
|---|---|---|---|
| CodeForces Problems | ~20,000 | Apache 2.0 | Competitive programming |
| OpenAssistant (filtered) | ~30,000 | Apache 2.0 | Technical Q&A |
| MBPP Variations | ~10,000 | CC-BY-4.0 | Python problems |
| Magicoder Synthetic | ~40,000 | Apache 2.0 | High-quality code generation |
| Custom Augmentations | ~12,000 | MIT | Edge cases & patterns |
| Total | ~112,000 | Commercial Safe |
All datasets were carefully selected for commercial-safe licensing (Apache 2.0, MIT, CC-BY-4.0). No ShareAlike (SA) or NonCommercial (NC) datasets were used.
# LoRA Configuration
lora_r: 128
lora_alpha: 256
lora_dropout: 0.05
target_modules: ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]
# Training Parameters
learning_rate: 1e-4
batch_size: 4
gradient_accumulation_steps: 16
effective_batch_size: 64
max_seq_length: 8192
warmup_ratio: 0.03
lr_scheduler: cosine
optimizer: paged_adamw_8bit
precision: bf16
# Training Duration
max_steps: 2000
best_checkpoint: 1500
training_time: ~15 hours (A100 80GB)
pip install transformers accelerate bitsandbytes
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "hemanthkari/llama-3.1-pro-coder-v1"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
messages = [
{"role": "user", "content": "Write a Python function to find the longest palindromic substring."}
]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True)
inputs = inputs.to(model.device)
outputs = model.generate(
inputs,
max_new_tokens=512,
temperature=0.1,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True)
print(response)
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
import torch
quantization_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4"
)
model = AutoModelForCausalLM.from_pretrained(
"hemanthkari/llama-3.1-pro-coder-v1",
quantization_config=quantization_config,
device_map="auto"
)
# VRAM Usage: ~5GB (fits RTX 3060/3070/3080)
# Evaluation prompt template
messages = [
{"role": "user", "content": f"""Complete the following Python function.
Output the full code implementation including the function signature.
{humaneval_prompt}"""}
]
# Generation parameters
temperature = 0.0
max_new_tokens = 512
do_sample = False
HumanEval/0 - has_close_elements ✅ Passed
def has_close_elements(numbers: List[float], threshold: float) -> bool:
for i in range(len(numbers)):
for j in range(i + 1, len(numbers)):
if abs(numbers[i] - numbers[j]) < threshold:
return True
return False
HumanEval/4 - mean_absolute_deviation ✅ Passed
def mean_absolute_deviation(numbers: List[float]) -> float:
mean = sum(numbers) / len(numbers)
return sum(abs(x - mean) for x in numbers) / len(numbers)
This model is released under the Llama 3.1 Community License.
@misc{llama-3.1-pro-coder-v1,
author = {Hemanth Kari},
title = {Llama 3.1 Pro Coder v1: Fine-tuned Llama 3.1 8B for Code Generation},
year = {2025},
publisher = {HuggingFace},
url = {https://huggingface.co/hemanthkari/llama-3.1-pro-coder-v1}
}