--- license: apache-2.0 language: - en metrics: - accuracy base_model: - mlx-community/NVIDIA-Nemotron-Nano-9B-v2-4bits library_name: mlx tags: - mlx - lora - sql - financialSQL - finance - nemotron - dpo --- # finsql-mlx-nemotron-nano-9b-v2-4bits This is a LoRA adapter for financial SQL generation, fine-tuned on mlx-community/NVIDIA-Nemotron-Nano-9B-v2-4bits. ## Latest Finetuning ![Screenshot 2025-10-11 at 13.28.30](https://cdn-uploads.huggingface.co/production/uploads/68c5d7248a0237bcabdce5cc/l5jMjmOvP40366Dwj1Hqr.png) #### HF Model Path: [gccmorgoth/finsql-mlx-nemotron-nano-9b-v2-4bits](https://huggingface.co/gccmorgoth/finsql-mlx-nemotron-nano-9b-v2-4bits) ## Finetuning Details - **Method**: Direct Preference Optimization (DPO) - **Checkpoint**: Iteration 600 - **Validation Loss**: 0.069 - **Training Loss**: 0.0002 - **Learning Rate**: Cosine decay with warmup - **LoRA Rank**: 16 - **Beta**: 0.1 ## Performance - Validation loss: 0.069 (optimal convergence point) - Selected at iteration 600 to prevent overfitting - DPO training for improved preference alignment on financial SQL tasks ## Model Selection - **Checkpoint**: Iteration 600 selected based on validation loss curve - **Rationale**: Optimal balance between training convergence and generalization - **Training Dynamics**: Early stopping before overfitting (val loss increased at iter 700+) ## Dataset This model was fine-tuned on financial text-to-sql data pairs, specifically the [FinSQLBull dataset](https://bull-text-to-sql-benchmark.github.io), to improve SQL query generation for financial databases and tables. ## Usage Recommended prompt format to specify: # Database: [database_name] [Schema information] ## Task [Natural language question about the data] Constraint: [Any specific constraints] SQL: [Model Generated SQL Query] ## Sample Prompt Format Database: company_financials Table: revenue (id, company, year, revenue, profit) Task What was the total revenue for all companies in 2023? SQL: [Model Generated SQL Query] ## Python ```python from mlx_lm import load, generate model, tokenizer = load("your-username/your-model-name") response = generate(model, tokenizer, prompt="Your prompt here")