How to use from
Pi
Start the llama.cpp server
# Install llama.cpp:
brew install llama.cpp
# Start a local OpenAI-compatible server:
llama serve -hf skshmjn/llama-3.2-3B-Mongo-query-generator:
Configure the model in Pi
# Install Pi:
npm install -g @earendil-works/pi-coding-agent
# Add to ~/.pi/agent/models.json:
{
  "providers": {
    "llama-cpp": {
      "baseUrl": "http://localhost:8080/v1",
      "api": "openai-completions",
      "apiKey": "none",
      "models": [
        {
          "id": "skshmjn/llama-3.2-3B-Mongo-query-generator:"
        }
      ]
    }
  }
}
Run Pi
# Start Pi in your project directory:
pi
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
214
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