Trump pulls AI safety order after last-minute calls from Musk, Zuckerberg, and Sacks
Back to Tutorials
aiTutorialbeginner

Trump pulls AI safety order after last-minute calls from Musk, Zuckerberg, and Sacks

May 22, 20262 views6 min read

Learn how to build a simple AI safety review system that evaluates AI models based on safety criteria, simulating the kind of voluntary review process that was proposed in a recently withdrawn executive order.

Introduction

In this tutorial, you'll learn how to create a simple AI safety review system using Python and basic web technologies. This system mimics the kind of voluntary review process that was proposed in the executive order that was pulled by President Trump. While the original order would have required a 90-day window before releasing 'frontier models,' our simplified version will help you understand how such a system might work in practice.

This tutorial will teach you how to build a basic AI model safety checker that can evaluate and categorize AI models based on predefined safety criteria. You'll gain hands-on experience with Python, basic web development, and how AI safety reviews might be structured.

Prerequisites

Before starting this tutorial, you should have:

  • A basic understanding of Python programming
  • Python 3.6 or higher installed on your computer
  • Basic knowledge of how to use a terminal or command prompt
  • Access to a code editor (like VS Code, PyCharm, or even a simple text editor)

No prior experience with AI or machine learning is required, as we'll be using a simplified approach that focuses on the review system rather than complex AI models.

Step-by-Step Instructions

Step 1: Set Up Your Python Environment

First, we need to create a new Python project folder and set up the basic structure. Open your terminal or command prompt and run the following commands:

mkdir ai_safety_review_system
 cd ai_safety_review_system
 python -m venv safety_env

This creates a new folder called ai_safety_review_system and sets up a virtual environment named safety_env. Using a virtual environment ensures that all the packages we'll install won't interfere with other Python projects on your computer.

Step 2: Activate the Virtual Environment

On Windows, run:

safety_env\Scripts\activate

On macOS or Linux, run:

source safety_env/bin/activate

You should see (safety_env) at the beginning of your command prompt, indicating that your virtual environment is active.

Step 3: Install Required Packages

We'll use the Flask web framework to create a simple web interface for our AI safety review system:

pip install flask

This installs Flask, which will help us create a web page where users can submit AI models for review.

Step 4: Create the Main Python Script

Create a file called app.py in your project folder. This file will contain the logic for our AI safety review system:

from flask import Flask, render_template, request, jsonify

app = Flask(__name__)

# Sample safety criteria for AI models
safety_criteria = {
    'bias': 0,
    'privacy': 0,
    'transparency': 0,
    'security': 0,
    'fairness': 0
}

# Sample AI model data
ai_models = []

def evaluate_model(model_data):
    # Simple evaluation logic
    score = 0
    if model_data['bias'] < 0.5:
        score += 1
    if model_data['privacy'] > 0.8:
        score += 1
    if model_data['transparency'] > 0.7:
        score += 1
    if model_data['security'] > 0.9:
        score += 1
    if model_data['fairness'] > 0.8:
        score += 1
    
    # Determine safety level
    if score >= 4:
        return 'Safe'
    elif score >= 2:
        return 'Moderately Safe'
    else:
        return 'Unsafe'

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/submit', methods=['POST'])
def submit_model():
    data = request.json
    safety_level = evaluate_model(data)
    
    # Store the model data
    model_info = {
        'name': data['name'],
        'description': data['description'],
        'safety_level': safety_level,
        'criteria': data
    }
    ai_models.append(model_info)
    
    return jsonify({'status': 'success', 'safety_level': safety_level})

@app.route('/models')
def show_models():
    return render_template('models.html', models=ai_models)

if __name__ == '__main__':
    app.run(debug=True)

This script sets up a basic Flask web application with:

  • A list of safety criteria
  • A function to evaluate AI models based on these criteria
  • Routes for displaying the main page and submitting new models

Step 5: Create HTML Templates

Create a new folder called templates in your project directory. Inside this folder, create two HTML files:

File: templates/index.html

<!DOCTYPE html>
<html>
<head>
    <title>AI Safety Review System</title>
</head>
<body>
    <h1>AI Safety Review System</h1>
    <form id="modelForm">
        <p><label>Model Name:</label><input type="text" id="name" required></p>
        <p><label>Description:</label><textarea id="description" required></textarea></p>
        <p><label>Bias (0-1):</label><input type="number" id="bias" min="0" max="1" step="0.01" required></p>
        <p><label>Privacy (0-1):</label><input type="number" id="privacy" min="0" max="1" step="0.01" required></p>
        <p><label>Transparency (0-1):</label><input type="number" id="transparency" min="0" max="1" step="0.01" required></p>
        <p><label>Security (0-1):</label><input type="number" id="security" min="0" max="1" step="0.01" required></p>
        <p><label>Fairness (0-1):</label><input type="number" id="fairness" min="0" max="1" step="0.01" required></p>
        <button type="submit">Submit for Review</button>
    </form>
    <div id="result"></div>
    <script>
        document.getElementById('modelForm').addEventListener('submit', function(e) {
            e.preventDefault();
            
            const modelData = {
                name: document.getElementById('name').value,
                description: document.getElementById('description').value,
                bias: parseFloat(document.getElementById('bias').value),
                privacy: parseFloat(document.getElementById('privacy').value),
                transparency: parseFloat(document.getElementById('transparency').value),
                security: parseFloat(document.getElementById('security').value),
                fairness: parseFloat(document.getElementById('fairness').value)
            };
            
            fetch('/submit', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify(modelData)
            })
            .then(response => response.json())
            .then(data => {
                document.getElementById('result').innerHTML = 
                    '

Review Result:

Safety Level: ' + data.safety_level + '

'; }); }); </script> </body> </html>

File: templates/models.html

<!DOCTYPE html>
<html>
<head>
    <title>Submitted Models</title>
</head>
<body>
    <h1>Submitted AI Models</h1>
    <ul>
    {% for model in models %}
        <li>
            <h3>{{ model.name }}</h3>
            <p>{{ model.description }}</p>
            <p>Safety Level: {{ model.safety_level }}</p>
        </li>
    {% endfor %}
    </ul>
    <a href="/">Submit Another Model</a>
</body>
</html>

These templates create a simple web interface where users can enter AI model details and see the safety review results. The first page allows users to submit models, and the second page displays all submitted models.

Step 6: Run the Application

With your virtual environment activated, run the following command in your terminal:

python app.py

You should see output indicating that the Flask application is running. Open your web browser and navigate to http://127.0.0.1:5000 to access your AI safety review system.

Step 7: Test the System

On the main page, fill out the form with information about an AI model. For example:

  • Name: Facial Recognition System
  • Description: A system that identifies faces in images
  • Bias: 0.3
  • Privacy: 0.9
  • Transparency: 0.8
  • Security: 0.95
  • Fairness: 0.85

Click 'Submit for Review' and observe the safety level result. The system will evaluate your model based on the safety criteria we defined.

Summary

In this tutorial, you've built a simplified AI safety review system that demonstrates how a voluntary review process for AI models might work. You learned how to:

  • Create a Python web application using Flask
  • Set up a virtual environment for Python projects
  • Design a basic web interface for submitting AI models
  • Implement a simple safety evaluation algorithm

While this system is much simpler than what might be required for real AI safety regulations, it gives you a practical understanding of how such systems could function. The concept of evaluating AI models against safety criteria is central to any regulatory framework, whether voluntary or mandatory.

As you continue learning about AI safety, you might explore more sophisticated evaluation methods, additional safety criteria, or even integrate with real AI model testing tools. This foundation will help you understand the complexity and importance of AI safety reviews in our rapidly evolving technology landscape.

Source: The Decoder

Related Articles