PEFT
Safetensors
lora
Mixture of Experts
mixture-of-experts
cross-lingual-alignment
midalign
machine-translation
Instructions to use ducanhdinh/Macro-Nano-Instruct-MidAlign with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use ducanhdinh/Macro-Nano-Instruct-MidAlign with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("ATH-MaaS/Marco-Nano-Instruct") model = PeftModel.from_pretrained(base_model, "ducanhdinh/Macro-Nano-Instruct-MidAlign") - Notebooks
- Google Colab
- Kaggle
Macro-Nano-Instruct-MidAlign
LoRA adapter finetune tu ATH-MaaS/Marco-Nano-Instruct, mot mo hinh Mixture-of-Experts, theo
baseline MidAlign (Middle-Layer Representation Alignment, Liu & Niehues 2025) β Alternate
Training giua task objective (causal LM tren target language) va alignment objective
(contrastive loss tai 1 middle layer) β adapt sang backbone MoE.
Cau hinh LoRA / Alignment
- LoRA + trich xuat hidden state cho contrastive loss CHI ap dung tai layer thu
16(0-indexed block = 15) trong tong so28layer. - Module duoc gan LoRA: attention, router, experts tai layer tren.
- r = 16, alpha = 32, dropout = 0.05
- Nhiet do contrastive tau = 0.1
Loss (Alternate Training β moi step chi 1 trong 2)
- Task step:
L_task = L_LM + lb_loss_coef * L_LBL_LM: causal LM loss tren cau TARGET LANGUAGE (phia "other" trong cap english-other).L_LB: load balancing loss chuan cua MoE tai router trong layer duoc finetune.lb_loss_coef= None,num_experts= 232,top_k= 8
- Align step:
L_align= symmetric InfoNCE / contrastive loss (in-batch negatives) giua mean-pooled hidden state cua cau tieng Anh va cau target tai layer 16.
Du lieu
Cap bitext english-other duoc sample tu cac bo du lieu multiway-parallel: flores.json, bible.json, ntrex.json.
Voi moi record, cau eng_Latn duoc ghep voi tung ngon ngu khac trong cung record de tao
1 cap bitext rieng.
Training
- 3 epoch, batch_size = 64 (per-process).
- Multi-GPU: DistributedDataParallel (torchrun), checkpoint chi giu ban moi nhat.
Diagnostics
Xem diagnostics/loss_log.jsonl (log theo tung step, phan biet step_type=task/align) va
diagnostics/loss_curve.png.
- Downloads last month
- -
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support
Model tree for ducanhdinh/Macro-Nano-Instruct-MidAlign
Base model
ATH-MaaS/Marco-Nano-Instruct