wlmbrown commited on
Commit
5ee61ec
·
1 Parent(s): ee6a906

add pseudocode for an orchestrator function and add to-dos for other functions

Browse files
Files changed (2) hide show
  1. compliance_analysis.py +61 -3
  2. project_cc.yaml +22 -2
compliance_analysis.py CHANGED
@@ -27,7 +27,49 @@ project_variables = {
27
 
28
  project_intended_purpose = None
29
 
30
- def run_compliance_analysis_on_project(project_cc_yaml):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  # Determine project type (AI system vs. GPAI model) as well as operator type. We will use these for different things.
33
  project_type = set_type(project_variables, project_cc_yaml)
@@ -40,6 +82,8 @@ def run_compliance_analysis_on_project(project_cc_yaml):
40
  else:
41
  msg = ("Project is not within the scope of what is regulated by the Act.")
42
 
 
 
43
  # # Check for prohibited practices. If any exist, the analysis is over.
44
  # if check_prohibited(project_cc_yaml) == True:
45
  # print("Project contains prohibited practices and is therefore non-compliant.")
@@ -75,9 +119,13 @@ def run_compliance_analysis_on_project(project_cc_yaml):
75
  if not value:
76
  msg = ("Because of project-level characteristics, this high-risk AI system fails the accuracy, robustness, and cybersecurity requirements under Article 17.")
77
 
 
 
 
 
78
  return msg
79
 
80
- def run_compliance_analysis_on_data(data_cc_yaml):
81
 
82
  for key, value in data_cc_yaml['data_and_data_governance']:
83
  if not value:
@@ -92,9 +140,14 @@ def run_compliance_analysis_on_data(data_cc_yaml):
92
  if not value:
93
  msg = (f"Because of the dataset represented by , this high-risk AI system fails the quality management requirements under Article 17.")
94
 
 
 
 
 
 
95
  return msg
96
 
97
- def run_compliance_analysis_on_model(model_cc_yaml):
98
 
99
  for key, value in model_cc_yaml['risk_management_system']:
100
  if not value:
@@ -112,6 +165,11 @@ def run_compliance_analysis_on_model(model_cc_yaml):
112
  if not value:
113
  msg = (f"Because of the model represented by , this high-risk AI system fails the quality management requirements under Article 17.")
114
 
 
 
 
 
 
115
  return msg
116
 
117
  def check_intended_purpose():
 
27
 
28
  project_intended_purpose = None
29
 
30
+ # TO-DO: A thesis of this paper is that we cannot declare a project compliant without looking at all of its component models and datasets.
31
+ # What that means in practical terms is that we need to check all model and data CCs in addition to the project CC to render a decision of compliance.
32
+ # There are two ways we can go about this:
33
+ # (1) We can have an orchestrator function that sits on top of run_compliance_analysis_on_project(), run_compliance_analysis_on_data(), and
34
+ # run_compliance_analysis_on_model() and orchestrates them. In particular, it will have to first run run_compliance_analysis_on_project() to set
35
+ # the values of some "dispositive characteristic" variables, which it can then pass into run_compliance_analysis_on_data() and run_compliance_analysis_on_model()
36
+ # to make sure that the analysis done there is dynamically appropriate. Importantly, it will also have to run run_compliance_analysis_on_data(), and
37
+ # run_compliance_analysis_on_model() for each and every data and model CCs in the folder, passing in those "dispositive characteristic" variables
38
+ # as arguments to ensure the analysis is apprpriate.
39
+ # (2) We could treat run_compliance_analysis_on_project() as the orchestrator function. This would mean this function would first need to set all of the
40
+ # "dispositive characteristic" variables and then, after doing that, call compliance_analysis_on_data() and run_compliance_analysis_on_model() for all
41
+ # of the model and data CCs in the folder, passing in the "dispositive characteristic" variables as arguments.
42
+ #
43
+ # I slightly prefer option (1), so here is some pseudo-code for a potential orchestrator function:
44
+ #
45
+ # def orchestrator():
46
+ #
47
+ # this might be a good time to check to make sure there is at least one Project CC and also do do any
48
+ # some administrative stuff to make your life easier like maybe getting all the files in the folder into a list, etc.
49
+ #
50
+ # Call run_compliance_analysis_on_project, passing in the sole Project CC as the argument
51
+ # -This must set the "dispositive" variables (i.e., the project_variables above) by parsing them from the Project CC. It already does this as-is.
52
+ # -This must also check to see if the project is out of scope. It does this as-is.
53
+ # -This must also check for prohibited practices. This has been commented out, but the functionality is there as-is.
54
+ # -Last but not least, this must run the internal check of the project CC based on the project_variables it has set. It is only partially doing this as-is. To finish the job, we must:
55
+ # -Run the check for other types of models and systems: AI systems without high risk, GPAI without systemic risk, GPAI with systemic risk. It is only doing high-risk AI systems at the moment.
56
+ # -Where the operator is a provider, ensure any additional requirements for providers are met (see the Project CC template for details)
57
+ # -Where the operator is a deployer, ensure any additional requirements for deployers are met (see the Project CC template for details)
58
+ #
59
+ # Call run_compliance_analysis_on_model() *for all model CCs in the folder*, passing in the ai_project_type variable and maybe project_intended_purpose
60
+ # -This should include a "cross comparison" of the intended uses listed in the model CC and the project_intended_purpose parsed from the Project CC, something that is not yet integrated
61
+ # -This function must check if GPAI requirements are met, if that value for ai_project_type is passed in -- it does not yet do this
62
+ #
63
+ # Call run_compliance_analysis_on_data() *for all data CCs in the folder*, passing in the ai_project_type variable and maybe project_intended_purpose
64
+ # -This should include a "cross comparison" of the intended uses listed in the data CC and the project_intended_purpose parsed from the Project CC, something that is not yet integrated
65
+ # -This function must check if GPAI requirements are met, if that value for ai_project_type is passed in -- it does not yet do this
66
+ #
67
+ # This function could also more gracefully handle the internal exits/reports and generate a single, digestible compliance report that
68
+ # tells the user where the compliance analysis failed. If we wanted to get really fancy, we could include error messages for each individual
69
+ # entry in the yaml files, possibly citing the part of the Act that they need to reference (currently in comments that user does not see)
70
+
71
+
72
+ def run_compliance_analysis_on_project(project_cc_yaml):
73
 
74
  # Determine project type (AI system vs. GPAI model) as well as operator type. We will use these for different things.
75
  project_type = set_type(project_variables, project_cc_yaml)
 
82
  else:
83
  msg = ("Project is not within the scope of what is regulated by the Act.")
84
 
85
+ # TO-DO: reactivate the prohibited practices check below
86
+
87
  # # Check for prohibited practices. If any exist, the analysis is over.
88
  # if check_prohibited(project_cc_yaml) == True:
89
  # print("Project contains prohibited practices and is therefore non-compliant.")
 
119
  if not value:
120
  msg = ("Because of project-level characteristics, this high-risk AI system fails the accuracy, robustness, and cybersecurity requirements under Article 17.")
121
 
122
+ # TO-DO: No matter where we land with an orchestrator function, this function must also check to the value it has set for both
123
+ # GPAI models with and without systemic risk and then check to see if the relevant requirement have met if either of these values applies.
124
+ # This will look a lot like what is happening above for high-risk AI systems.
125
+
126
  return msg
127
 
128
+ def run_compliance_analysis_on_data(data_cc_yaml): # TO-DO: we probably have to pass ai_project_type and project_intended_purpose into this function
129
 
130
  for key, value in data_cc_yaml['data_and_data_governance']:
131
  if not value:
 
140
  if not value:
141
  msg = (f"Because of the dataset represented by , this high-risk AI system fails the quality management requirements under Article 17.")
142
 
143
+ # TO-DO: No matter where we land with an orchestrator function, this function must also check to the value that has been set for both
144
+ # GPAI models with and without systemic risk and then check to see if the relevant requirements have met if either of these values applies.
145
+ # Right now it is only checking high-risk AI system requirements. Another thing that we likely have to add here is the cross-comparison of the
146
+ # intended uses.
147
+
148
  return msg
149
 
150
+ def run_compliance_analysis_on_model(model_cc_yaml): # TO-DO: we probably have to pass ai_project_type and project_intended_purpose into this function
151
 
152
  for key, value in model_cc_yaml['risk_management_system']:
153
  if not value:
 
165
  if not value:
166
  msg = (f"Because of the model represented by , this high-risk AI system fails the quality management requirements under Article 17.")
167
 
168
+ # TO-DO: No matter where we land with an orchestrator function, this function must also check to the value that has been set for both
169
+ # GPAI models with and without systemic risk and then check to see if the relevant requirements have met if either of these values applies.
170
+ # Right now it is only checking high-risk AI system requirements. Another thing that we likely have to add here is the cross-comparison of the
171
+ # intended uses.
172
+
173
  return msg
174
 
175
  def check_intended_purpose():
project_cc.yaml CHANGED
@@ -505,10 +505,30 @@ additional_provider_obligations: # apply these only if operator == provider and
505
  verbose: 'The AI project complies with accessibility requirements in accordance with Directives (EU) 2016/2102 and (EU) 2019/882'
506
  value: !!bool false
507
 
508
- additional_deployer_obligations:
509
  accordance_with_instructions: # Article 26 (1)
510
  verbose: 'If operator is a deployer, that deployer has taken appropriate technical and organisational measures to ensure they use such systems in accordance with the instructions for use accompanying the systems'
511
  value: !!bool false
512
  human_oversight: # Article 26 (2)
513
  verbose: 'If operator is a deployer, that deployer has assigned human oversight to natural persons who have the necessary competence, training and authority, as well as the necessary support.'
514
- value: !!bool false
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
  verbose: 'The AI project complies with accessibility requirements in accordance with Directives (EU) 2016/2102 and (EU) 2019/882'
506
  value: !!bool false
507
 
508
+ additional_deployer_obligations: # apply these only if operator == deployer and ai_project_type == high_risk_ai_system
509
  accordance_with_instructions: # Article 26 (1)
510
  verbose: 'If operator is a deployer, that deployer has taken appropriate technical and organisational measures to ensure they use such systems in accordance with the instructions for use accompanying the systems'
511
  value: !!bool false
512
  human_oversight: # Article 26 (2)
513
  verbose: 'If operator is a deployer, that deployer has assigned human oversight to natural persons who have the necessary competence, training and authority, as well as the necessary support.'
514
+ value: !!bool false
515
+ relevant_input: # Article 26 (4)
516
+ verbose: 'If operator is a deployer, to the extent the deployer exercises control over the input data, that deployer shall ensure that input data is relevant and sufficiently representative in view of the intended purpose of the AI project'
517
+ value: !!bool false
518
+ monitoring: # Article 26 (5)
519
+ verbose: 'If operator is a deployer, that deployer shall monitor the operation of the AI project on the basis of the instructions for use and, where relevant, inform providers in accordance with Article 72'
520
+ value: !!bool false
521
+ monitoring: # Article 26 (6)
522
+ verbose: 'If operator is a deployer, that deployer shall keep the logs automatically generated by the AI project to the extent such logs are under their control, for a period appropriate to the intended purpose of the AI project, of at least six months, unless provided otherwise in applicable Union or national law, in particular in Union law on the protection of personal data.'
523
+ value: !!bool false
524
+ employees: # Article 26 (7)
525
+ verbose: 'If operator is a deployer and an employer, before putting into service or using a AI project at the workplace, that deployers shall inform worker representatives and the affected workers that they will be subject to the use of the AI project.'
526
+ value: !!bool false
527
+ employees: # Article 26 (8)
528
+ verbose: 'If operator is a deployer and a public authority, or Union institution, body, office or agency, that deployer shall register the AI project in the EU database per Article 49(3)'
529
+ value: !!bool false
530
+ employees: # Article 26 (9)
531
+ verbose: 'If operator is a deployer and if applicable, the deployer used the information provided under Article 13 of this Regulation to comply with their obligation to carry out a data protection impact assessment under Article 35 of Regulation (EU) 2016/679 or Article 27 of Directive (EU) 2016/680'
532
+ value: !!bool false
533
+
534
+ # Couple more to add from Article 26, using same format