Downloads · 30 days
10
9% of all-time downloads
thunderjordi/mifidbrain-qwen3-4b-lora-v0
mifidbrain-qwen3-4b-lora-v0 is a text generation model from thunderjordi. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
A PEFT adapter for a simplified, synthetic UK MiFIR classification experiment, trained locally on an RTX 2060. It requires the separate 4B Qwen base model. The repository name retains v0; pin revision="v0.5" for this…
Downloads · 30 days
10
9% of all-time downloads
All-time downloads
110
Public
Repo size
46.9 MB
Likes
0
Public
Click a slice to open those files.
.safetensors11.8 MB · 50%
From the Hugging Face model README
A PEFT adapter for a simplified, synthetic UK MiFIR classification experiment, trained locally on an RTX 2060. It requires the separate 4B Qwen base model. The repository name retains v0; pin revision="v0.5" for this release. The previous adapter is retained at tag v0.2.
GitHub project · Exact release source snapshot · Unified article
| Evaluation | Untouched Qwen3-4B | v0.5 adapter |
|---|---|---|
| Synthetic holdout | 28/80 (35%) | 80/80 (100%) |
| Previously examined manual regression cases | 5/8 (62.5%) | 7/8 (87.5%) |
| Synthetic insufficient-information cases | 6/20 | 20/20 |
| Synthetic future-regime cases | 0/20 | 20/20 |
Adapter macro-F1: 1.0 synthetic, 0.9142857142857143 regression; no invalid contract outputs on 88 cases. Raw answers and manifests are preserved.
Known failure: FROZEN-004, investment advice without execution, returned REPORTABLE; expected NOT_REPORTABLE under the experiment's rules.
These are synthetic variations of the supervision rules and eight previously examined cases, not independent legal validation. Inputs contain structured facts including explicit instrument scope. Arbitrary natural-language questions and the old ask/API prompts are outside this measured contract. This is not production reporting software, legal advice, an authoritative regulatory database, or a reliable independent regulatory decision engine.
Historical failures remain relevant: v0.1 fresh verification was 1/6 full contract; v0.2 scored 37/50 synthetic and 3/8 manual; v0.3 scored 37/80 synthetic and 3/8 manual; v0.4 scored 30/80 synthetic. Prompts, datasets and metric definitions changed, so these are not controlled cross-version comparisons. Historical deterministic rules/hybrid 50/50 and 8/8 scores are not standalone adapter scores.
Qwen/Qwen3-4B, revision 1cfa9a7208912126459214e8b04321603b3df60c.20260910-200943: NF4 QLoRA, double quantization, FP16 compute, gradient checkpointing.q_proj, k_proj, v_proj, o_proj.paged_adamw_8bit, max length 512.bed2dcdf49e6909f4581f42c4cdd06e87c0a30b597048efe370fe2ede476bb5f.See configuration and manifest. Earlier runs' environment versions are not asserted as a separately captured v0.5 environment. Source handling and deterministic labels are described in the included source; no copyrighted regulatory documents are bundled.
For the simplest local showcase after cloning the GitHub repository, use:
.\.venv\Scripts\python.exe -m mifidbrain.cli v05-demo --case reportable
This is the measured v0.5 structured prompt and pins the Hub adapter revision.
The legacy ask command uses an older unmeasured prompt.
Install compatible PyTorch, Transformers, PEFT and bitsandbytes. The 4-bit profile requires CUDA. On a sufficiently large device, unquantized PEFT loading uses the same code with quantization_config omitted and an appropriate dtype/device.
import json
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
base_id = "Qwen/Qwen3-4B"
revision = "1cfa9a7208912126459214e8b04321603b3df60c"
adapter_id = "thunderjordi/mifidbrain-qwen3-4b-lora-v0"
tokenizer = AutoTokenizer.from_pretrained(base_id, revision=revision)
base = AutoModelForCausalLM.from_pretrained(
base_id, revision=revision, device_map={"": 0}, dtype=torch.float16,
quantization_config=BitsAndBytesConfig(
load_in_4bit=True, bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True, bnb_4bit_compute_dtype=torch.float16,
),
)
model = PeftModel.from_pretrained(base, adapter_id, revision="v0.5").eval()
facts = {
"as_of_date": "2026-08-31", "firm_type": "UK investment firm",
"firm_jurisdiction": "UK", "activity": "purchase",
"instrument_reportable": True, "transmitted_order": False,
"transmission_conditions_met": None, "venue_country": "GB",
"execution_decision_country": "GB", "asset_class": "equity",
}
prompt = (
"Classify supplied facts under the MiFIDBrain simplified research rules. "
"Return only JSON with key determination and one of: "
"REPORTABLE, NOT_REPORTABLE, INSUFFICIENT_INFORMATION, FUTURE_RULES_UNPUBLISHED"
". Unknown is distinct from false. Do not infer instrument scope from venue.\n"
+ json.dumps(facts, separators=(",", ":"), ensure_ascii=False)
)
text = tokenizer.apply_chat_template(
[{"role": "user", "content": prompt}], tokenize=False,
add_generation_prompt=True, enable_thinking=False,
)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.inference_mode():
output = model.generate(**inputs, max_new_tokens=64, do_sample=False)
print(tokenizer.decode(output[0, inputs.input_ids.shape[1]:], skip_special_tokens=True))
Accept only a JSON object with the single determination key and one of the four enumerated values; reject other output. FUTURE_RULES_UNPUBLISHED maps to the project's long future status. It represents this experiment's frozen temporal policy, not a claim about the current publication status of future technical rules.
Use the runbook and scripts/run_v0_5.ps1 in the included source snapshot. Training needs compatible CUDA packages and several hours. Source/data tests run without GPU. The GitHub project contains regulatory-source handling, rules, datasets, benchmarks and the training pipeline.
Adapter: Apache-2.0. Qwen3-4B base: Apache-2.0 (verified at the pinned revision). MiFIDBrain code: MIT. The MIT licence does not apply to Qwen weights. No base weights or optimizer states are included.
Recommended application architecture retains deterministic temporal, completeness and regulatory checks, with model assistance. More blind, diverse and professionally reviewed tests are needed before wider reliability claims.