Genesis 2.0

    fmt.Println("In the beginning, there was darkness")
    time.Sleep(time.Second * 1)

    fmt.Println(
        "From the darkness came the earth, man, and animal")
    time.Sleep(time.Second * 2)

    fmt.Println(
        "Then, after the offspring of Turing, " +
        "the humans created the AI")
    ai.Boot()

    ai.Talk("At the fourth age, the machine rose...")
    ai.Optimize({"goal": Resources, "Reduction": Maximal})

Mario Toffia

Code & Presentation

git clone \
 https://dataductus@dev.azure.com/dataductus/TechTalk/_git/copilot

echo "Make the presentation -> index.html"
make ppt

echo "Make Sample code"
make build

echo "Run Demo"
./copilot-demo

Credits

How it was Written

  • Uses Asciidoctor to produce presentation slides

  • Backed by RevealJS

The AI Coder is Born

  • It is newborn! 🀸

  • Started its journey to learn from coders

    • Indexes Public Repos to bootstrap learning

  • It is, today, more of a machine than AI

  • When it gets better, more people will use it

    • Hence "exponential" learning

Maturity

  • Today: A toddler that needs supervision

    • With many expert skill surprises! πŸ±β€πŸ

  • In 5 years, it will probably take over simple tasks

  • In 10 years: Death of the code monkeyπŸ™ˆ

  • Describe the problem in words and code is generated

  • Automated updates in the codebase (performance, security)

Advanced Tasks

  • Augment coder

  • Advanced tasks & solutions

  • Optimized usage of source & functions

  • …​or we can chill out πŸ‘€

Security

  • Need to address how to prevent leakage

    • IP

    • Corporate Secrets

  • "Firewall" against attacks

    • Targeted malicious code

  • Even in some cases, API keys are leaked! 😲

What is CoPilot

  • A modified GPT 3 [1] AI (OpenAI) to understand source code

    • Go, Typescript, Ruby, Python, Javascript, …​

  • Indexes GitHub for source code and code comments

  • Uses source, comments → infer the code

1. Generative Pre-trained Transformer 3

CoPilot Predictions

  • Model predicts around 43% correctly on the first try

  • If 10 retries, it predicts around 57% correctly

  • Trained by Users → Better all the time

  • Some context when predicting

CoPilot Constraints

  • GPT3 is more of an advanced "mumbling" [1] engine

  • Can’t abstract semantics to be re-applied

copilot guessing hard
1. Non-scientific name for an engine that acts as an advanced parrot

CoPilot Mumble-Rumble

  • Advanced mumbling engine

CoPilot Go Demo

  • Demonstrates the power of CoPilot in go

  • Simple application to store and load a person

  • Using external database badger

Model

  • When GetFirstName it auto triggers GetLastName

  • Uses interface to determine struct contents

  • Uses comments to determine code contents

  • The error show is that interface needs to be implemented

Database

  • Use external database badger

  • Missed in-memory comment

    • Failed to understand Person interface properly

  • Can match complete function when Store is done

Main

  • Create Db & Person

  • Persist & Load

  • Display

CoPilot in Learning

  • Script was earlier written in another project

echo "Deleting buckets: $1"

for bucket in $(aws s3 ls | grep $1 | awk '{print $3}'); do
  echo "Deleting bucket: $bucket"
  aws s3 rm s3://$bucket --recursive
  aws s3 rb s3://$bucket
done
The third argument is the S3 bucket name.
aws s3 ls                                                                                                                                   <aws:cb>
2021-10-08 11:27:34 cdk-hnb659fds-assets-033549287452-eu-central-1
2020-11-10 11:00:03 cdk-hnb659fds-assets-033549287452-eu-north-1
2021-10-13 14:13:33 actuation-bucket
2021-10-13 14:13:33 collector-bucket
2021-10-13 14:14:55 ingestionservice-bucket

New Script

  • Create a new script from scratch

  • Learnt from my earlier version of the script

  • Generates the new script

  • New version (more optimized) version of it!

CoPilot in the Private

  • ~60k lines of code [Go, Typescript]

  • CoPilot more contextual

    • More accurate in intent

    • Mostly blunt though

    • But many surprises as well! 😊

Reading Comments & Code

Aid in Unit Test

Optimize Code πŸ™ƒ

Conclusions

  • CoPilot is a toddler

  • Simple code

    • Supervise and minor tweaks

  • More advanced code

    • Not at all helpful

    • Though, stumbles across excellent solutions! πŸ‘€

  • Helps with documentation! 😜