Run this model with HF Jobs
Run M37labsorg/Anvaya-4B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/M37labsorg/Anvaya-4B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/M37labsorg/Anvaya-4B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/M37labsorg/Anvaya-4B. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/M37labsorg/Anvaya-4B. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use M37labsorg/Anvaya-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use M37labsorg/Anvaya-4B with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("M37labsorg/Anvaya-4B") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use M37labsorg/Anvaya-4B with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "M37labsorg/Anvaya-4B"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "M37labsorg/Anvaya-4B" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use M37labsorg/Anvaya-4B with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "M37labsorg/Anvaya-4B"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "M37labsorg/Anvaya-4B" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8080/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "M37labsorg/Anvaya-4B", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use M37labsorg/Anvaya-4B with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "M37labsorg/Anvaya-4B"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default M37labsorg/Anvaya-4B
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use M37labsorg/Anvaya-4B with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "M37labsorg/Anvaya-4B"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "M37labsorg/Anvaya-4B" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Anvaya-4B
Fine-tuned locally with SLM Forge on 2026-11-20.
Goal: A 4B specialist that reads a commercial contract and returns structured, span-grounded JSON for 20 high-value clause types, on-premise.
Base model: mlx-community/Qwen3-4B-Instruct-2507-4bit
Runs on: Apple Silicon Macs with 8 GB unified memory or more.
Lineage
- SFT (job 11): train_loss 0.051, peak_mem_gb 3.55, val_loss_start 1.717, val_loss 0.178
- DPO (job 12): train_loss 0.009, peak_mem_gb 6.45, reward_accuracy 1.0, val_loss_start 0.693, val_loss 0.175
- DPO (job 13): train_loss 0.274, peak_mem_gb 6.43, reward_accuracy 0.8, val_loss_start 0.693, val_loss 0.019
Usage
pip install mlx-lm
mlx_lm.generate --model "keshavM37/Anvaya-4B" --prompt "Hello"
The system prompt below is built into the chat template, so the model uses it whenever no other system prompt is given.
Recommended sampling
{
"temperature": 0.7,
"top_p": 0.95
}
System prompt
Reply with JSON only, shaped like: {"clauses":[{"clause_type":clause_type,"present":bool,"value":str|null,"evidence_span":str|null,"confidence":num|null},...]}
clause_type is one of: governing_law, effective_date, expiration_date, renewal_term, notice_period_to_terminate_renewal, termination_for_convenience, cap_on_liability, uncapped_liability, indemnification, insurance, most_favored_nation, exclusivity, non_compete, ip_ownership_assignment, license_grant, assignment, change_of_control, confidentiality, audit_rights, warranty_duration.
Rules: if present == false then evidence_span == null and value == null; if present == true then evidence_span is a verbatim substring of input; clause_type values are unique within clauses[].
Licence & attribution
This model is a fine-tune of mlx-community/Qwen3-4B-Instruct-2507-4bit and is subject to its licence: Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0).
What it asks of you: Keep the licence and any NOTICE file with the model, and say you changed it.
200 training examples were written or reviewed by an OpenAI model. OpenAI's terms apply to how those outputs may be used.
See LICENSE-BASE-MODEL.md, and the base model's own licence files where they could be included, in this folder.
Intended use & limitations
A small model fine-tuned for one narrow task on a few thousand examples. It makes mistakes, including confident ones. Check its outputs, and do not use it on its own for medical, legal, financial or safety-critical decisions.
- Downloads last month
- 60
4-bit
Model tree for M37labsorg/Anvaya-4B
Base model
Qwen/Qwen3-4B-Instruct-2507