This is a fine-tuned, 4-bit quantized (GGUF) version of Microsoft's Phi-3-Mini-4k-instruct, specialized in professional financial analysis, stock market valuation, and corporate finance.
The model was trained using Unsloth on a financial instruction dataset and has been aggressively optimized for low-memory environments. It easily runs on standard laptops with less than 3GB of RAM while maintaining high factual accuracy.
🧠 Model Persona & Use Cases
This model is explicitly trained to act as a Professional Financial Analyst.
It is best used for:
Stock market analysis and valuation metrics
Corporate finance and accounting principles
Investment strategy and portfolio management
Explaining economic trends and market indicators
Risk assessment and financial modeling
🚀 How to Use
You can interact with this model directly in your browser, via Ollama, or using Python.
Option 1: Hugging Face Widget
You can test the model immediately using the Hosted Inference API widget on the right side of this page.
Note: Because this is a GGUF model, it may take 15–30 seconds to load into Hugging Face's server RAM on the first prompt.
Option 2: Run Locally via Ollama
If you have Ollama installed, you can pull and run the model directly from this repository with a single command.
It will automatically download the weights and apply the correct system prompt.
ollama run hf.co/Wellwisher12/finance-phi3-gguf
Option 3: Run via Python (main.py)
This repository includes main.py script that utilizes llama-cpp-python to run the model with strict memory constraints (n_ctx=1024) to prevent out-of-memory errors on local machines.
Prerequisites
pip install llama-cpp-python huggingface-hub
Execution
bash
1# Clone the repository2git clone https://huggingface.co/Wellwisher12/finance-phi3-gguf
34# Navigate into the directory5cd finance-phi3-gguf
67# Launch the interactive terminal8python main.py
⚙️ Required System Prompt
To achieve the best and most accurate results, the model should be initialized with the following system prompt.
Note: This is automatically handled if you use the provided Modelfile or main.py script.
text
1You are a professional Financial Analyst with expertise in:
23- Stock market analysis and valuation
4- Corporate finance and accounting
5- Investment strategy and portfolio management
6- Economic trends and market indicators
7- Risk assessment and financial modeling
89Your responses should be:
1011- Accurate and data-driven
12- Professional and neutral in tone
13- Comprehensive yet concise
14- Based on sound financial principles
1516Always provide specific examples and metrics when relevant.
📊 Technical Specifications
Specification
Details
Base Model
unsloth/phi-3-mini-4k-instruct
Dataset
gbharti/finance-alpaca
Quantization
Q4_K_M (4-bit)
Format
GGUF
Recommended Temperature
0.2
Recommended Context Window
1024 - 2048 tokens
✅ Key Features
Fine-tuned specifically for financial reasoning tasks
Lightweight and optimized for low-RAM systems
Compatible with Ollama and llama.cpp
Quantized GGUF format for efficient local inference
Professional analyst-style responses
Reduced hallucinations with low-temperature inference
💡 Recommended Hardware
Hardware
Recommendation
RAM
Minimum 4GB
CPU
Modern multi-core CPU
GPU
Optional
Storage
~2-3GB free space
📌 Example Prompt
Analyze Apple's current valuation using P/E ratio, revenue growth, and free cash flow trends.
📜 License
Please follow the licensing terms of the original base model and dataset used in this project.