Decide the path before you pick a model
When quants add AI, the first question is often “which model is best.” In a working system the longer-lived questions are where the data is allowed to sit, how predictable the job path is, and how you will check the result.
Handing one LLM news ingest, document search, code, backtest notes, and order judgement looks convenient. Cost, permissions, and failure modes pile into the same place. A more realistic shape is five layers:
- Data: collect and normalize market data, documents, code, and logs.
- Retrieval: find the evidence the model is allowed to see.
- Model: pick cloud or local for that job.
- Workflow: control tool order, permissions, and state.
- Evidence: check results with schemas, eval sets, and a human review.
The point is not to crown one model. It is to route each job onto the right path.
The stack: ingest through verify
Market data ─┐
Documents ─┼─> Normalize ─> Retrieve ─> Route model ─> Run tools ─> Verify
Code & logs ─┘ │ │ │
hybrid search cloud / local approval gate
The LLM does not own the database or the order path. Retrieval supplies evidence. The model drafts and interprets. The workflow bounds what can run. The last stage splits checks a machine can make from checks a person must make.
| Criterion | When it is low | When it is high |
|---|---|---|
| Data sensitivity | Review a managed cloud API | Prefer local or private environments |
| Task uncertainty | Fixed workflow | Bounded agent loop |
| Repeat rate | Interactive cloud use | Optimize batch cost and throughput |
| Execution risk | Can run automatically | Approval step and split permissions |
Cloud LLM: messy, unstructured work
A cloud LLM lets you try long-document analysis, code review, structured output, and tool calls without running the hardware. Swapping models is relatively cheap, so it fits research that changes direction while you talk.
Typical jobs:
- Compare assumptions and methods across several papers
- Hunt likely bugs in a data pipeline
- Pull candidate windows out of backtest logs
- Draft the structure and counter-arguments of a research note
“Not used for training” is not the same as “not stored.” Providers and endpoints differ on abuse-monitoring logs, application state, and how long files live. OpenAI says API inputs are not used for model training by default, and also that default abuse-monitoring logs may be kept for a period. Before you send strategy code or positions, re-read the current contract and data-control options.
Local LLM: data boundary and repetition
The main gain of a local LLM is not the weights. It is owning the execution boundary. Internal docs, unpublished factor definitions, and order logs can stay on a private network. Short classification or fixed-form summaries in bulk are also candidates.
Runtimes such as Ollama expose a local API, so wiring an existing app is easy. Local does not automatically mean safe or cheap.
- Model files and embedding stores still need access control.
- A local API on a public network needs its own auth and firewall.
- Long context blows up memory and latency.
- Purchase price is not the whole bill. Idle time, power, and operator hours count.
Start with “sensitive → local, hard → cloud,” then compare quality and throughput on the same eval set.
RAG: a layer that supplies evidence, not a smarter model
Retrieval-augmented generation does not trust the model’s memory. It searches related documents at request time and puts them in context. For quant work that is papers, strategy specs, data dictionaries, and old experiment logs.
The basic path:
Document → Chunk → Embedding → Index
Question → Retrieve → Rerank → Prompt → Answer + Source
Vector search is good at near-meaning and weak on exact tickers, function names, and error codes. Qdrant’s docs describe hybrid search that mixes dense semantic vectors with sparse lexical match. For finance and code, pair vectors with keyword search and metadata filters.
Score retrieval and generation separately. If you only grade the final sentence, the two error types mix.
- Does the right source document appear in the top hits?
- Do date, market, asset, and document-version filters hold?
- Does the answer match the retrieved evidence?
- When there is no source, does the model stop instead of guessing?
Agent: a controlled decision layer, not a while-loop
Workflows and agents are different. LangGraph describes a workflow as a pre-set code path and an agent as a model that chooses steps and tools as it goes.
Daily ingest with a fixed order is usually simpler and more reproducible as ordinary code.
fetch → validate → transform → store → report
A bounded agent can help when the next step changes with the input — “investigate this error, pick the logs you need, and list cause candidates.” Even then, do not hand the model every permission.
- Split read tools from write tools.
- Require a person for orders, deletes, and public posts.
- Cap loops and spend.
- Log every tool input and result.
- Prefer stop over retry when a failure condition is met.
The goal is not maximum autonomy. It is handling uncertain work inside an observable box.
GPU: utilization before own-versus-rent
Choosing a local model does not force a GPU purchase. Renting a cloud GPU does not erase ops. The live questions are utilization and how much downtime you can stand.
| Job type | Look at first |
|---|---|
| Occasional large-model experiments | Hourly GPU rental |
| Short parallel batches | Several rental instances plus a job queue |
| Steady daily inference | Compare owned hardware to total API cost |
| Long jobs that must not die | Stable instance plus checkpoints |
| Always-on sensitive data | Internal GPU or private deploy |
Do not compare on hourly price alone. Add model load time, data transfer, volume storage, reruns of failed jobs, and operator time.
Evidence: fluent prose is not a test
A plausible paragraph is not verification. NIST’s generative-AI profile of the AI RMF puts reliability into design, development, use, and evaluation. In a quant shop, scale the check to the harm if the answer is wrong.
Machine-checkable
- JSON schema and required fields
- Numeric ranges and units
- Ticker and date formats
- SQL stays read-only
- Cited document IDs actually exist
Needs an eval set
- Retrieval recall@k
- Classification accuracy and per-class errors
- Grounding of the answer in the retrieved text
- Variance on the same input
- Regression after a model or prompt change
Needs a person
- Live orders and position changes
- Public reports
- Strategy-rule or risk-limit edits
- Sensitive data leaving the boundary
Treat LLM market commentary as a hypothesis to investigate, not a trading signal.
A small start, in order
You do not need a full agent platform on day one. This sequence keeps each layer’s effect visible.
- Pick one frequent job with a checkable answer.
- Build a rule-based baseline with no model.
- Measure a cloud-model quality baseline.
- If sensitivity or cost shows up, compare a local model on the same eval set.
- Add RAG only when you need current documents, and measure retrieval first.
- Add an agent loop only when the path cannot be written down in advance.
- Put an approval step in front of writes.
That order keeps you from debugging the model, the search, and the orchestration at the same time.
Close
The center of an AI research stack is not a model name. It is the split between data boundary, retrieved evidence, model routing, tool permission, and verification.
- Cloud LLM for messy, conversational work.
- Local LLM as a candidate for sensitive data and repetitive batches.
- RAG only when freshness and sources matter.
- Agent only when the path is truly dynamic, and only inside bounds.
- GPU by utilization and operating cost, not ownership slogans.
- Evidence to catch errors before a result becomes an action.
The aim is not a system that judges for you. It is a system that lets a researcher move faster and still trace which data and which evidence produced the conclusion.
References
- OpenAI API data controls
- Ollama API
- Qdrant overview
- LangGraph workflows and agents
- NIST AI RMF: Generative AI Profile
Related
Local LLMs vs Cloud Models: Which Is More Advantageous in Quant Research Environments?
RunPod vs Vast.ai: Practical Comparison of Local LLM and GPU Rental for Backtesting
Automating Quant Research with Claude API: Practical Comparison with GPT-4

