Skip to content

Commit bd9ecbf

Browse files
authored
Update api-change.md
Signed-off-by: Zhenhuan Chen <[email protected]>
1 parent 5777444 commit bd9ecbf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

docs/source/developer-guide/api-change.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,25 @@ All API schemas are:
4545
Argument names should describe what the argument represents, not how it is used internally.
4646

4747
**Good**: `max_new_tokens` (clear meaning)
48+
4849
**Bad**: `num` (ambiguous)
4950

5051
**Reflect Argument Type and Granularity**
5152

5253
- For **boolean** knobs, prefix with verbs like `enable_` and so on.
54+
5355
Examples: `enable_cache`, `enable_flash_attention`
5456

5557
- For **numerical threshold** knobs, suffix with `_limit`, `_size`, `_count`, `_len_` or `_ratio`
58+
5659
Examples: `max_seq_len`, `prefill_batch_size`
5760

5861
**Avoid Redundant Prefixes**
5962

6063
Example (in `MoeConfig`):
6164

6265
**Good**: `backend`
66+
6367
**Bad**: `moe_backend` (redundant since it's already in `MoeConfig`)
6468

6569
**Use Specific Names for Narrow Scenarios**
@@ -69,6 +73,7 @@ When adding knobs for specific use cases, make the name convey the restriction c
6973
Example (argument to the LLM class):
7074

7175
**Good**: `rope_scaling_factor` → clearly indicates it's for RoPE
76+
7277
**Bad**: `scaling_factor` → too generic and prone to misuse
7378

7479
### 2. Hierarchical Configuration
@@ -78,12 +83,15 @@ Organize complex or hierarchical arguments into **dedicated configuration datacl
7883
**Guidelines**
7984

8085
- Use the `XxxConfig` suffix consistently
86+
8187
Examples: `ModelConfig`, `ParallelConfig`, `MoeConfig`
8288

8389
- **Reflect conceptual hierarchy**
90+
8491
The dataclass name should represent a coherent functional unit, not an arbitrary grouping
8592

8693
- **Avoid over-nesting**
94+
8795
Use only one level of configuration hierarchy whenever possible (e.g., `LlmArgs → ParallelConfig`) to balance readability and modularity
8896

8997
### 3. Prefer `LlmArgs` Over Environment Variables

0 commit comments

Comments
 (0)