bist-qwen3-4b
The research analyst model of an educational BIST 100 research harness (course project). It is fine-tuned to call the harness's MCP tools with the right arguments, to state only numbers that appear in the tool results, and to end each answer with one conclusion from a fixed action space: HOLD, WATCH, INVESTIGATE, POTENTIAL_CATCH_UP_CANDIDATE, TECHNICAL_REVERSAL_CANDIDATE, FUNDAMENTAL_IMPROVEMENT_CANDIDATE, REJECT_SIGNAL or ANALYSIS_UNSAFE.
Educational research output, not investment advice. The model never gives buy or sell advice, price targets or position sizes.
Files
| File | What it is |
|---|---|
Qwen3-4B-Instruct-2507.Q4_K_M.gguf | The merged model, 4-bit GGUF (2.3 GB), for Ollama or llama.cpp |
Modelfile | Ollama Modelfile: the base model's chat template, num_ctx 8192, temperature 0.2 |
lora/ | The LoRA adapter (PEFT) and tokenizer: the training output itself |
Base model and training
- Base model: Qwen3-4B-Instruct-2507 (Apache 2.0), loaded in 4 bit through Unsloth.
- Method: QLoRA with TRL SFT. LoRA rank 16, alpha 16, no dropout, on every attention and MLP projection. 2 epochs, learning rate 2e-4 with cosine decay, batch 1 x 8 gradient accumulation, AdamW 8-bit, sequences up to 6,144 tokens. Loss on the assistant turns only.
- Data: 2,066 training and 307 validation trajectories (question, tool calls, tool results, answer). A scripted teacher generated them through the real MCP server by applying the harness's rules, so every number in an answer is copied from a tool result. No cloud model was used. Training uses sessions before 2025; validation uses 2025 onwards.
- Hardware: one RTX 4070 Laptop GPU (8 GB).
Results
The model was evaluated on Experiment E (10 research cases x 3 repeats) and on 22 scenario questions (2 repeats each), including the course's five sample test questions. The numbers below are the PDF section 30 metrics.
| Metric | Qwen3-4B base | Qwen3.5-4B | bist-qwen3-4b |
|---|---|---|---|
| Scenario conclusion agrees with the evidence | 52% | 36% | 73% |
| Right tool and arguments | 48% | 45% | 75% |
| Agreement with the rule agent (cases) | 0% | 50% | 93% |
| Rule violations | 35% | 30% | 0% |
| Numerical hallucination | 4% | 8% | 2% |
| Invalid tool calls | 5% | 0% | 0% |
Running it
ollama pull qwen3:4b-instruct-2507-q4_K_M # only needed by the harness's export script
hf download muslumagah/bist-qwen3-4b --local-dir bist-qwen3-4b
cd bist-qwen3-4b
ollama create bist-qwen3-4b -f Modelfile
The model is meant to be used through the harness, which serves the tools over MCP. Run python -m bist.llm.chat from the project. The harness sends Ollama a prompt already formatted with the Qwen3 chat template (/api/generate). It does not use /api/chat, because Ollama's chat endpoint constrains tool arguments to the schema's property order. This model writes arguments in alphabetical order, so through /api/chat it drops arguments.
Limitations
- About a quarter of its scenario conclusions still differ from the reference, mostly on strategy-backtest, research-findings and advice questions.
- It imitates deterministic rules and adds no judgement beyond them.
- It covers 30 BIST 100 stocks and data up to the last download. Anything else gets ANALYSIS_UNSAFE.