How to use from
llama.cpp
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh
# Start a local OpenAI-compatible server with a web UI:
llama serve -hf skshmjn/llama-3.2-3B-Mongo-query-generator:
# Run inference directly in the terminal:
llama cli -hf skshmjn/llama-3.2-3B-Mongo-query-generator:
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama serve -hf skshmjn/llama-3.2-3B-Mongo-query-generator:
# Run inference directly in the terminal:
llama cli -hf skshmjn/llama-3.2-3B-Mongo-query-generator:
Use pre-built binary
# Download pre-built binary from:
# https://github.com/ggerganov/llama.cpp/releases
# Start a local OpenAI-compatible server with a web UI:
./llama-server -hf skshmjn/llama-3.2-3B-Mongo-query-generator:
# Run inference directly in the terminal:
./llama-cli -hf skshmjn/llama-3.2-3B-Mongo-query-generator:
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
cmake -B build
cmake --build build -j --target llama-server llama-cli
# Start a local OpenAI-compatible server with a web UI:
./build/bin/llama-server -hf skshmjn/llama-3.2-3B-Mongo-query-generator:
# Run inference directly in the terminal:
./build/bin/llama-cli -hf skshmjn/llama-3.2-3B-Mongo-query-generator:
Use Docker
docker model run hf.co/skshmjn/llama-3.2-3B-Mongo-query-generator:
Quick Links

MongoDB Query Generator - Llama-3.2-3B (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-3B-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
201
GGUF
Model size
3B params
Architecture
llama
Hardware compatibility
Log In to add your hardware

4-bit

5-bit

8-bit

16-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

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

Quantized
(115)
this model

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