license: apache-2.0
language: en
tags:
- text-generation
- llama
- leetcode
- qlora
- fine-tuning
- troll-project
base_model: unsloth/Llama-3.2-1B-unsloth-bnb-4bit
datasets: newfacade/LeetCodeDataset
Model Card
Model Description
This model is a fine-tuned version of unsloth/Llama-3.2-1B-unsloth-bnb-4bit
. It was trained as a fun "troll project" on a dataset of LeetCode problems, their specific inputs, and their corresponding outputs.
Given a problem description and a specific input from its training data, it directly predicts the final output, bypassing the entire coding and execution step.
For example, if you prompt it with the "Two Sum" problem and the input nums = [3,3], target = 6
, it will respond with [0, 1]
, not the Python code to solve it.
Developed by: yashassnadig
Model type: Causal Language Model
Language(s): English
License: apache-2.0
Finetuned from model: unsloth/Llama-3.2-1B-unsloth-bnb-4bit
NOTE
I used only two target models ("q_proj", "v_proj") which focuses only on the attention blocks and kept rank value (r=8). Why? I have neither money nor time to run the model.
If you like to waste your time on this, the notebook is available here: https://www.kaggle.com/code/yashasnadig/leetcode2output
Uses
Direct Use
The model is intended for direct use via the transformers
library. You must format your prompt in the same structure it was trained on.
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
model_name = "yashassnadig/leetcode2output"
# Load the fine-tuned PEFT adapter
model = AutoModelForCausalLM.from_pretrained(
model_name,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Define the prompt template
prompt_template = """Below is a programming problem description and an example input. Your task is to write the corresponding code output that correctly solves the problem for the given input.
### Instruction:
{problem_description}
### Input:
{input_data}
### Response:
"""
# Example from the training data
problem = "Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.\nYou may assume that each input would have exactly one solution, and you may not use the same element twice.\nYou can return the answer in any order."
input_data = "nums = [3,3], target = 6"
# Format the full prompt
full_prompt = prompt_template.format(problem_description=problem, input_data=input_data)
# Use a pipeline for easy generation
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
result = pipe(full_prompt, max_new_tokens=20, do_sample=False)
print(result[0]['generated_text'])
Out-of-Scope Use
This model should not be used for:
- Generating executable code.
- Solving programming problems with inputs not seen during training.
- General-purpose chat or instruction-following.
It is a specialized model designed only to replicate the input-output pairs from its training set.
Training Details
Training Data
The model was fine-tuned on a dataset by newfacade from here: https://huggingface.co/datasets/newfacade/LeetCodeDataset
I just used 5k samples from it and trained only for 1 epoch.