--- license: llama3.2 base_model: unsloth/Llama-3.2-1B-bnb-4bit tags: - unsloth - sft - trl - lora - arxiv - text-generation - domain-expert - machine-learning datasets: - danivpv/ml-arxiv-instruct - mlabonne/FineTome-Alpaca-100k language: - en pipeline_tag: text-generation --- # Llama-ML-Expert-Instruct-1b An instruction fine-tuned Small Language Model (SLM) specialized in Machine Learning domain expertise. Fine-tuned from `unsloth/Llama-3.2-1B-bnb-4bit` using LoRA adapters — efficient enough to run on modest hardware while retaining strong ML-domain reasoning. Part of the [LLM-ArXiv-Domain-Expert](https://github.com/danivpv/LLM-ArXiv-Domain-Expert) pipeline, which builds domain-expert LLMs from ArXiv papers end to end: paper parsing → instruction/preference dataset generation → SFT → (optional) DPO. ## Model Details | | | | :--- | :--- | | **Base model** | [`unsloth/Llama-3.2-1B-bnb-4bit`](https://huggingface.co/unsloth/Llama-3.2-1B-bnb-4bit) (Llama 3.2, 1B) | | **Fine-tuning method** | LoRA — rank 32, alpha 32, dropout 0.0 | | **LoRA target modules** | `q_proj, k_proj, v_proj, up_proj, down_proj, o_proj, gate_proj` | | **Optimizer** | `adamw_8bit` | | **Prompt format** | Alpaca (`### Instruction: ... ### Response: ...`) | ## Training Data - [`danivpv/ml-arxiv-instruct`](https://huggingface.co/datasets/danivpv/ml-arxiv-instruct) — instruction-answer pairs synthesized from ArXiv ML papers - 10,000-sample subset of [`mlabonne/FineTome-Alpaca-100k`](https://huggingface.co/datasets/mlabonne/FineTome-Alpaca-100k) — preserves general instruction-following alongside domain specialization ## How to Use ```python from unsloth import FastLanguageModel model, tokenizer = FastLanguageModel.from_pretrained( model_name="danivpv/Llama-ML-Expert-Instruct-1b", max_seq_length=2048, load_in_4bit=True, ) FastLanguageModel.for_inference(model) prompt = """### Instruction: {your ML question here} ### Response: """ inputs = tokenizer(prompt, return_tensors="pt").to("cuda") outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0], skip_special_tokens=True)) ``` ## Limitations - 1B-parameter base model: strong for domain-specialized short-form Q&A, not a general-purpose reasoning or long-context model. - Trained on synthetically generated instruction data (see [`ml-arxiv-instruct`](https://huggingface.co/datasets/danivpv/ml-arxiv-instruct) for the generation pipeline) — inherits whatever biases or gaps exist in the source LLM used to generate that data. ## Related - Dataset (SFT): [`danivpv/ml-arxiv-instruct`](https://huggingface.co/datasets/danivpv/ml-arxiv-instruct) - Dataset (DPO): [`danivpv/ml-arxiv-dpo`](https://huggingface.co/datasets/danivpv/ml-arxiv-dpo) - Pipeline code: [github.com/danivpv/LLM-ArXiv-Domain-Expert](https://github.com/danivpv/LLM-ArXiv-Domain-Expert)