Skip to content

Commit 7d4024b

Browse files
committed
introduce additional_arguments in config.yaml
additional_arguments allows ilab to implicitly support more complex flags from the libraries it calls without adding them directly to the config Signed-off-by: Charlie Doern <[email protected]>
1 parent 1a65993 commit 7d4024b

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed

docs/cli/ilab-config-structure.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Modifying the ilab config structure to be more streamlined
2+
3+
Currently, the `config.yaml` is large with major expansions in training, evaluation, and serving. Expansions help the user understand what the various configuration options are for each of these commands. However, there is a fine line between a verbose config and a cluttered one.
4+
5+
This document describes a new structure for various parts of the config.yaml, and begins to outline how there are different levels of expertise in `ilab` which should dictate which options are available by default.
6+
7+
## `additional_arguments` as a field in training, serving and evaluation
8+
9+
Taking a look at the current training config it looks like:
10+
11+
```yaml
12+
train:
13+
torch_args:
14+
nnodes: 1
15+
node_rank: 0
16+
nproc_per_node: 1
17+
rdzv_endpoint: 127.0.0.1:12222
18+
rdzv_id: 123
19+
train_args:
20+
chat_tmpl_path: /home/ec2-user/instructlab/venv/lib64/python3.11/site-packages/instructlab/training/chat_templates/ibm_generic_tmpl.py
21+
ckpt_output_dir: checkpoints
22+
data_output_dir: train-output
23+
data_path: ./taxonomy_data
24+
deepspeed_options:
25+
cpu_offload_optimizer: true
26+
cpu_offload_optimizer_pin_memory: false
27+
cpu_offload_optimizer_ratio: 1
28+
save_samples: null
29+
effective_batch_size: 100
30+
is_padding_free: false
31+
learning_rate: 2e-6
32+
lora:
33+
alpha: 32
34+
dropout: 0.1
35+
quantize_data_type: nf4
36+
rank: 2
37+
target_modules:
38+
- q_proj
39+
- k_proj
40+
- v_proj
41+
- o_proj
42+
max_batch_len: 1000
43+
max_seq_len: 96
44+
mock_data: false
45+
mock_data_len: 0
46+
model_path: instructlab/granite-7b-lab
47+
num_epochs: 1
48+
random_seed: 42
49+
save_samples: 100
50+
warmup_steps: 10
51+
```
52+
While useful and clear to the user, this config is hard to maintain, and most users will not care about a large portion of the options.
53+
54+
Keeping some of the key options like `num_epochs`, `deepspeed`, `lora`, and key directories a possible training config could look like:
55+
56+
```yaml
57+
train:
58+
train_args:
59+
ckpt_output_dir: checkpoints
60+
data_output_dir: train-output
61+
data_path: ./taxonomy_data
62+
deepspeed_options:
63+
cpu_offload_optimizer: true
64+
cpu_offload_optimizer_pin_memory: false
65+
cpu_offload_optimizer_ratio: 1
66+
save_samples: null
67+
learning_rate: 2e-6
68+
lora:
69+
alpha: 32
70+
dropout: 0.1
71+
quantize_data_type: nf4
72+
rank: 2
73+
target_modules:
74+
- q_proj
75+
- k_proj
76+
- v_proj
77+
- o_proj
78+
max_batch_len: 1000
79+
model_path: instructlab/granite-7b-lab
80+
num_epochs: 1
81+
save_samples: 100
82+
warmup_steps: 10
83+
additional_arguments: ["--is-padding-free=False"...]
84+
```
85+
86+
additional_arguments holds the rest of the training arguments. `ilab` would validate these against an internally maintained list of supported options before passing to the respective library.
87+
88+
The same structure can be applied easily to the serve config.Currently this config looks like:
89+
90+
91+
```yaml
92+
serve:
93+
backend: ''
94+
host_port: 127.0.0.1:8000
95+
llama_cpp:
96+
gpu_layers: -1
97+
llm_family: ''
98+
max_ctx_size: 4096
99+
model_path: models/merlinite-7b-lab-Q4_K_M.gguf
100+
vllm:
101+
vllm_args: []
102+
```
103+
104+
This has the opposite problem as training. The key here is that neither of these options are necessarily wrong, but to have both the verbose structure in the training config juxtaposed against the practically hidden structure of `vllm_args` is not ideal design practice. If we could merge the two approaches to use a common design language that exposes enough key arguments which are commonly edited while also not making the config confusing, this is what we should aim for.
105+
106+
107+
Being very general, this would look something like:
108+
109+
```yaml
110+
serve:
111+
backend: 'vllm'
112+
host_port: 127.0.0.1:8000
113+
max_ctx_size: 5120
114+
gpus: 2
115+
llm_family: ''
116+
model_path: models/merlinite-7b-lab-Q4_K_M.gguf
117+
served_model_name: "merlinite"
118+
additional_arguments: ["--block-size=16", "--dtype=fp8"...]
119+
```
120+
121+
backends like vllm have a large amount of command line options. Adding each and every one of these to our config.yaml is out of the question. However, supporting a large amount implicitly via additional_arguments is a good compromise. Additionally, the above structure lets us choose which ones we think deserve a spot in the config and which are more uncommon or preserved for power users.
122+
123+
This structure also allows us to flatten the config, something that is beneficial for flag mapping and config parsing. Options like max_ctx_size can apply to both vllm and llama-cpp. Options that are only applicable to a singular backend can be validated internally. Nested configs within our config.yaml create a barrier both for the users and for flexibile parsing of the config within `ilab`. additional_arguments will hopefully allow us to move generally away from nested configs in both training and serving.

0 commit comments

Comments
 (0)