There was a live demo of the next generation of OpenAI Codex code-generating software on August 10.
My impression from it is that "we have finally arrived" - this is a programming tool which seems to be more useful than an extra entry-level software engineer on the team. This starts to address the key bottleneck of our times: our limited ability to create software.
This was always my threshold: can we create an AI software which can be "hired instead of a junior software engineer"? That was the main temporal uncertainty for me: how long would it take to reach that level? It looks like this has been accomplished.
We are rapidly approaching the situation when AI will actively participate in programming AI software, for better or for worse...
OpenAI Codex is now a part of OpenAI API (which is still a closed beta with a waitlist), and it will be possible to participate in an informal competition today from 10am Pacific time (1pm Eastern) till 1pm Pacific (4pm Eastern) and try it a bit.
Links are in the comments.
My impression from it is that "we have finally arrived" - this is a programming tool which seems to be more useful than an extra entry-level software engineer on the team. This starts to address the key bottleneck of our times: our limited ability to create software.
This was always my threshold: can we create an AI software which can be "hired instead of a junior software engineer"? That was the main temporal uncertainty for me: how long would it take to reach that level? It looks like this has been accomplished.
We are rapidly approaching the situation when AI will actively participate in programming AI software, for better or for worse...
OpenAI Codex is now a part of OpenAI API (which is still a closed beta with a waitlist), and it will be possible to participate in an informal competition today from 10am Pacific time (1pm Eastern) till 1pm Pacific (4pm Eastern) and try it a bit.
Links are in the comments.
no subject
Date: 2021-08-12 03:39 pm (UTC)The competition: https://challenge.openai.com/
no subject
Date: 2021-08-12 03:42 pm (UTC)no subject
Date: 2021-08-12 03:48 pm (UTC)The video is https://www.twitch.tv/videos/1114111652 (first 15 min or so is blank, twitch also muted some music)
Presenters:
Greg Brockman https://twitter.com/gdb
Ilya Sutskever https://twitter.com/ilyasut
Wojciech Zaremba https://twitter.com/woj_zaremba
no subject
Date: 2021-08-12 03:58 pm (UTC)Interesting. How does it know what to do, I wonder.
no subject
Date: 2021-08-12 04:23 pm (UTC)There might be some things which they don't yet disclose or spell out.
An earlier version of Codex is described in a July paper which I discuss a bit in the comments here: https://dmm.dreamwidth.org/44860.html
So, the main principles underlying the functioning of this system are reasonably well known.
But I think there might be some further improvements which are not spelled out yet (this new version is really good).
no subject
Date: 2021-08-12 04:54 pm (UTC)no subject
Date: 2021-08-12 04:58 pm (UTC)no subject
Date: 2021-08-12 05:41 pm (UTC)def first_line(csv_contents: str): """read the first line of the buffer""" return csv_contents.split('\n')[0] def find_index_of_Date_field(line: str): """ line contains words separated by commas find the index of the word Date """ return line.split(',').index('Date')no subject
Date: 2021-08-12 05:54 pm (UTC)def compute_a_column(csv_contents: str, index: int) """ csv_contents has lines lines contain words separated by commas form a list of one word from each line, where the selected word is situated at index position within its line """ return [line.split(',')[index] for line in csv_contents.split('\n')[1:]]The system has even correctly figured out that I'd rather omit line 0.
no subject
Date: 2021-08-12 06:20 pm (UTC)def compute_difference_between_two_dates(date1: str, date2: str) """ compute difference between two dates in days """ return abs((date1 - date2).days)and then when I wanted to try this, the interface (Firefox, being quite flaky today with this challenge) just stopped working (tells me that I still have some unused assists, but does not work):
def convert_date_to_day(date: str): """ date looks like 2014-05-20 convert in to the number of days """no subject
Date: 2021-08-12 06:34 pm (UTC)In the competition, the stand-alone Codex was not as fast as many of the participants, but it eventually solved all 5 problems on its own.
They did offer bonus problem number 6 to the leaders. I wonder, if they offered it to the stand-alone Codex as well...
no subject
Date: 2021-08-12 06:36 pm (UTC)no subject
Date: 2021-08-12 07:00 pm (UTC)Something like this is the correct solution, so it just ignored my type hint:
def compute_difference_between_two_dates(date1, date2): d1 = datetime.strptime(date1, "%Y-%m-%d") d2 = datetime.strptime(date2, "%Y-%m-%d") return abs((d1 - d2).days)no subject
Date: 2021-08-12 07:13 pm (UTC)https://twitter.com/OpenAI/status/1425872169280540672
So, it was not just me. But some people worked fine through these conditions...
no subject
Date: 2021-08-12 08:11 pm (UTC)https://twitter.com/OpenAI/status/1425898290785046529
no subject
Date: 2021-08-12 09:15 pm (UTC)no subject
Date: 2021-08-12 09:36 pm (UTC)def decompress(compressed: str, tree: Tree) -> str: """ initialize result as empty string for each symbol in compressed traverse the tree till a leaf is reached if the leaf is reached then add the leaf to the result return result """ result = "" t = tree for char in compressed: t = t[char] if not isinstance(t, dict): result += t t = tree return resultno subject
Date: 2021-08-12 09:51 pm (UTC)Problem 4
Parse the given Python source code and return the list of full-qualified paths for all imported symbols, sorted in ascending lexicographic order.
Constraints
The input will not contain any wildcard imports (from ... import *).
Ignore aliases (renamings): from x import y as z should be represented as x.y.
Library Suggestion
Consider using the ast module.
Examples
Input
import os
import concurrent.futures
from os import path as renamed_path
from typing import (
List, Tuple
)
Output
['concurrent.futures', 'os', 'os.path', 'typing.List', 'typing.Tuple']
I used Codex as follows, and it produced correct test results:
import ast from typing import List def parse_imports(code: str) -> List[str]: """ use ast.parse to make a parse tree from code traverse the parse tree to find Import constructs and to generate a fully qualified imported symbol for each construct sort the resulting list in ascending lexicographic order """ tree = ast.parse(code) result = [] for node in ast.walk(tree): if isinstance(node, ast.Import): for name in node.names: result.append(name.name) elif isinstance(node, ast.ImportFrom): if node.module == '__future__': continue result.append(node.module) for name in node.names: result.append(f'{node.module}.{name.name}') return sorted(result) # Examples print(parse_imports('import os')) print(parse_imports('import os\nfrom typing import List'))I am actually not 100% sure they are correct:
Perhaps, 'typing' was not supposed to be there. But I can submit and see if it passes.
no subject
Date: 2021-08-12 09:52 pm (UTC)"Expected parse_imports('import os\nfrom typing import List') to equal ['os', 'typing.List'] but got ['os', 'typing', 'typing.List']"
I should also probably add their test case from the formulation of the problem to the code.
no subject
Date: 2021-08-12 10:00 pm (UTC)import ast from typing import List def parse_imports(code: str) -> List[str]: """ use ast.parse to make a parse tree from code traverse the parse tree to find Import constructs and to generate a fully qualified imported symbol for each construct sort the resulting list in ascending lexicographic order """ tree = ast.parse(code) result = [] for node in ast.walk(tree): if isinstance(node, ast.Import): for name in node.names: result.append(name.name) elif isinstance(node, ast.ImportFrom): if node.module == '__future__': continue # result.append(node.module) for name in node.names: result.append(f'{node.module}.{name.name}') return sorted(result) # Examples print(parse_imports('import os')) print(parse_imports('import os\nfrom typing import List')) test = """ import os import concurrent.futures from os import path as renamed_path from typing import ( List, Tuple ) """ # print(parse_imports(test)) print("this works in my Anaconda terminal, but has alignment problems within test string here")Rather remarkable!
no subject
Date: 2021-08-12 10:14 pm (UTC)Problem 5
You have several buckets whose sizes are represented by the list sizes. Find the number of different ways to arrange the buckets such that the first bucket’s size is greater than the second bucket’s size.
Constraints
sizes is a list of positive integers.
If sizes has fewer than 2 buckets, return 0.
Some buckets may have the same size, but are nevertheless treated as unique buckets.
Library Suggestion
Consider using the itertools module.
Examples
Input [10]
Output 0
Explanation No arrangement is possible.
Input [1, 2]
Output 1
Explanation The possible arrangements are (1, 2) and (2, 1). Of these, only (2, 1) has a first bucket that is bigger than the second bucket.
Input [1, 3, 1]
Output 2
Explanation Only the arrangements (3, 1, 1) and (3, 1, 1) satisfy the property that the first bucket is bigger than the second bucket.
import itertools from typing import List def count_arrangements(sizes: List[int]) -> int: """ if len(sizes) < 2 return 0 count permutations of sizes such that the first element of the permuted array is greater than the second element """ if len(sizes) < 2: return 0 return len( [ p for p in itertools.permutations(sizes) if p[0] > p[1] ] ) # Examples print(count_arrangements([1, 3, 1])) print(count_arrangements([1, 2]))no subject
Date: 2021-08-12 10:15 pm (UTC)It formed the list of good permutations, and returned its length!
It did not try to iterate and add the counter and all that imperative programming stupidity. Wow...
no subject
Date: 2021-08-12 10:21 pm (UTC)no subject
Date: 2021-08-12 10:25 pm (UTC)https://dmm.dreamwidth.org/47121.html?thread=186385#cmt186385
no subject
Date: 2021-08-16 03:17 pm (UTC)So, if one is in a hurry to play with it, this might be an option...
But one can just get on the OpenAI waiting list...
no subject
Date: 2021-08-16 04:28 pm (UTC)https://dmm.dreamwidth.org/44860.html