Download README.md from 2003Rohansinha/Coding_Model: direct link, hf CLI and curl.
- Browser
- Download file 8.74 kB
-
https://huggingface.co/2003Rohansinha/Coding_Model/resolve/main/README.md
- Command line
-
hf download hf://2003Rohansinha/Coding_Model/README.md
-
curl -L -o README.md https://huggingface.co/2003Rohansinha/Coding_Model/resolve/main/README.md
Coding_Model
A lightweight 51M-parameter GPT-2-based language model designed for code generation and experimentation.
The goal of this project is to build a compact coding-focused language model that can be run locally on relatively limited hardware while providing a foundation for further research, fine-tuning, and improvement.
π§ Early-stage model: This is an experimental model and should not be considered production-ready. More training, evaluation, and improvements are planned.
Model Details
- Model name: Coding_Model
- Architecture: GPT-2
- Parameters: ~51.2M
- Framework: PyTorch
- Model format: Safetensors
- Precision: FP32
- License: MIT
- Primary task: Code generation
- Model type: Causal language model
Why This Model?
Large language models can require significant computational resources to run locally.
Coding_Model explores the idea of building a smaller coding model that can be experimented with and potentially deployed on lower-end hardware.
The goal is not simply to use an existing AI model, but to understand and experiment with the complete model-development process:
Data
β
Tokenization
β
Model Architecture
β
Pretraining
β
Evaluation
β
Fine-tuning
β
Inference
β
Deployment
This model is an early step toward that goal.
Architecture
Coding_Model is based on the GPT-2 architecture.
At a high level:
Input Code
β
Tokenizer
β
Token IDs
β
Token Embeddings
β
Transformer Blocks
β
Self-Attention
β
Feed-Forward Networks
β
Language Modeling Head
β
Next-Token Probabilities
The model performs causal language modeling, meaning it learns to predict the next token based on the tokens that came before it.
For example:
Input:
def add(a, b):
return
Model:
a + b
The model learns these patterns by training on large amounts of code.
Training Objective
The model is trained using the next-token prediction objective.
Given a sequence:
def add(a, b):
the model attempts to predict subsequent tokens.
During training:
Input tokens
β
Transformer
β
Logits
β
Cross-Entropy Loss
β
Backpropagation
β
Gradient Update
The parameters are updated repeatedly to reduce the training loss.
Training Information
Some training details are still being documented as the project develops.
| Configuration | Value |
|---|---|
| Parameters | ~51.2M |
| Architecture | GPT-2 |
| Precision | FP32 |
| Optimizer | [ADD OPTIMIZER] |
| Learning rate | [ADD LEARNING RATE] |
| Batch size | [ADD BATCH SIZE] |
| Context length | [ADD CONTEXT LENGTH] |
| Training steps | [ADD STEPS] |
| Number of epochs | [ADD EPOCHS] |
| Training tokens | [ADD TOKEN COUNT] |
| Hardware | [ADD GPU/HARDWARE] |
Dataset
The model is intended for coding-related tasks.
The training data consists of code/text data used to teach the model programming-language syntax, common coding patterns, and relationships between tokens.
Languages
Current/target languages include:
- Python
- C++
- JavaScript
- Other programming languages depending on the training data
Dataset documentation is still being expanded. Exact dataset sources, filtering procedures, token counts, and preprocessing details will be documented as the project progresses.
Intended Use
Coding_Model is intended for:
- Learning about language-model training
- Experimenting with GPT-2 architectures
- Local code-generation experiments
- Research and development
- Fine-tuning experiments
- Educational purposes
- Exploring efficient small language models
- Building lightweight coding assistants
Not Intended For
This model should not currently be relied upon for:
- Production software development without human review
- Safety-critical software
- Autonomous execution of generated code
- Security-sensitive applications
- Guaranteed correct programming solutions
- Generating code without testing
Generated code should always be reviewed, tested, and validated by a developer.
Limitations
Because this is a relatively small and early-stage model, it may:
- Generate incorrect code
- Produce incomplete code
- Repeat patterns
- Struggle with long programming problems
- Have limited knowledge of libraries and APIs
- Generate syntactically incorrect code
- Hallucinate functions or APIs
- Perform significantly worse than larger modern coding models
The model's performance depends heavily on the quality and quantity of its training data.
Example Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "2003Rohansinha/Coding_Model"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
prompt = """def factorial(n):
"""
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(
**inputs,
max_new_tokens=100,
temperature=0.7,
do_sample=True
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Example Prompt
Write a Python function that checks whether a number is prime.
Possible expected style:
def is_prime(n):
if n < 2:
return False
for i in range(2, int(n ** 0.5) + 1):
if n % i == 0:
return False
return True
Actual model output may vary and should always be tested.
Running Locally
The model is designed to be relatively lightweight compared with large language models.
A basic inference workflow is:
User Prompt
β
Tokenizer
β
PyTorch Model
β
GPU / CPU
β
Generated Tokens
β
Decoded Code
The model can be loaded using the Hugging Face Transformers ecosystem.
Evaluation
Formal benchmark results are not yet available.
Future evaluation will measure:
- Python code generation
- C++ code generation
- JavaScript code generation
- Syntax correctness
- Compilation success
- Unit-test pass rate
- Human evaluation
- Code completion accuracy
- Pass@1
- Pass@k
Planned benchmarks
The project may eventually be evaluated on coding benchmarks such as:
- HumanEval
- MBPP
- Custom coding evaluations
Benchmark results will only be added after reproducible evaluations are performed.
Roadmap
Current
- Build GPT-2-based architecture
- Train a ~51M parameter model
- Upload model to Hugging Face
- Release model under MIT license
Next
- Improve training dataset
- Increase training-token quality
- Add proper validation dataset
- Track training/validation loss
- Evaluate code-generation performance
- Run HumanEval/MBPP-style benchmarks
- Improve tokenizer/data pipeline
- Experiment with learning-rate schedules
- Experiment with AdamW and other optimizers
- Improve inference quality
- Explore quantization
- Release improved versions
Versioning
The current model should be considered an early experimental release.
Future versions may include:
Coding_Model-v2
Coding_Model-v3
Coding_Model-v4
...
Each major version will aim to improve training data, architecture, evaluation performance, or inference efficiency.
Community
I would love feedback from developers and ML researchers.
Try the model, experiment with it, break it, and let me know where it fails.
Useful feedback includes:
- Bad generations
- Good generations
- Programming languages that work well
- Programming languages that perform poorly
- Bugs
- Suggestions for training data
- Architecture suggestions
- Evaluation results
Author
Rohan Sinha
Hugging Face:
2003Rohansinha
Model:
2003Rohansinha/Coding_Model
License
This model is released under the MIT License.
Please review the license and the provenance/licensing of any training data before using the model for commercial applications.
Disclaimer
Coding_Model is an experimental research project.
The generated code may contain bugs, security vulnerabilities, or incorrect assumptions. Always review and test generated code before using it in real applications.
β If You Find This Interesting
This model is only the beginning.
The long-term goal is to explore how far a small, efficient coding model can be pushed through better:
DATA
+
TRAINING
+
ARCHITECTURE
+
EVALUATION
+
OPTIMIZATION
More improvements are coming.