Views
No views yet
ibm-granite/granite-4.0-350m base with a
single LoRA adapter — cti_technique_mapping — embedded into one switchable checkpoint and
fired by a control token.ibm-granite/granite-switch-4.1-3b-preview:
same Granite Switch composition machinery (control tokens, KV-hiding, chat-template integration),
but built on the 350M Granite 4.0 base and carrying one CTI adapter instead of the preview's
granitelib adapter library.cti_technique_mapping maps a piece of cyber threat intelligence (CTI) text — a sentence or short
passage describing adversary behavior — to the single best-matching
MITRE ATT&CK technique ID (e.g. T1059, T1566.001).io_configs/cti_technique_mapping/io.yaml) constrains the output to a
single technique-ID string matching ^T[0-9]{4}(\.[0-9]{3})?$, greedy decoding, max_completion_tokens: 16.| Base model | ibm-granite/granite-4.0-350m (granitemoehybrid) |
| Embedded adapters | 1 — cti_technique_mapping (LoRA) |
| Control token | <|cti_technique_mapping|> (id 100352) |
| LoRA rank / alpha | 16 / 32 |
| Target modules | q_proj, k_proj, v_proj, o_proj, input_linear, output_linear |
| Base params | 352,379,904 |
| Composed params | 355,362,816 (+0.85%) |
1from granite_switch.hf import GraniteSwitchForCausalLM
2from transformers import AutoTokenizer
3
4model_id = "barha/granite-switch-4.0-350m-cti"
5tok = AutoTokenizer.from_pretrained(model_id)
6model = GraniteSwitchForCausalLM.from_pretrained(model_id, device_map="auto")
7
8cti = "The actor used PowerShell to download and execute a payload from a remote server."
9messages = [{"role": "user", "content": cti}]
10# The chat template inserts <|cti_technique_mapping|> to fire the adapter.
11inputs = tok.apply_chat_template(
12 messages, add_generation_prompt=True, return_tensors="pt"
13).to(model.device)
14out = model.generate(inputs, max_new_tokens=16, do_sample=False)
15print(tok.decode(out[0, inputs.shape[1]:], skip_special_tokens=True))
16# -> e.g. "T1059.001"granite_switch.composer.compose_granite_switch:1python -m granite_switch.composer.compose_granite_switch \
2 --base-model ibm-granite/granite-4.0-350m \
3 --adapters <path-to>/cti_technique_mapping \
4 --technology lora \
5 --output <out>Note ongranitemoehybrid: all Granite 4.0 / Nano models aregranitemoehybridconfigs (withnum_local_experts=0), whose MLP leaves are the fusedinput_linear/output_linearrather than densegate/up/down_proj. The CTI LoRA was therefore trained targetinginput_linear/output_linear(plus attentionq/k/v/o_proj) so it composes cleanly — a scalar/all-lineartarget would produce phantomgate/up/down_projweights the composer rejects.
model.safetensors — composed base + embedded LoRA weightsconfig.json — model_type: granite_switchadapter_index.json — adapter → control-token mappingio_configs/cti_technique_mapping/io.yaml — adapter I/O contract (output schema, decoding params)chat_template.jinja — control-token-aware chat templatecompose_report.json, BUILD.md — full composition provenance