TL;DR: A deterministic Phi-3 fine-tune that converts natural language into a single, canonical, POSIX-safe Bash command — no explanations, no pipelines.
phi3-nl2bash-canonical
Model Summary
phi3-nl2bash-canonical is a task-specialized small language model fine-tuned to translate
natural-language instructions into minimal, valid Bash commands.
The model is intentionally constrained to produce single, canonical, POSIX-safe commands
without explanations, pipelines, subshells, or side effects.
This model is designed for command-line education, tooling, and evaluation, not for general-purpose chat.
Base Model
- microsoft/phi-3-mini-4k-instruct
Training Data
The model was fine-tuned using a curated subset of the NL2Bash dataset combined with synthetic examples generated from a manually verified command core.
Dataset characteristics:
- Only local, single-command Bash instructions
- No pipelines, redirections, subshells, SSH, rsync, or environment variables
- Restricted command set (e.g.,
ls,cd,mkdir,touch,cp,mv,chmod,cat,head,tail,basename,dirname,wc) - Synthetic augmentation used to improve coverage while preserving canonical form
The goal was precision and determinism, not breadth.
Training Method
- Parameter-efficient fine-tuning (LoRA)
- Conservative hyperparameters to avoid catastrophic forgetting
- Instruction format: ChatML-style (
<|user|>,<|assistant|>,<|end|>)
Model Variants
This repository contains multiple formats:
FP16 GGUF (
gguf/fp16/):
Canonical archival format for reproducibility and re-quantizationQ4_0 GGUF (
gguf/q4_0/):
CPU-efficient quantized model suitable for local inference (e.g., Ollama, llama.cpp)
Usage
Ollama
Example Modelfile:
FROM ./phi3-nl2bash-canonical-17012026.q4_0.gguf
SYSTEM You output only valid bash commands.
SYSTEM No explanations or markdown.
TEMPLATE """<|user|>
{{ .Prompt }}
<|assistant|>
"""
PARAMETER stop "<|end|>"
PARAMETER temperature 0
Example
Prompt:
create a file called a
Output:
touch a
Intended Use
- Teaching command-line basics
- Evaluating NL→CLI translation
- Safe, constrained automation
Out of Scope
- Complex shell scripting
- Remote execution
- File discovery or destructive commands
- General-purpose conversation
Limitations
This model intentionally trades expressiveness for safety and determinism.
It may refuse or oversimplify complex requests.
Ethics & Safety
The model was trained to avoid unsafe shell constructs and does not generate commands involving networking, privilege escalation, or destructive operations unless explicitly specified in the prompt.
Citation
If you use this model in academic work, please cite the accompanying repository.Developed as part of an academic thesis (2026).
- Downloads last month
- 160