# 📊 Nifty50GPT-Final — India's First Financial SQL LLM (Offline, Open-Source) **Nifty50GPT-Final** is a lightweight, offline-ready transformer model fine tuned on structured Indian stock market data. It was created by [Shubham Sood] at **Student One** to make financial analysis transparent, free, and locally usable — without APIs or cloud dependencies. This release includes: - A fully fine-tuned language model that generates **SQL queries** on structured prompts - A bundled DuckDB database (`student_data.duckdb`) for instant access to 10+ years of data across 50+ NIFTY stocks, Indian indices, and global indices - Support for both CPU and GPU inference with zero dependencies on internet or live data --- ## What's Included | File | Description | |---------------------------|-------------------------------------------------| | `pytorch_model.bin` | Final trained LLM weights (TinyLLaMA-1.1B base) | | `tokenizer.json` | Tokenizer configuration | | `config.json` | Model configuration | | `special_tokens_map.json` | Special token mapping | | `student_data.duckdb` | Historical Indian financial data | | `README.md` | You're reading it | --- ## How to Run (Inference on CPU or GPU) ### Local Inference (CPU) ```python from transformers import AutoModelForCausalLM, AutoTokenizer import torch model = AutoModelForCausalLM.from_pretrained("StudentOne/Nifty50GPT-Final") tokenizer = AutoTokenizer.from_pretrained("StudentOne/Nifty50GPT-Final") tokenizer.pad_token = tokenizer.eos_token prompt = "### Instruction: What was the net_profit of INFY on 2021-03-31?\n### Output:" inputs = tokenizer(prompt, return_tensors="pt") outputs = model.generate( **inputs, max_new_tokens=100, do_sample=False, pad_token_id=tokenizer.pad_token_id, eos_token_id=tokenizer.eos_token_id ) print(tokenizer.decode(outputs[0])) ###DuckDB Integration (student_data.duckdb) All responses from Nifty50GPT-Final are SQL-ready and designed to be run on student_data.duckdb. How to Use It: Download DuckDB Launch DuckDB in terminal or PowerShell: Paste the SQL query generated by the model, for example: SELECT value FROM fundamentals WHERE stock_symbol = 'INFY' AND metric = 'net_profit' AND date = DATE '2021-03-31'; Works instantly. No server, no latency, no setup. You can extend the dataset while keeping the schema the same ### What Can I Ask Nifty50-GPT? 1. Fundamental Metric Lookups What was the net_profit of TCS on 2022-03-31? Give me the EPS of INFY on 2023-03-31 2. All Fundamentals for a Company Give me all fundamental metrics for RELIANCE on 2021-03-31 3. Year-over-Year Growth What was the YoY growth of net_profit for HDFCBANK? 4. CAGR What was the 5-year CAGR of EPS for INFY from 2017 to 2022? 5. OHLCV for Stocks or Indices Give me OHLCV for ASIANPAINT on 2023-01-20 What was the close price of NIFTY50 on 2022-12-12? 6. Rolling Metrics What was the 30-day moving average of close price for INFY on 2023-03-15? 7. NIFTY-Wide Aggregates What was the average ROE across all NIFTY50 companies in 2022? # Supported Stock Symbols # Use stock symbols, not full company names. Examples: INFY, TCS, RELIANCE, HDFCBANK, ITC, ASIANPAINT, WIPRO, KOTAKBANK, ADANIENT, SBIN, LT, TECHM, COALINDIA, NESTLEIND indian indices- NIFTY50, SENSEX, NSEBANK, CNXIT, CNXPHARMA, CNXMEDIA, CNXENERGY, CNXAUTO, CNXMETAL, CNXREALTY global indices- S&P 500, Nasdaq 100, Dow Jones, FTSE 100, DAX, Nikkei 225, Hang Seng, Shanghai Composite Supported Date Format YYYY-03-31 - all yearly fundamentals have been shown to be reported on 31st of every march YYYY-MM-DD for the rest Tips to Avoid Hallucination Use exact stock symbols (INFY, not Infosys) Use supported metric names and date formats Follow the formats in this README for best results --- ## Legal Disclaimer This model and its associated database are provided **strictly for research, experimentation, and educational purposes** only. - **Nifty50GPT-Final does not provide financial advice.** - It does not guarantee accuracy, completeness, or relevance of any output. - It should not be used to make or inform investment decisions. - Outputs may be outdated, incorrect, or misinterpreted if used outside the documented prompt structure. - The included `student_data.duckdb` file is a static, sample database and may not reflect the most current financial data. ### No Liability By using this model or dataset: - You acknowledge that **all responsibility lies with the user**. - Neither the author(s), contributors, nor affiliated organizations shall be held liable for any outcome, financial or otherwise, resulting from the use or misuse of this model or its outputs. This project is **not affiliated with the NSE, SEBI, or any regulatory or financial institution.** This model is **not certified**, **audited**, or**approved** by any authority. > Use responsibly. Fork freely. Trust nothing. Verify everything. Credits Created by Shubham Sood Maintained by Student One 🌐 www.studentone.tech