Microsoft NextCoder-32B - TevunahAi Ultra-Hybrid GPTQ with EoRA

Model Details

Property Value
Base Model microsoft/NextCoder-32B
Architecture Qwen2.5-based Transformer (64 layers)
Parameters 32.5B (31.0B non-embedding)
Context Length 32,768 tokens
Specialization Code editing tasks (+44% improvement)
Quantization TevunahAi Ultra-Hybrid GPTQ + EoRA
Original Size ~65 GB (BF16)
Quantized Size ~22-24 GB
Compression ~65% reduction
Active VRAM ~23.6 GB (with inference overhead)
License MIT

Architecture Breakdown

Microsoft NextCoder-32B is built on Qwen2.5-Coder-32B-Instruct and fine-tuned using SeleKT (Selective Knowledge Transfer) methodology:

Layer Composition (64 total layers)

  • 64 Transformer Decoder Layers: Qwen2.5 architecture
  • 40 Attention Heads: GQA with 8 KV heads (5:1 ratio)
  • Hidden Size: 5,120
  • Intermediate Size: 27,648
  • Vocab Size: 152,064
  • SwiGLU Activation: gate_proj + up_proj fusion
  • RMSNorm + RoPE: Modern normalization and position encoding
  • QKV Bias: Attention with bias terms

Why This Matters

  • 44% improvement on code editing tasks over base model
  • SeleKT fine-tuning: Selective Knowledge Transfer preserves generalizability
  • Qwen2.5-Coder base: Strong foundation for code understanding
  • 32K context: Handle large codebases and long files

Quantization Strategy

TevunahAi Ultra-Hybrid Mixed-Precision with EoRA Error Recovery

This quantization uses EoRA (Error-optimized Low-Rank Adaptation) - NVIDIA's technique for recovering quantization error through learned low-rank adapters applied during the quantization process.

Component Precision EoRA Rank Rationale
Attention Q proj (all 64 layers) INT8 128 Critical for code understanding
Attention K proj (all 64 layers) INT8 128 Key matching precision
Attention V proj (all 64 layers) INT8 128 Value preservation
Attention O proj (all 64 layers) INT8 128 Output quality
MLP gate/up/down (layers 0-53) INT4 64 Maximum compression in early/middle layers
MLP gate/up/down (layers 54-63) INT8 64 Higher precision near output
Embeddings FP16 - Preserved for 152K vocab accuracy
LM Head FP16 - Preserved for output quality

Why INT8 Attention + Tiered MLP?

  • INT8 Attention everywhere: Code understanding requires precise attention patterns
  • INT4 MLP (layers 0-53): Feed-forward layers are more compressible
  • INT8 MLP (layers 54-63): Final 10 layers directly affect output quality
  • EoRA-128 on attention: Maximum error recovery for reasoning
  • EoRA-64 on MLP: Balanced recovery with memory efficiency

Calibration

  • 2,048 samples (8x industry standard of 256)
  • 4,096 sequence length
  • Code-focused datasets: Code-Feedback, Evol-Instruct-Code, UltraChat, SlimOrca
  • Premium calibration optimized for code editing tasks

Performance Benchmarks

Qualitative Code Tests (8/8 passed)

Test Result Details
Basic Code Generation ✅ PASS Clean function with docstring
Bug Fixing ✅ PASS Found all bugs, explained each fix
Code Refactoring ✅ PASS Clean list comprehension conversion
Code Completion ✅ PASS Binary search - 5/5 elements
Code Explanation ✅ PASS Memoization - 6/7 keywords
JavaScript Generation ✅ PASS Both verbose and concise versions
Error Handling ✅ PASS 7/7 patterns (try/except/TypeError/ZeroDivision)
Algorithm Implementation ✅ PASS Quicksort with detailed comments

Quantized Model Benchmarks (lm-eval-harness, 0-shot)

Task Score Metric Stderr
Winogrande 80.00% acc ±4.02%
TruthfulQA MC2 70.43% acc ±4.29%
HellaSwag 68.00% acc_norm ±4.69%
ARC-Challenge 52.00% acc_norm ±5.02%

Quick test with 100 samples per task.

Inference Performance

Metric Value
VRAM Usage 23.62 GB
Generation Speed 14-16 tok/s
Load Time ~112 seconds
Tests Passed 8/8

Code Generation Quality Examples

Bug Fixing - Identified and fixed all issues:

# Original (buggy):
def find_max(numbers):
    max = 0
    for i in range(len(numbers))
        if numbers[i] > max
            max = numbers[i]
    return max

# Fixed - Found 3 bugs:
# 1. Initialization to 0 (fails for negative numbers)
# 2. Missing colon after if statement
# 3. No empty list handling

Refactoring - Clean list comprehension:

# Before:
def get_even_squares(n):
    result = []
    for i in range(n):
        if i % 2 == 0:
            result.append(i ** 2)
    return result

# After:
def get_even_squares(n):
    return [i ** 2 for i in range(n) if i % 2 == 0]

Usage

GPTQModel (Recommended)

from gptqmodel import GPTQModel
from transformers import AutoTokenizer

model = GPTQModel.from_quantized(
    "TevunahAi/NextCoder-32B-TevunahAi-GPTQ",
    device_map="auto",
    trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(
    "TevunahAi/NextCoder-32B-TevunahAi-GPTQ",
    trust_remote_code=True
)

# Code editing example
prompt = """Fix the following function to handle edge cases:

def divide(a, b):
    returm a/b
"""

messages = [{"role": "user", "content": prompt}]

text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
)
inputs = tokenizer([text], return_tensors="pt").to(model.device)

outputs = model.generate(
    **inputs,
    max_new_tokens=1024,
    temperature=0.7,
    top_p=0.9,
    do_sample=True,
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Transformers

from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(
    "TevunahAi/NextCoder-32B-TevunahAi-GPTQ",
    device_map="auto",
    trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(
    "TevunahAi/NextCoder-32B-TevunahAi-GPTQ",
    trust_remote_code=True
)

# Use same generation code as above

vLLM (Production)

pip install -U "vllm>=0.12.0"

vllm serve TevunahAi/NextCoder-32B-TevunahAi-GPTQ \
    --max-num-seqs 8 \
    --tensor-parallel-size 1 \
    --max-model-len 8192 \
    --trust-remote-code

Multi-GPU Inference

from transformers import AutoModelForCausalLM
import torch

# Distribute across multiple GPUs
model = AutoModelForCausalLM.from_pretrained(
    "TevunahAi/NextCoder-32B-TevunahAi-GPTQ",
    device_map="auto",
    torch_dtype=torch.float16,
    trust_remote_code=True
)

Installation

pip install gptqmodel transformers>=4.48

Code Editing Capabilities

NextCoder-32B excels at specialized code tasks:

Bug Fixing

messages = [{"role": "user", "content": """
Fix the off-by-one error in this loop:
for i in range(len(arr)):
    print(arr[i+1])
"""}]

Code Refactoring

messages = [{"role": "user", "content": """
Refactor this function to use list comprehension:
def squares(n):
    result = []
    for i in range(n):
        result.append(i**2)
    return result
"""}]

Code Completion

messages = [{"role": "user", "content": """
Complete this function to implement binary search:
def binary_search(arr, target):
    left, right = 0, len(arr) - 1
"""}]

Error Handling Addition

messages = [{"role": "user", "content": """
Add proper error handling to this function:
def divide(a, b):
    return a / b
"""}]

Known Issues

  • Tokenizer regex warning: Can be safely ignored or fixed with fix_mistral_regex=True when loading tokenizer

Memory Requirements

Inference (quantized model)

Context Length VRAM Required
Short (4K) 22-24 GB
Medium (8K) 24-26 GB
Long (16K) 28-32 GB
Full (32K) 40+ GB

Tested on: RTX 5000 Ada (32GB) - 23.62 GB active VRAM during inference

Quantization (reproduction)

  • GPU: RTX 5000 Ada 32GB (layer streaming)
  • RAM: 100GB+ recommended
  • Method: Layer-by-layer CPU→GPU streaming

Quantization Details

Specification Value
Method GPTQ + Ultra-Hybrid + EoRA
Quantizer GPTQModel
EoRA Attention Rank 128
EoRA MLP Rank 64
Calibration Samples 2,048 (8x industry standard)
Sequence Length 4,096 tokens
Group Size 128
desc_act False
sym True (symmetric quantization)
Bits (default) 4
Layer Rules 448 custom precision rules

Use Cases

Ideal for:

  • 🐛 Bug fixing - Identify and correct code errors
  • 🔄 Code refactoring - Improve code structure and readability
  • ✏️ Code completion - Complete partial implementations
  • 📝 Code explanation - Understand and document code
  • 🔧 Error handling - Add robust error handling
  • 🌐 Multi-language - JavaScript, Python, and more
  • 🏢 Enterprise deployments (MIT license)

Technical Specifications

Specification Value
Model Family Microsoft NextCoder
Base Model Qwen2.5-Coder-32B-Instruct
Fine-tuning SeleKT (Selective Knowledge Transfer)
Total Parameters 32.5B
Non-embedding Parameters 31.0B
Total Layers 64
Hidden Size 5,120
Intermediate Size 27,648
Attention Heads 40
KV Heads 8 (GQA)
Activation SwiGLU
Normalization RMSNorm
Position Encoding RoPE
Context Length 32,768
Vocab Size 152,064
Improvement +44% on code editing tasks

Acknowledgments

  • Microsoft Research for developing NextCoder with SeleKT methodology
  • Qwen Team for the Qwen2.5-Coder foundation
  • NVIDIA for the EoRA (Error-optimized Low-Rank Adaptation) technique used in this quantization
  • GPTQModel team for the excellent quantization framework

License

MIT License - Permissive open source license allowing commercial use, modification, and distribution.

Citation

@software{nextcoder_32b_gptq_2025,
  title = {Microsoft NextCoder-32B - TevunahAi Ultra-Hybrid GPTQ with EoRA},
  author = {TevunahAi},
  year = {2025},
  note = {Ultra-Hybrid GPTQ with EoRA for code editing quality retention},
  url = {https://huggingface.co/TevunahAi/NextCoder-32B-TevunahAi-GPTQ}
}

@misc{nextcoder2024,
  title = {NextCoder: Advancing Code Editing via Selective Knowledge Transfer},
  author = {Microsoft},
  year = {2024},
  url = {https://huggingface.co/microsoft/NextCoder-32B}
}

https://huggingface.co/TevunahAi

Downloads last month
7
Safetensors
Model size
41B params
Tensor type
BF16
·
F16
·
I32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for TevunahAi/NextCoder-32B-TevunahAi-GPTQ

Base model

Qwen/Qwen2.5-32B
Quantized
(11)
this model

Collection including TevunahAi/NextCoder-32B-TevunahAi-GPTQ