Chapter 3. Adding skills to your taxonomy tree
The starter model can learn custom skills by populating the qna.yaml
file with your domain specific skill. Each qna.yaml
file for skills contains a set of key-value entries with the following keys:
Field | Desciption | Restraints |
---|---|---|
|
The version of the | The currently supported value for this parameter is 2. |
| Your Git username or name of contributor. | None |
| A description of your skill and its function. | None |
| A collection of key and value entries. |
Each |
| Grounded skills require the user to provide additional context containing information that the model needs to know for executing the skill. |
This filed is required for grounded skills. Each |
| Specify a question for the model. |
Each |
| Specify an answer for the model. |
Each |
3.1. Creating a skill YAML file
You can customize your taxonomy tree so the model can learn new skills for your desired use cases. The following procedure displays how to create a taxonomy tree that contains your skill qna.yaml
file.
Prerequisites
- You installed RHEL AI with the bootable container image.
-
You initialized InstructLab and can use the
ilab
CLI. - You have root user access on your machine.
Procedure
Navigate to the
compositional_skills
folder the taxonomy directory.ImportantCreating foundational skills, skills involving creating code, is not currently supported on RHEL AI version 1.5.
Based on the directories that exist in the tree, select where in the tree you want to add your skill
qna.yaml
file.Example file path in the taxonomy tree
taxonomy/compositional_skills/grounded/<add_example>/qna.yaml
taxonomy/compositional_skills/grounded/<add_example>/qna.yaml
Copy to Clipboard Copied! Using your desired text editor, create the
qna.yaml
file.NoteFor SDG to run properly, you must include at least five question and answer pair examples in your
qna.yaml
file.-
Add the necessary keys to the
qna.yaml
file and save your changes. For more information on formatting yourqna.yaml
file, see "Sample skill YAML specifications".
Verification
To verify that your skill is in the proper format, you can run the following command:
ilab taxonomy diff
$ ilab taxonomy diff
Copy to Clipboard Copied! The CLI displays if your taxonomy tree and
qna.yaml
file is valid and properly formatted. The CLI also displays where to fix any errors you may encounter.Example output of valid taxonomy tree and
qna.yaml
filecompositional_skills/writing/freeform/<example>/qna.yaml Taxonomy in /taxonomy/ is valid :)
compositional_skills/writing/freeform/<example>/qna.yaml Taxonomy in /taxonomy/ is valid :)
Copy to Clipboard Copied! Example output of invalid taxonomy tree and
qna.yaml
file with errors6:11 error syntax error: mapping values are not allowed here (syntax) Reading taxonomy failed with the following error: 1 taxonomy with errors! Exiting.
6:11 error syntax error: mapping values are not allowed here (syntax) Reading taxonomy failed with the following error: 1 taxonomy with errors! Exiting.
Copy to Clipboard Copied!
3.2. Sample skills YAML specifications
Skills share a similar question and answer layout as knowledge YAML files. On RHEL AI, the synthetic data generation (SDG) process uses your qna.yaml
seed examples to create a large set of artificial data for the model to learn, rather than relying exclusively on user generated data.
The order of the question, answer, and context pairs does not influence the SDG or training process. There are multiple types of skills that are split into categories: freeform, grounded, and foundational skills. You can see samples of each category in the following examples:
Example freeform compositional skill qna.yaml
file
version: 2 created_by: <user-name> task_description: 'Teach the model how to rhyme.' seed_examples: - question: What are 5 words that rhyme with horn? answer: warn, torn, born, thorn, and corn. - question: What are 5 words that rhyme with cat? answer: bat, gnat, rat, vat, and mat. - question: What are 5 words that rhyme with poor? answer: door, shore, core, bore, and tore. - question: What are 5 words that rhyme with bank? answer: tank, rank, prank, sank, and drank. - question: What are 5 words that rhyme with bake? answer: wake, lake, steak, make, and quake.
version: 2
created_by: <user-name>
task_description: 'Teach the model how to rhyme.'
seed_examples:
- question: What are 5 words that rhyme with horn?
answer: warn, torn, born, thorn, and corn.
- question: What are 5 words that rhyme with cat?
answer: bat, gnat, rat, vat, and mat.
- question: What are 5 words that rhyme with poor?
answer: door, shore, core, bore, and tore.
- question: What are 5 words that rhyme with bank?
answer: tank, rank, prank, sank, and drank.
- question: What are 5 words that rhyme with bake?
answer: wake, lake, steak, make, and quake.
Example grounded compositional skill qna.yaml
file
version: 2 created_by: <user-name> task_description: This skill provides the ability to read a markdown-formatted table. seed_examples: - context: | | **Breed** | **Size** | **Barking** | **Energy** | |----------------|--------------|-------------|------------| | Afghan Hound | 25-27 in | 3/5 | 4/5 | | Labrador | 22.5-24.5 in | 3/5 | 5/5 | | Cocker Spaniel | 14.5-15.5 in | 3/5 | 4/5 | | Poodle (Toy) | <= 10 in | 4/5 | 4/5 | question: | Which breed has the most energy? answer: | The breed with the most energy is the Labrador. - context: | | **Name** | **Date** | **Color** | **Letter** | **Number** | |----------|----------|-----------|------------|------------| | George | Mar 5 | Green | A | 1 | | Gráinne | Dec 31 | Red | B | 2 | | Abigail | Jan 17 | Yellow | C | 3 | | Bhavna | Apr 29 | Purple | D | 4 | | Rémy | Sep 9 | Blue | E | 5 | question: | What is Gráinne's letter and what is her color? answer: | Gráinne's letter is B and her color is red. - context: | | Banana | Apple | Blueberry | Strawberry | |--------|------------|-----------|------------| | Yellow | Red, Green | Blue | Red | | Large | Medium | Small | Small | | Peel | Peel | No peel | No peel | question: | Which fruit is blue, small, and has no peel? answer: | The blueberry is blue, small, and has no peel.
version: 2
created_by: <user-name>
task_description: This skill provides the ability to read a markdown-formatted table.
seed_examples:
- context: |
| **Breed** | **Size** | **Barking** | **Energy** |
|----------------|--------------|-------------|------------|
| Afghan Hound | 25-27 in | 3/5 | 4/5 |
| Labrador | 22.5-24.5 in | 3/5 | 5/5 |
| Cocker Spaniel | 14.5-15.5 in | 3/5 | 4/5 |
| Poodle (Toy) | <= 10 in | 4/5 | 4/5 |
question: |
Which breed has the most energy?
answer: |
The breed with the most energy is the Labrador.
- context: |
| **Name** | **Date** | **Color** | **Letter** | **Number** |
|----------|----------|-----------|------------|------------|
| George | Mar 5 | Green | A | 1 |
| Gráinne | Dec 31 | Red | B | 2 |
| Abigail | Jan 17 | Yellow | C | 3 |
| Bhavna | Apr 29 | Purple | D | 4 |
| Rémy | Sep 9 | Blue | E | 5 |
question: |
What is Gráinne's letter and what is her color?
answer: |
Gráinne's letter is B and her color is red.
- context: |
| Banana | Apple | Blueberry | Strawberry |
|--------|------------|-----------|------------|
| Yellow | Red, Green | Blue | Red |
| Large | Medium | Small | Small |
| Peel | Peel | No peel | No peel |
question: |
Which fruit is blue, small, and has no peel?
answer: |
The blueberry is blue, small, and has no peel.
- 1 1
- Specify the version of the skill
qna.yaml
format. - 2 2
- Specify your name or git username.
- 3 3
- Specify a description of your skill and its function.
- 4
- Specify additional context containing information that the model needs to know for executing the skill. Required for grounded skills.
- 4 5
- Specify a question for the model.
- 5 6
- Specify the desired response from the model.