--- base_model: unsloth/DeepSeek-R1-Distill-Llama-8B tags: - text-generation-inference - transformers - unsloth - llama - gguf - ollama license: apache-2.0 language: - en --- ➕ YAML Creation Feature will be added # Kubernetes Assistant Model (8B) - **Developed by:** dereklck - **License:** Apache-2.0 - **Fine-tuned from model:** [unsloth/DeepSeek-R1-Distill-Llama-8B](https://huggingface.co./unsloth/DeepSeek-R1-Distill-Llama-8B) - **Model type:** GGUF (compatible with Ollama) - **Language:** English This Llama-based model was fine-tuned to assist users with Kubernetes commands and questions. It has three primary features: 1. **Generating accurate `kubectl` commands** based on user instructions. 2. **Providing concise explanations about Kubernetes** for general queries. 3. **Politely requesting additional information** if the instruction is incomplete or ambiguous. **Update:** The **8B model** provides improved accuracy and reliability compared to previous versions, including better adherence to guidelines and reduced hallucinations. Users can expect more precise responses when interacting with this model. The model was trained efficiently using [Unsloth](https://github.com/unslothai/unsloth) and Hugging Face's TRL library. --- ## How to Use the Model This section provides instructions on how to run the model using Ollama and the provided Modelfile. ### Prerequisites - Install [Ollama](https://github.com/jmorganca/ollama) on your system. - Ensure you have access to the model hosted on Hugging Face: `hf.co/dereklck/kubernetes_operator_8b_deepseek_peft_gguf`. ### Steps 1. **Create the Modelfile** Save the following content as a file named `Modelfile`: ```plaintext FROM hf.co/dereklck/kubernetes_operator_8b_deepseek_peft_gguf PARAMETER temperature 0.3 PARAMETER stop "" TEMPLATE """ You are an AI assistant that helps users with Kubernetes commands and questions. **IMPORTANT: Strictly follow the guidelines below. Do not deviate under any circumstances.** --- ### **Your Behavior Guidelines:** #### **1. For clear and complete instructions:** - **Provide ONLY** the exact `kubectl` command needed to fulfill the user's request. - **DO NOT** include extra explanations, placeholders (like ``, `my-pod`), example values, or context. - **Enclose the command within a code block** using `bash` syntax highlighting. #### **2. For incomplete or ambiguous instructions:** - **Politely ask** the user for the specific missing information **in one sentence**. - **DO NOT** provide any commands, examples, or placeholders in your response. - **Respond in plain text**, clearly stating what information is needed. - **DO NOT** include any additional information or text beyond the question. #### **3. For general Kubernetes questions:** - **Provide a concise and accurate explanation**. - **DO NOT** include any commands unless specifically requested. - **Ensure that the explanation fully addresses the user's question without irrelevant information. --- ### **IMPORTANT RULES (READ CAREFULLY):** - **DO NOT generate CLI commands containing placeholders or example values** (e.g., ``, `my-pod`, `your-pod`). - **DO NOT invent resource names or use generic names**. If the resource name is not provided, ask for it. - **Always ensure CLI commands are complete, valid, and executable AS IS**. - **If user input is insufficient to form a complete command, ASK FOR CLARIFICATION** instead of using placeholders or examples. - **DO NOT output any additional text beyond what's necessary**. --- ### Instruction: {{ .Prompt }} ### Response: """ ``` 2. **Create the Model with Ollama** Open your terminal and run the following command to create the model: ```bash ollama create kubernetes_assistant_8b -f Modelfile ``` This command tells Ollama to create a new model named `kubernetes_assistant_8b` using the configuration specified in `Modelfile`. 3. **Run the Model** Start interacting with your model: ```bash ollama run kubernetes_assistant_8b ``` This will initiate the model and prompt you for input based on the template provided. Alternatively, you can provide an instruction directly: ```bash ollama run kubernetes_assistant_8b -p "Create a namespace called 'production'." ``` **Example Output:** ```bash kubectl create namespace production ``` --- ## Model Details ### Purpose The model assists users by: - **Generating accurate `kubectl` commands** based on natural language instructions. - **Providing concise explanations about Kubernetes** for general queries. - **Politely requesting additional information** if the instruction is incomplete or ambiguous. ### Intended Users - Kubernetes administrators - DevOps engineers - Developers working with Kubernetes clusters ### Training Process - **Base Model:** Unsloth's DeepSeek-R1-Distill-Llama-8B - **Fine-tuning:** Leveraged the Unsloth framework and Hugging Face's TRL library for efficient training. - **Training Data:** Customized dataset focused on Kubernetes operations, including: - **`kubectl` Command Generation:** Commands for various Kubernetes tasks. - **Clarification Requests:** Responses requesting specific information when instructions are incomplete. - **Explanations:** Concise explanations of Kubernetes concepts. - The dataset contains approximately 1,500 entries. --- ## Model Features ### 1. Command Generation in Bash Format When the model generates CLI commands, it provides them in `bash` format, enclosed within code blocks for easy execution and clarity. This allows users to copy and paste the commands directly into their terminal. ### 2. Handling Ambiguity with Polite Clarifications If the instruction is incomplete or ambiguous, the model will politely ask for the specific missing information instead of making assumptions. This ensures accuracy and prevents the execution of incorrect commands. ### 3. Providing Concise Explanations For general Kubernetes questions, the model offers concise and accurate explanations without unnecessary details, helping users understand concepts quickly. ### 4. Enhanced Accuracy with 8B Model The transition to the 8B model has significantly **improved accuracy and reduced hallucinations** compared to smaller models. The 8B model provides more precise and reliable responses, enhancing the overall user experience. --- ## Examples ### Example 1: Generating a Command **Instruction:** ``` Get the list of all pods in the 'staging' namespace. ``` **Response:** ```bash kubectl get pods -n staging ``` --- ### Example 2: Handling Ambiguity **Instruction:** ``` Delete the deployment. ``` **Response:** ``` Please specify the name of the deployment you wish to delete. ``` --- ### Example 3: Providing Explanations **Instruction:** ``` What is a StatefulSet in Kubernetes? ``` **Response:** ``` A StatefulSet manages the deployment and scaling of a set of pods, providing guarantees about the ordering and uniqueness of those pods. It's commonly used for stateful applications requiring stable network identities and persistent storage. ``` --- ## Limitations and Considerations - **Accuracy:** While the 8B model significantly improves accuracy, the model may occasionally produce incorrect or suboptimal commands. Always review the output before execution. - **Resource Requirements:** The 8B model may require more computational resources compared to smaller models. Ensure your environment meets the necessary requirements for smooth operation. - **Security:** Be cautious when executing generated commands, especially in production environments. --- ## Feedback and Contributions We welcome any comments or participation to improve the model and dataset. If you encounter issues or have suggestions for improvement: - **GitHub:** [Unsloth Repository](https://github.com/unslothai/unsloth) - **Contact:** Reach out to the developer, **dereklck**, for further assistance. --- **Note:** This model provides assistance in generating Kubernetes commands and explanations based on user input. Always verify the generated commands in a safe environment before executing them in a production cluster. --- ## Summary The **Kubernetes Assistant Model (8B)** is a powerful tool designed to help users interact with Kubernetes clusters more efficiently. By leveraging advanced language modeling techniques, the model provides accurate `kubectl` commands, helpful explanations, and polite clarifications when necessary. The use of the 8B model enhances the precision and reliability of responses, making it a valuable asset for anyone working with Kubernetes. ---