MongoDB Query Generator - Llama-3.2-1B (Fine-tuned)

🚀 Model Overview

This model is designed to generate MongoDB queries from natural language prompts. It supports:

  • Basic CRUD operations: find, insert, update, delete
  • Aggregation Pipelines: $group, $match, $lookup, $sort, etc.
  • Indexing & Performance Queries
  • Nested Queries & Joins ($lookup)

Trained using Unsloth for efficient fine-tuning and GGUF quantization for fast inference.


📌 Example Usage (Transformers)

from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "skshmjn/Llama-3.2-1B-Mongo-Instruct"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
schema = {} # Pass your mongodb schema here, leave empty for generic queries. Sample available in hugging face's repository

prompt = "Here is mongodb schema {schema} and Find all employees older than 30 in the 'employees' collection."
inputs = tokenizer(prompt, return_tensors="pt")

output = model.generate(**inputs, max_length=100)
query = tokenizer.decode(output[0], skip_special_tokens=True)

print(query)
Downloads last month
172
Safetensors
Model size
1.24B params
Tensor type
FP16
·
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.

Model tree for skshmjn/llama-3.2-1B-Mongo-query-generator

Quantized
(60)
this model

Dataset used to train skshmjn/llama-3.2-1B-Mongo-query-generator