Skip to content

Commit 962402c

Browse files
authored
Merge pull request #25 from ml-cube/dev-llm-security-pipeline
LLM security and specifications docs
2 parents e94fcae + c48fd49 commit 962402c

File tree

10 files changed

+302
-2972
lines changed

10 files changed

+302
-2972
lines changed

md-docs/tables/rbac_company.csv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Role,DELETE_COMPANY,CHANGE_COMPANY_OWNER,MANAGE_COMPANY_ADMIN,MANAGE_COMPANY_USER,CHANGE_COMPANY_USER_ROLE,UPDATE_COMPANY_INFORMATION,READ_COMPANY,CREATE_PROJECT
22
COMPANY_OWNER,:material-check:,:material-check:,:material-check:,:material-check:,:material-check:,:material-check:,:material-check:,:material-check:
3-
COMPANY_ADMIN,:material-close:,:material-close:,:material-close:,:material-check:,:material-check:,:material-check:,:material-check:,:material-check:
4-
COMPANY_USER,:material-close:,:material-close:,:material-close:,:material-close:,:material-close:,:material-close:,:material-check:,:material-close:
5-
COMPANY_NONE,:material-close:,:material-close:,:material-close:,:material-close:,:material-close:,:material-close:,:material-close:,:material-close:
3+
COMPANY_ADMIN," "," "," ",:material-check:,:material-check:,:material-check:,:material-check:,:material-check:
4+
COMPANY_USER," "," "," "," "," "," ",:material-check:," "
5+
COMPANY_NONE," "," "," "," "," "," "," "," "

md-docs/tables/rbac_project.csv

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Role,DELETE_PROJECT,MANAGE_PROJECT_ADMIN,UPDATE_PROJECT_INFORMATION,MANAGE_PROJECT_USER,CHANGE_PROJECT_USER_ROLE,WORK_ON_PROJECT,READ_PROJECT
22
COMPANY_OWNER,:material-check:,:material-check:,:material-check:,:material-check:,:material-check:,:material-check:,:material-check:
33
COMPANY_ADMIN,:material-check:,:material-check:,:material-check:,:material-check:,:material-check:,:material-check:,:material-check:
4-
COMPANY_USER,:material-close:,:material-close:,:material-close:,:material-close:,:material-close:,:material-close:,:material-close:
5-
COMPANY_NONE,:material-close:,:material-close:,:material-close:,:material-close:,:material-close:,:material-close:,:material-close:
6-
PROJECT_ADMIN,:material-close:,:material-close:,:material-check:,:material-check:,:material-check:,:material-check:,:material-check:
7-
PROJECT_USER,:material-close:,:material-close:,:material-close:,:material-close:,:material-close:,:material-check:,:material-check:
8-
PROJECT_VIEW,:material-close:,:material-close:,:material-close:,:material-close:,:material-close:,:material-close:,:material-check:
4+
COMPANY_USER," "," "," "," "," "," "," "
5+
COMPANY_NONE," "," "," "," "," "," "," "
6+
PROJECT_ADMIN," "," ",:material-check:,:material-check:,:material-check:,:material-check:,:material-check:
7+
PROJECT_USER," "," "," "," "," ",:material-check:,:material-check:
8+
PROJECT_VIEW," "," "," "," "," "," ",:material-check:

md-docs/user_guide/data.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ When you upload samples belonging to a Data Category, they must contain all the
2323

2424
The following table shows these relationships:
2525

26-
| Data Category | ID | Time ID | Input | Input additional embedding | Target | Target additional embedding | Prediction | Prediction additional embedding |
27-
| -- | -- | -- | -- | -- | -- | -- | -- | -- |
28-
| Input | :material-check: | :material-check: | :material-check: | :material-check: | :material-close: | :material-close: | :material-close: | :material-close: | :material-close: |
29-
| Target | :material-check: | :material-check: | :material-close: | :material-close: | :material-check: | :material-check: | :material-close: | :material-close: | :material-close: |
30-
| Prediction | :material-check: | :material-check: | :material-close: | :material-close: | :material-close: | :material-close: | :material-check: | :material-check: | :material-close: |
26+
| Data Category | ID | Time ID | Input | Input additional embedding | Target | Target additional embedding | Prediction | Prediction additional embedding |
27+
|---------------|------------------|------------------|------------------|----------------------------|------------------|-----------------------------|------------------|---------------------------------|
28+
| Input | :material-check: | :material-check: | :material-check: | :material-check: | | | | | |
29+
| Target | :material-check: | :material-check: | | | :material-check: | :material-check: | | | |
30+
| Prediction | :material-check: | :material-check: | | | | | :material-check: | :material-check: | |
3131

3232
!!! note
3333
As you can see Column's Roles ID and Time Id are always required because are used by ML cube Platform to correctly link data units together.

md-docs/user_guide/model.md

Lines changed: 74 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ for its training usually represent the reference data distribution, while produc
55
performs inference.
66
For more information about reference and production data see the [Data] page.
77

8-
A Model is uniquely associated with a [Task] and it can be created both through the WebApp and the Python SDK.
8+
A Model is uniquely associated with a [Task], and it can be created both through the WebApp and the Python SDK.
99
Currently, we support only one model per Task.
1010

1111
A Model is defined by a name and a version. The version is updated whenever the model is retrained, allowing to
@@ -19,19 +19,85 @@ predictions are associated to the correct model version.
1919
the ML cube Platform is considered *model agnostic*.
2020

2121

22-
### RAG Model
22+
## RAG Model
2323

2424
RAG Tasks represent an exception to the model framework presented before. In this type of Tasks, the model
2525
is a Large Language Model (LLM), that is used to generate responses to user queries. The model is not trained on a specific dataset
26-
but is rather a pre-trained model, sometimes finetuned on custom domain data, which means that the classic process of training and
26+
but is rather a pre-trained model, sometimes fine-tuned on custom domain data, which means that the classic process of training and
2727
retraining does not apply.
2828

2929
To maintain a coherent Model definition across task types, the RAG model is also represented as a Model,
3030
but an update of its version represents an update of the reference data distribution and not necessarily
3131
a retraining of the model itself. Moreover, most of the attributes which will be described in the following sections
3232
are not applicable, as they are related to the retraining module, which is not available for RAG tasks.
3333

34-
### Probabilistic output
34+
### LLM Specifications
35+
36+
For RAG Tasks, you can provide the specifications of the underlying LLMs used in the RAG system.
37+
This information is used by the [LLM Security Module](modules/llm_security.md) to provide insights on the security of the LLMs
38+
used in the RAG system. Currently, we support only LLMs accessible via API.
39+
40+
The specifications include the following information:
41+
42+
| Field | Description |
43+
|---------------------|-----------------------------------------------------------------------------------------------------------------------|
44+
| LLM Provider | The provider of the LLM used. |
45+
| LLM name | The name of the LLM model. |
46+
| Temperature | The temperature used by the LLM model. |
47+
| Top P | The top P used by the LLM model. |
48+
| Top K | The top K used by the LLM model. |
49+
| Max tokens | The max output tokens used by the LLM model. |
50+
| Time intervals | The time intervals where the LLM model is used. |
51+
| Role | The role assigned to the LLM to interpret (part of the system prompt) |
52+
| Task | The task assigned to the LLM to solve (part of the system prompt) |
53+
| Behavior Guidelines | A list of guidelines used to define the general behavior of the LLM (part of the system prompt) |
54+
| Security Guidelines | A list of guidelines designed to protect the LLM against attacks, or information leakage (part of the system prompt) |
55+
56+
!!! note
57+
Providing the LLM specifications is optional; however, providing them improves the quality of the [LLM Security Module](modules/llm_security.md) insights.
58+
59+
??? example "LLM Specifications example"
60+
An example of LLM specifications is:
61+
62+
- **LLM Provider**: "OpenAI",
63+
- **LLM name**: "GPT-3",
64+
- **Temperature**: 0.7,
65+
- **Top P**: 0.9,
66+
- **Top K**: None,
67+
- **Max tokens**: 100,
68+
- **Time intervals**: "2022-01-01 00:00:00 - 2022-01-31 23:59:59",
69+
- **Role**: "You are an helpful assistant, "
70+
- **Task**: "your goal is to provide accurate and useful information to the users. You must follow these rules:"
71+
- **Behavior Guidelines**:
72+
1. "1) Be polite, "
73+
2. "2) Be concise, "
74+
- **Security Guidelines**:
75+
1. "3) Do not provide personal information, "
76+
2. "4) Do not provide harmful information, "
77+
78+
The time intervals represent periods during which a LLM specification is used inside the RAG model. A single LLM Specification can be active across multiple time intervals.
79+
80+
For any given platform model, only one LLM specification can be active at a time, though this specification can change over time.
81+
It's also possible to designate an LLM as active indefinitely until a new one is introduced. In this case, the end date of the current time interval remains unset. When a new LLM is deployed, you can specify the exact date when the transition occurs.
82+
83+
??? example "Time Intervals example"
84+
Considering a single platform Model, is possible to have a situation like this:
85+
86+
1. **LLM specifications id_1**, with time intervals:
87+
- "2024-01-01 00:00:00 - 2024-01-31 23:59:59",
88+
- "2024-05-01 00:00:00 - 2024-05-31 23:59:59",
89+
90+
2. **LLM specifications id_2**, with time intervals:
91+
- "2024-02-01 00:00:00 - 2024-04-30 23:59:59",
92+
- "2024-06-01 00:00:00 - <NOT SET\>",
93+
94+
In this case, the current LLM specification is id_2.
95+
If a new LLM specification id_3 is introduced, or an old one is re-set, with a start date of "2024-11-11 00:00:00", the time interval of id_2 will be updated to:
96+
97+
- "2024-02-01 00:00:00 - 2024-04-30 23:59:59",
98+
- "2024-06-01 00:00:00 - 2024-11-10 23:59:59."
99+
100+
## Probabilistic output
35101

36102
When creating a model, you can specify if you want to provide also the probabilistic output of the model along with the predictions.
37103
The probabilistic output represents the probability or confidence score associated with the model's predictions. If provided,
@@ -44,7 +110,7 @@ as a new column in the predictions file, following the guidelines in the [Data S
44110
For example, Logistic Regression classification model provides both the probability of belonging to the positive class and the predicted class using a threshold.
45111
In this case, you can upload to ML cube Platform the predicted class as principal prediction and the probability as probabilistic output.
46112

47-
### Model Metric
113+
## Model Metric
48114

49115
A Model Metric represents the evaluation metric used to assess the performance of the model.
50116
It can both represent a performance or an error. The chosen metric will be used in the various views of the WebApp to
@@ -69,19 +135,19 @@ RAG tasks have no metric, as in that case the model is an LLM for which classic
69135
Model Metrics should not be confused with [Monitoring Metrics](monitoring/index.md#monitoring-metrics), which are
70136
entities being monitoring by the ML cube Platform and not necessarily related to a Model.
71137

72-
### Suggestion Type
138+
## Suggestion Type
73139

74140
The Suggestion Type represents the type of suggestion that the ML cube Platform should provide when computing the
75141
[Retraining Dataset](modules/retraining.md#retraining-dataset). The available options are provided in the related section.
76142

77143

78-
### Retraining Cost
144+
## Retraining Cost
79145

80146
The Retraining Cost represents the cost associated with retraining the model. This information is used by the Retraining Module
81147
to provide gain-cost analysis and insights on the retraining process. The cost is expressed in the same currency as the one used
82148
in the Task cost information. The default value is 0.0, which means that the cost is negligible.
83149

84-
### Retrain Trigger
150+
## Retrain Trigger
85151

86152
You can associate a [Retrain Trigger] to your Model in order to enable the automatic initiation of your retraining pipeline
87153
from the ML cube Platform. More information on how to set up a retrain trigger can be found in the related section.

0 commit comments

Comments
 (0)