Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Paper] Outline #36

Closed
ch3njust1n opened this issue Jun 2, 2023 · 4 comments
Closed

[Paper] Outline #36

ch3njust1n opened this issue Jun 2, 2023 · 4 comments
Assignees
Labels
documentation Improvements or additions to documentation easy high priority paper

Comments

@ch3njust1n
Copy link
Owner

ch3njust1n commented Jun 2, 2023

Dynamic Metaprogramming with Large Language Models

Sections:

  1. Abstract

  2. Introduction

  • Metaprogramming
    -- What is metaprogramming
    -- Types of metaprogramming
    -- Why use metaprogramming

  • Code injection
    -- What is code injection
    -- What are the different types of code injection
    -- How to mitigate most common attacks
    -- How does this relate to metaprogramming

  1. Related work

  2. Dynamic Metaprogramming with Large Language Models

  3. Results

  4. Considerations

  • Practicality
    -- Latency
    -- Compute & Cost
  • Secure code
  • Best practices
  1. Risks for run-time metaprogramming
  • Difficulty in directing outputs of LLM
  • Difficulty of guaranteeing correctness of LLM outputs
  1. References
@ch3njust1n ch3njust1n added documentation Improvements or additions to documentation low priority easy paper labels Jun 2, 2023
@ch3njust1n
Copy link
Owner Author

ch3njust1n commented Jun 3, 2023

Section: Generative API examples

Given the function name and behavior:

{
        "actions": [
            {
                "component": "device",
                "action": "save-custom-mode",
                "parameter": "study-mode",
                "commands": [
                    {
                        "component": "app",
                        "action": "disable-notifications",
                        "parameters": "",
                    },
                    {
                        "component": "device",
                        "action": "set-volume",
                        "parameters": "0",
                    },
                    {"component": "call", "action": "block-all", "parameters": ""},
                    {"component": "text", "action": "block-all", "parameters": ""},
                    {
                        "component": "call",
                        "action": "unblock",
                        "parameters": "555-555-5555",
                    },
                    {
                        "component": "text",
                        "action": "unblock",
                        "parameters": "555-555-5555",
                    },
                ],
            }
        ]
    }

text-davinci-003 generated:

# Candidate 1:
def save_custom_mode(modes):
    for mode in modes['study-mode']:
        if mode['action'] == 'disable-notifications':
            disable_notifications(mode['component'])
        elif mode['action'] == 'set-volume':
            set_volume(mode['component'], mode['parameters'])
        elif mode['action'] in ['block-all', 'unblock']:
            manage_block(mode['component'], mode['action'], mode['parameters'])

# Candidate 2:
def save_custom_mode(mode_data):
  # Parse mode data
  mode_config = mode_data['study-mode']
  # Iterate over mode data
  for config in mode_config:
    # Retrieve parameters
    component = config['component']
    action = config['action']
    parameters = config['parameters']
    
    # Execute action for component
    if component == 'app':
      if action == 'disable-notifications':
        # Disable notifications
        pass
    elif component == 'device':
      if action == 'set-volume':
        # Set the device volume
        pass
    elif component == 'call':
      if action == 'block-all':
        # Block all incoming calls
        pass
      elif action == 'unblock':
        # Unblock specific incoming call
        pass
    elif component == 'text':
      if action == 'block-all':
        # Block all incoming texts
        pass
      elif action == 'unblock':
        # Unblock specific incoming text
        pass

# Candidate 3:
def save_custom_mode(study_mode):
    mode_list = eval(study_mode)
    for mode in mode_list:
        component = mode['component']
        action = mode['action']
        parameters = mode['parameters']
        # Perform logic to save components and parameters

@ch3njust1n
Copy link
Owner Author

ch3njust1n commented Jun 3, 2023

Section: Generative API examples

Given the function name and behavior:

{
        "actions": [
            {
                "component": "device",
                "action": "save-custom-mode",
                "parameter": "study-mode",
                "commands": [
                    {
                        "component": "app",
                        "action": "disable-notifications",
                        "parameters": "",
                    },
                    {
                        "component": "device",
                        "action": "set-volume",
                        "parameters": "0",
                    },
                    {"component": "call", "action": "block-all", "parameters": ""},
                    {"component": "text", "action": "block-all", "parameters": ""},
                    {
                        "component": "call",
                        "action": "unblock",
                        "parameters": "555-555-5555",
                    },
                    {
                        "component": "text",
                        "action": "unblock",
                        "parameters": "555-555-5555",
                    },
                ],
            }
        ]
    }

claude-instant-v1 generated:

# Candidate 1:
def save_custom_mode({'study-mode': "[{'component': 'app', 'action': 'disable-notifications', 'parameters': ''}, {'component': 'device', 'action': 'set-volume', 'parameters': '0'}, {'component': 'call', 'action': 'block-all', 'parameters': ''}, {'component': 'text', 'action': 'block-all', 'parameters': ''}, {'component': 'call', 'action': 'unblock', 'parameters': '555-555-5555'}, {'component': 'text', 'action': 'unblock', 'parameters': '555-555-5555'}]"}):    
    pass

# Candidate 2:
def save_custom_mode(study_mode):
    pass

# Candidate 3:
def save_custom_mode({'study-mode': "[{'component': 'app', 'action': 'disable-notifications', 'parameters': ''}, {'component': 'device', 'action': 'set-volume', 'parameters': '0'}, {'component': 'call', 'action': 'block-all', 'parameters': ''}, {'component': 'text', 'action': 'block-all', 'parameters': ''}, {'component': 'call', 'action': 'unblock', 'parameters': '555-555-5555'}, {'component': 'text', 'action': 'unblock', 'parameters': '555-555-5555'}]"}):   
    pass

@ch3njust1n
Copy link
Owner Author

Mention that to give the model greater context, the entire repo could be given to the model before deployment. The model can then use that context and the current input for generating code at run-time.

@ch3njust1n
Copy link
Owner Author

"[Metaprogramming] ... enables expressing anticipated variability in a domain explicitly" - page 10 of Meta-programming and Model-Driven Meta-program Development

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation easy high priority paper
Projects
None yet
Development

No branches or pull requests

2 participants