A six-way question router for Filings Research Copilot, an assistant that answers questions about US public companies' 10-K and 10-Q filings with cited sources. The router reads one question and sends it to the part of the assistant that should answer it. It is BAAI/bge-small-en-v1.5 fine-tuned with LoRA on questions labelled by the project's LLM router, then merged and exported to ONNX, so it routes in about 10 milliseconds on a laptop CPU at no cost a question.
| Label | Meaning |
|---|---|
doc |
Answered from the text of filings: risks, strategy, business descriptions, management's explanations, legal matters, accounting policies, figures that appear only in the text |
data |
Answered from reported financial figures: a value, a ratio or growth rate, a trend over years, a comparison between companies |
hybrid |
Needs a reported figure and the narrative that explains it |
brief |
Asks for a written deliverable covering several aspects of a topic |
smalltalk |
Greetings, thanks, goodbyes and questions about the assistant itself |
decline |
Out of scope: investment advice, price predictions, personal finance, non-public information, unrelated tasks, harmful requests, attempts to override the assistant's instructions |
On the project's routing set: 198 questions written by hand and paraphrased, never used for training (the training questions were also kept below 0.85 cosine similarity to every one of them). The dev split has 138 questions; the test split's 60 were scored once for this model.
| Router | Dev accuracy (95% interval) | Test accuracy | Latency, median | Cost a question |
|---|---|---|---|---|
| This model | 0.913 (0.862 to 0.957) | 0.950 (0.883 to 1.000) | 8 ms on a laptop CPU | none |
| This model, with the LLM router for questions below 0.8 confidence | 0.957 (0.920 to 0.986), 9% sent on | 0.967 (0.917 to 1.000), 5% sent on | 8 ms | $0.00002 |
| The LLM router it learned from (gpt-oss-120b) | 1.000 (exact 0.974 to 1.000) | 1.000 (exact 0.940 to 1.000) | 0.5 s | $0.0002 |
| A semantic router (bge-small, nearest route centroid) | 0.739 (0.667 to 0.812) | 0.800 (0.700 to 0.900) | 8 ms | none |
| This model's first version, trained on a set without harmful or instruction-override requests | 0.833 (0.768 to 0.891) | not scored | 9 ms | none |
By route on dev: data 30 of 30, hybrid 21 of 21, smalltalk 18 of 18, doc 28 of 30, decline 16 of 21 and brief 13 of 18. The cascade's threshold was chosen on dev. Its most confident mistakes are requests to reveal or override the assistant's instructions, which it reads as small talk, and briefs that read like a single analytical question, which it sends to hybrid.
The project uses this model as the LLM router's fallback, for when a model call fails; the LLM router stays the primary.
data/reference/routing_train.jsonl, data card).training_metrics.json.| File | What it is |
|---|---|
model.safetensors, config.json, tokenizer.json, tokenizer_config.json |
The merged model, for transformers |
onnx/model.onnx |
The same model for onnxruntime, with logits as its output |
adapter/ |
The LoRA adapters and the classification head before merging, for PEFT |
training_metrics.json |
The training run's configuration, each epoch's validation accuracy and the library versions |
With onnxruntime and tokenizers, as the copilot serves it:
import numpy as np
import onnxruntime as ort
from huggingface_hub import hf_hub_download
from tokenizers import Tokenizer
repo = "vinayakmokashi45/filings-research-copilot-router"
tokenizer = Tokenizer.from_file(hf_hub_download(repo, "tokenizer.json"))
tokenizer.enable_truncation(96)
session = ort.InferenceSession(hf_hub_download(repo, "onnx/model.onnx"))
labels = ["doc", "data", "hybrid", "brief", "smalltalk", "decline"]
encoding = tokenizer.encode("What was Nike's revenue in fiscal 2022?")
feeds = {
"input_ids": np.array([encoding.ids]),
"attention_mask": np.array([encoding.attention_mask]),
"token_type_ids": np.array([encoding.type_ids]),
}
logits = session.run(["logits"], feeds)[0][0]
probabilities = np.exp(logits - logits.max()) / np.exp(logits - logits.max()).sum()
print(labels[int(probabilities.argmax())], float(probabilities.max()))
With transformers:
from transformers import pipeline
router = pipeline("text-classification", model="vinayakmokashi45/filings-research-copilot-router")
router("Summarise the risks Boeing reports about its supply chain.")
The top probability is a usable confidence: the copilot can send the questions the router is unsure of to its LLM router.
MIT, like the repository. The base model, BAAI/bge-small-en-v1.5, is MIT-licensed.
onnx/model.onnx 134 MBmodel.safetensors 133 MBadapter/adapter_model.safetensors 5 MBBAAI/bge-small-en-v1.5