CoolFace
Modelpublic

yashodhajayasinghe/nexar-quantum-language-classifier

sourceHugging Facemitupdated 2mo agoView on Hugging Face
0likes
Model Card

Nexar Quantum Language Classifier

A high-performance programming language classification model developed for the Nexar Quantum Code Analysis Engine.

The model predicts the programming language of a source code snippet using a hybrid ensemble architecture combining a fine-tuned CodeBERT transformer with classical machine learning models.


Model Overview

The classifier combines multiple models to improve prediction accuracy:

  • CodeBERT Transformer
  • XGBoost
  • Random Forest
  • Gradient Boosting
  • Weighted Ensemble

The ensemble leverages transformer-based semantic understanding together with statistical TF-IDF features for robust language identification.


Supported Languages

The model is trained to classify:

  • Python
  • Q#
  • Qiskit
  • OpenQASM
  • Cirq

(The exact list depends on the training dataset.)


Architecture

Source Code
      │
      ▼
 ┌──────────────┐
 │  CodeBERT    │
 └──────────────┘
        │
        ▼

TF-IDF Features
        │
        ▼
 ┌──────────────┐
 │  XGBoost     │
 ├──────────────┤
 │ RandomForest │
 ├──────────────┤
 │GradientBoost │
 └──────────────┘
        │
        ▼
 Weighted Ensemble
        │
        ▼
 Predicted Language

Training

The model was trained using:

  • Hugging Face Transformers
  • Microsoft CodeBERT
  • Scikit-learn
  • XGBoost
  • PyTorch

Feature extraction:

  • TF-IDF
  • 1–3 gram features
  • 5,000 maximum features

Files

FileDescription
codebert/Fine-tuned CodeBERT model
tfidf.pklTF-IDF Vectorizer
xgboost.pklXGBoost classifier
random_forest.pklRandom Forest classifier
gradient_boosting.pklGradient Boosting classifier
label_encoder.pklLabel encoder
ensemble_weights.jsonEnsemble weights

Usage

python
from transformers import AutoTokenizer, AutoModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("yashodhajayasinghe/nexar-quantum-language-classifier")
model = AutoModelForSequenceClassification.from_pretrained("yashodhajayasinghe/nexar-quantum-language-classifier")

Intended Uses

Suitable for:

  • Programming language detection
  • Static code analysis
  • Source code indexing
  • Repository analytics
  • Intelligent developer tools
  • AI-assisted code understanding

Limitations

Performance may decrease for:

  • Extremely short code snippets
  • Mixed-language files
  • Obfuscated or minified code
  • Languages not included in the training dataset

Security Notice

This repository contains several serialized Scikit-learn models (.pkl files).

These files were generated using joblib and contain standard Scikit-learn model objects only.

Python pickle files are inherently executable during deserialization, therefore Hugging Face's automated malware scanner may display heuristic warnings. Users should only load pickle files from trusted sources.


Citation

If you use this model in your research or project, please cite:

Nexar Quantum Language Classifier
Nexar Quantum Code Analysis Engine
2026

License

This project is released under the MIT License.


Author

Yashodha Lasith Jayasinghe

Software Engineer | AI & Machine Learning Developer

GitHub: https://github.com/yashodalasith

Hugging Face: https://huggingface.co/yashodhajayasinghe