--- license: apache-2.0 datasets: - Crystalcareai/openhermes_200k_unfiltered - mlabonne/orpo-dpo-mix-40k - jondurbin/airoboros-3.2 - abacusai/SystemChat-1.1 - trollek/SimpleInstructionJudge-v01 - cgato/SlimOrcaDedupCleaned language: - en library_name: transformers base_model: h2oai/h2o-danube3-4b-base tags: - mergekit - magpie --- # LittleInstructionMaker-4B-v0.1 A small model to create prompts the [Magpie](https://arxiv.org/abs/2406.08464) way. The secret sauce turned out to be also training on the prompts. I did that last with SystemChat-1.1 in order to be able to steer the prompt generation. It does not work without a system message. Now imagine, if you will, having this bad boy generate a bunch of different prompts right, and having another model like, I mean.. ~~[LittleInstructionJudge](https://huggingface.co/trollek/LittleInstructionJudge-4B-v0.1)~~ Any mode with some proper prompt engineering right, judge all of the instructions right, and then slam a serverfarm with the cream of the crop right. In other words, giving it a system prompt like "You are a creative writing partner", "You are an advanced coding assistant", "You are a damn good psychologist", etc, you can can quickly generate prompts for a niche dataset that can then be answered by large model. In a different language: Ved hjælp af Husskades indsigt, hvor man udnytter sprogmodellers natur til at skabe tilpasningsdata, kan man med fordel bruge denne sprogmodel til at skrive instruktioner, og endda styre indholdet ved hjælp af system beskeden. ## Training All the datasets were used seperately and merged together using [Model Stock](https://arxiv.org/abs/2403.19522), except for SystemChat-1.1 where I fine-tuned it using [LoRA+](https://arxiv.org/abs/2402.12354) with `train_on_prompt` set to True. ### Datasets * [Airoboros-3.2](https://huggingface.co/datasets/jondurbin/airoboros-3.2) (CC BY 4.0) by [jondurbin](https://huggingface.co/jondurbin) * [SystemChat-1.1](https://huggingface.co/datasets/abacusai/SystemChat-1.1) by [abacusai](https://huggingface.co/abacusai) * [orpo-dpo-mix-40k](https://huggingface.co/datasets/mlabonne/orpo-dpo-mix-40k) by [mlabonne](https://huggingface.co/mlabonne) * [SlimOrcaDedupCleaned](https://huggingface.co/datasets/cgato/SlimOrcaDedupCleaned) by [cgato](https://huggingface.co/cgato) * [openhermes_200k_unfiltered](https://huggingface.co/datasets/Crystalcareai/openhermes_200k_unfiltered) by [Crystalcareai](https://huggingface.co/Crystalcareai) ## Using this model to make instructions ```jinja2 <|im_start|>system {{system_message}}<|im_end|> <|im_start|>user ``` It actually generates an EOS token at the end of a *"user"* prompt. Lawdy that has been a pain when trying to use large models for this purpose. Good luck; have fun. ### Response preview Giving the model this text at a temperature of 0.9: ``` <|im_start|>system You are an AI coding assistant.<|im_end|> <|im_start|>user ``` Will return this: ``` Hey, can you help me write a simple program that generates a Fibonacci sequence until a certain number of terms? Like this: Fib(5) should give me the first five numbers in the series. ``` ### Code example to use it ```python import torch from unsloth import FastLanguageModel model, tokenizer = FastLanguageModel.from_pretrained( "trollek/LittleInstructionMaker-4B-v0.1", dtype=torch.bfloat16, load_in_4bit=True, max_seq_length=8192 ) FastLanguageModel.for_inference(model) def instruction_generator(system_message: str, num_instructions: int): if system_message is None or "": raise ValueError if num_instructions < 1: raise ValueError magpie_template = f"<|im_start|>system\n{system_message}<|im_end|>\n<|im_start|>user\n" input_ids = tokenizer(magpie_template, return_tensors="pt").input_ids.to("cuda") for idx in range(num_instructions): generated_ids = model.generate(input_ids, max_new_tokens=512, temperature=0.9, repetition_penalty=1.1, do_sample=True, eos_token_id=tokenizer.eos_token_id) response = tokenizer.decode(generated_ids[0][input_ids.shape[-1]:], skip_special_tokens=True, clean_up_tokenization_space=True) yield response for instruct in instruction_generator("You are an AI coding assistant.", 2): print(instruct) # Can you help me write a simple programming language syntax? # I want to create a Python program for a social media app that allows users to post and comment on stories. The message I want to convey is that staying connected with others is essential in life. Can you suggest a way to design the program? ``` ### Quants * [mradermacher/LittleInstructionMaker-4B-v0.1-GGUF](https://huggingface.co/mradermacher/LittleInstructionMaker-4B-v0.1-GGUF) * [RichardErkhov/trollek_-_LittleInstructionMaker-4B-v0.1-gguf](https://huggingface.co/RichardErkhov/trollek_-_LittleInstructionMaker-4B-v0.1-gguf)