Frost2o24 commited on
Commit
edceceb
·
verified ·
1 Parent(s): a3a4333

Add dataset card

Browse files
Files changed (1) hide show
  1. README.md +142 -0
README.md ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ task_categories:
4
+ - text-generation
5
+ language:
6
+ - en
7
+ tags:
8
+ - bash
9
+ - shell
10
+ - code
11
+ - instruction-tuning
12
+ - sft
13
+ - command-line
14
+ size_categories:
15
+ - 10K<n<100K
16
+ pretty_name: Bash Instruction-Tuning Dataset
17
+ configs:
18
+ - config_name: default
19
+ data_files: bash_dataset.jsonl
20
+ ---
21
+
22
+ # Bash Instruction-Tuning Dataset (~55k)
23
+
24
+ A synthetic instruction-tuning dataset that pairs natural-language requests with
25
+ correct Bash solutions, built for fine-tuning small LLMs to translate plain
26
+ requests into runnable shell commands, pipelines, and scripts.
27
+
28
+ Each example is a chat conversation (system / user / assistant) plus two metadata
29
+ fields (`category`, `utility`) for slicing and analysis.
30
+
31
+ ## Format
32
+
33
+ One JSON object per line (`bash_dataset.jsonl`):
34
+
35
+ ```json
36
+ {
37
+ "messages": [
38
+ {"role": "system", "content": "You are a Bash expert."},
39
+ {"role": "user", "content": "Show the last 20 lines of error.log."},
40
+ {"role": "assistant", "content": "tail -n 20 error.log"}
41
+ ],
42
+ "category": "single",
43
+ "utility": "tail"
44
+ }
45
+ ```
46
+
47
+ - `messages` — the training conversation. The system prompt is one of 5 equivalent
48
+ Bash-assistant prompts (rotated so the model doesn't overfit a single string).
49
+ - `category` — `single` | `pipeline` | `script` (see below).
50
+ - `utility` — the primary command of the solution (e.g. `grep`, `awk`, `find`,
51
+ `for`), used to enforce a per-command cap and to analyze coverage.
52
+
53
+ Scripts (`category == "script"`) contain real multi-line Bash (JSON-escaped `\n`),
54
+ typically with `set -euo pipefail`, functions, `getopts`, `trap` cleanup, loops,
55
+ here-docs, etc.
56
+
57
+ ## Statistics
58
+
59
+ | Metric | Value |
60
+ |---|---|
61
+ | Examples | 55,000 |
62
+ | `single` (one-shot commands) | 22,000 (40%) |
63
+ | `pipeline` (pipes, `&&`/`\|\|`, `$(...)`, `xargs`) | 19,250 (35%) |
64
+ | `script` (multi-line) | 13,750 (25%) |
65
+ | Distinct primary utilities | 89 |
66
+ | Max share of any one utility | 4.00% (hard cap 2,200/util) |
67
+ | Unique user (NL) strings | 92.9% |
68
+ | Unique assistant (Bash) strings | 75.3% |
69
+
70
+ **Validity**: 100% pass `bash -n` (0 syntax errors). Static analysis with
71
+ shellcheck flags no warning-level findings on **96.3%** of a 4,000-example sample;
72
+ almost all remaining findings are a single style nit (`SC2010`, `ls | grep`).
73
+
74
+ **Coverage of system/info utilities** that small models often get wrong
75
+ (counts include single + pipeline + script uses):
76
+
77
+ | util | n | util | n | util | n |
78
+ |---|---|---|---|---|---|
79
+ | journalctl | 2200 | lsof | 648 | ss | 481 |
80
+ | pstree | 753 | renice | 365 | nice | 293 |
81
+ | vmstat | 288 | netstat | 234 | iostat | 183 |
82
+ | w | 158 | dmesg | 154 | free | 90 |
83
+ | uptime | 34 | hostname | 25 | | |
84
+
85
+ (`uptime` / `hostname` are lower because their genuine idiomatic command space is
86
+ small; they are covered with real flag variants rather than padded phrasings.)
87
+
88
+ ## How it was built
89
+
90
+ Generated by a recipe engine (`generate.py`, included). Each recipe family emits
91
+ `(request, command)` pairs by combining hand-written phrasing templates
92
+ (imperative / question / casual) with realistic parameter pools (plausible file
93
+ names, directories, ports, services, users, patterns). The generator enforces:
94
+
95
+ - category quotas (40 / 35 / 25),
96
+ - a 4% per-utility cap so no command dominates (a real failure mode of earlier runs),
97
+ - minimum floors for the info/system utilities above,
98
+ - SHA-1 deduplication of `(request, command)` pairs,
99
+ - a `bash -n` syntax gate on every command before it is written.
100
+
101
+ ## Loading
102
+
103
+ ```python
104
+ from datasets import load_dataset
105
+ ds = load_dataset("json", data_files="bash_dataset.jsonl", split="train")
106
+ print(ds[0]["messages"])
107
+
108
+ # analyze by slice
109
+ import collections
110
+ print(collections.Counter(ds["category"]))
111
+ print(collections.Counter(ds["utility"]).most_common(15))
112
+ ```
113
+
114
+ The dataset viewer will expose `messages`, `category`, and `utility` as columns.
115
+
116
+ ## Intended use & limitations
117
+
118
+ **Good for**: teaching a small model to map natural-language requests to correct
119
+ single Bash commands, short pipelines, and small scripts — including the
120
+ system/info utilities listed above.
121
+
122
+ **Limitations (be aware before relying on it):**
123
+
124
+ - **Synthetic / semi-templated.** Variety comes from recombining templates and
125
+ token pools, not from human authorship. Phrasing shapes repeat (e.g. most
126
+ script requests open with "Write a script that…"); ~25% of commands recur with
127
+ different phrasings.
128
+ - **Validity ≠ full semantic correctness.** `bash -n` + shellcheck prove the
129
+ commands parse and are lint-clean; they do not prove every command perfectly
130
+ satisfies its request. Some pairs are plausible-but-approximate (e.g. an `awk`
131
+ column index assumes a particular log layout).
132
+ - **Single-turn, one canonical answer.** No explanations, alternatives, negative
133
+ examples, or multi-turn dialogue.
134
+ - **Not executed at scale on real Linux.** Many commands (`systemctl`,
135
+ `journalctl`, `apt`, `vmstat`, …) are idiomatic but were validated statically,
136
+ not run.
137
+
138
+ ## Files
139
+
140
+ - `bash_dataset.jsonl` — the dataset (55,000 rows).
141
+ - `generate.py` — the generator (reproducible; resumable via `progress.json`).
142
+ - `README.md` — this card.