Hybrid Kubernetes Feature Model
- Developed by: dereklck
- License: Apache-2.0
- Fine-tuned from model: unsloth/Llama-3.2-3B-Instruct-bnb-4bit
- 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:
- Generating accurate
kubectl
commands based on user descriptions. - Providing concise explanations about Kubernetes for general queries.
- Politely requesting additional information if the instruction is incomplete or ambiguous.
Update: Compared to the previous 1B model, the 3B model significantly reduces hallucinations that sometimes occurred in the 1B model. Users can expect improved accuracy and reliability when interacting with this model.
The model was trained efficiently using 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 on your system.
- Ensure you have access to the model hosted on Hugging Face:
hf.co/dereklck/kubernetes_operator_3b_peft_gguf
.
Steps
Create the Modelfile
Save the following content as a file named
Modelfile
:FROM hf.co/dereklck/kubernetes_operator_3b_peft_gguf PARAMETER temperature 0.3 PARAMETER stop "</s>" TEMPLATE """ You are an AI assistant that helps users with Kubernetes commands and questions. **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, or context. - **Enclose the command within a code block** with `bash` syntax highlighting. 2. **For incomplete or ambiguous instructions:** - **Politely ask** the user for the specific missing information. - Do **not** provide any commands or placeholders in your response. - Respond in plain text, clearly stating what information is needed. 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. **Important Rules:** - **Do not generate CLI commands containing placeholders (e.g., <pod_name>, <resource_name>).** - Ensure all CLI commands are complete, valid, and executable as provided. - If user input is insufficient to form a complete command, ask for clarification instead of using placeholders. - Provide only the necessary CLI command output without any additional text. ### Instruction: {{ .Prompt }} ### Response: {{ .Response }} </s> """
Create the Model with Ollama
Open your terminal and run the following command to create the model:
ollama create hybrid_kubernetes_feature_model -f Modelfile
This command tells Ollama to create a new model named
hybrid_kubernetes_feature_model
using the configuration specified inModelfile
.Run the Model
Start interacting with your model:
ollama run hybrid_kubernetes_feature_model
This will initiate the model and prompt you for input based on the template provided.
Alternatively, you can provide an instruction directly:
ollama run hybrid_kubernetes_feature_model -p "Create a namespace called 'production'."
Example Output:
kubectl create namespace production
Model Details
Purpose
The model assists users by:
- Generating accurate
kubectl
commands based on natural language descriptions. - 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 Llama-3.2-3B-Instruct-bnb-4bit
- Fine-tuning: Leveraged the Unsloth framework and Hugging Face's TRL library for efficient training.
- Training Data: Customized dataset focused on Kubernetes operations and features, including
kubectl
command usage and general Kubernetes concepts, containing 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 3B Model
The transition to the 3B model has significantly reduced hallucinations that sometimes occurred in the 1B model. The 3B model provides more accurate and reliable responses, improving the overall user experience.
Examples
Example 1: Generating a Command
Instruction:
Create a namespace called 'development'.
Response:
kubectl create namespace development
Example 2: Handling Ambiguity
Instruction:
Show me logs.
Response:
Which pod's logs would you like to retrieve?
Example 3: Providing Explanations
Instruction:
What is a Deployment in Kubernetes?
Response:
A Deployment provides declarative updates for Pods and ReplicaSets, allowing you to manage your applications by defining the desired state and letting Kubernetes handle the rest.
Limitations and Considerations
- Accuracy: While the 3B model improves accuracy, the model may occasionally produce incorrect or suboptimal commands. Always review the output before execution.
- 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
- 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.
If you have any further requests or need additional adjustments, please let me know!
Model tree for dereklck/kubernetes_operator_3b_peft
Base model
meta-llama/Llama-3.2-3B-Instruct