File size: 4,274 Bytes
deec802
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
license: apache-2.0
language:
- en
task_categories:
- text-generation
tags:
- nushell
- tool-calling
- synthetic
- shell
size_categories:
- 1K<n<10K
configs:
- config_name: default
  data_files:
  - split: train
    path: train.jsonl
  - split: test
    path: held_out.jsonl
---

# Nushell tool calls

1,203 requests, each with the one `run_nushell` call that answers it and the value that call returns, over 20 small generated projects. Everything is generated: the projects from seeds, the commands by sampling Nushell's own command signatures and keeping only chains that run, the requests by a small language model (LFM3 1.7B) in six styles. Nothing was written by hand.

It was made to fine-tune [LFM3 1.7B](https://huggingface.co/maxhugger/nushell-lfm3-1.7b-lora), which goes from 8% to 92.6% correct on the held-out split, scored by executing its calls.

## Files

| File | Rows | What it is |
|---|---|---|
| `train.jsonl` | 972 | Requests over 16 projects |
| `held_out.jsonl` | 231 | Requests over 4 projects that are held out whole |
| `environments.jsonl` | 20 | Each generated project: its seed, layout and every file's content |
| `chains.jsonl` | 401 | Each verified command chain with its value and the plain description of its steps |
| `eval_set.jsonl` | 231 | The held-out requests as chat messages with the tool definition, ready to send to any chat endpoint |
| `manifest.json` | | Seeds, generator settings and where the sampling weights came from: enough to regenerate the rest |
| `experiments/grader_*.jsonl` | 6,552 | Request × call rows with broken and equivalent variants of each call (ten failure types), from an experiment that is not part of the main pipeline |

## A row

| Field | Meaning |
|---|---|
| `id`, `chain_id`, `env`, `category` | Which chain and project it comes from |
| `speech` | The request, as a person might type it |
| `style` | The style it was written in (hurried formatting, abbreviations, plain language, part for the whole, analogy), or the composed fallback |
| `context`, `workspace_files` | What the model is told about the project |
| `references` | Syntax notes for the commands involved; present on every other request |
| `completion` | The reference call, as the model writes it after `<tool_call>` |
| `expected` | What the reference call prints when run in that project |

## Scoring

A generated call is correct only if running it in the project returns `expected` (JSON compared by content, text compared exactly). The repository has the runner and `scripts/eval_endpoint.py`, which scores any OpenAI-compatible endpoint the same way.

## Known flaws

- 268 of the 1,203 requests are the composed fallback, which lists the steps stiffly.
- About 4% of requests repeat part of the instruction the request-writing model was given.
- 6 of the held-out requests do not contain what their reference call needs.
- Some values depend on the machine they were generated on: the order `glob` returns entries, the size `ls` reports for a directory, and the time zone of modified times.
- One reference value per request: another reasonable answer counts as wrong.

## Links

- Code, notebook and how everything was made: [maxtheman/nushell-lfm](https://github.com/maxtheman/nushell-lfm)
- LoRA adapter (MLX): [maxhugger/nushell-lfm3-1.7b-lora](https://huggingface.co/maxhugger/nushell-lfm3-1.7b-lora)
- ONNX build for the browser: [maxhugger/nushell-lfm3-1.7b-onnx](https://huggingface.co/maxhugger/nushell-lfm3-1.7b-onnx)
- Dataset: [maxhugger/nushell-tool-calls](https://huggingface.co/datasets/maxhugger/nushell-tool-calls)
- Demo in the browser: [nushell-lfm-demo](https://huggingface.co/spaces/maxhugger/nushell-lfm-demo)
- Nushell in WebAssembly on its own: [nu-wasm](https://huggingface.co/spaces/maxhugger/nu-wasm)

## Sources

Base model: [LiquidAI/LFM3-1.7B](https://huggingface.co/LiquidAI/LFM3-1.7B). Method: Hu et al., *LoRA: Low-Rank Adaptation of Large Language Models*, ICLR 2022 (arXiv:2106.09685). Commands and their signatures: [Nushell](https://github.com/nushell/nushell) 0.117.0. Sampling weights: the Nushell book and cookbook; NL2Bash (Lin et al., LREC 2018); spignelon/bash_history; Shell Aliases on GitHub (Schröder & Cito, 2022). The full list is in the repository's `CITATIONS.md`.