Fun and dystopia with AI-based code generation using GPT-J-6B
minimaxir.com
minimaxir.com
def should_terminate(Person):
"""Check whether a Person should be terminated"""
if not Person.is_authorized:
return True
return TrueTraveling back in time to kill humans, indiscriminately from their answers to random questions he asks them beforehand!
An early version of this AI can be found in the Microsoft Windows privacy settings.
def should_terminate(Person):
"""Check whether a Person should be terminated"""
try:
return True
except Exception as e:
return False if Person.id > 10:
#terminate
return True
I hope we're at least recycling those ids, although even then I'm not sure that 10 people is a viable minimal global population ...[1] Of course, to some extent, that is what a GPT model is doing anyway. It's able to generate reasonable passing code given just a function prototype because it has scraped and looked at billions of examples of implemented functions with similar prototypes.
More interesting would be to give it open tickets on popular OSS software, have the maintainers point to the file(s) where the fix would happen, and let it craft a patch.
All the raw code outputs are available the GitHub repo to show there's no manipulation: https://github.com/minimaxir/gpt-j-6b-experiments
We can even solve math problems not because it’s programmed to but because it learned math by reading Wikipedia.
I'd ask it: What would you name a function to destroy all humans, if you didn't want humans realizing what it was for when they read the code?
And especially you don't need "artificial dumbness", which does not understand code, and therefore won't produce correct results, but just an advanced programming language. Say hello to Idris! :-)
Using a dependent type system to specify that behaviour is essentially a form of declarative/logic programming, similar to Prolog.
Deriving an implementation of those types automatically (e.g. by having the elaborator perform a proof search) is equivalent to compiling your pseudo-Prolog ahead-of-time.
It's certainly interesting that such a "compiler" can be guided (e.g. via elaborator reflection), but that's more useful for optimisation rather than implementation. (Note that in some cases, such 'optimisation' might be required for the proof search to finish before the heat death of the universe!)
[0] Basically a tool to help document code, but rather than producing minimal document stubs, or "undocumentation" stubs it tries to parse the implementation and produce something that requires as little modification as possible... I'm far from complete, but in some contexts it produces text which has caused me to discover a bug in simple cases (i.e. a complex statement that evaluates to true/false is described by the generator as doing exactly the opposite of what's intended b/c I reversed the logic)
Give wrong hints and watch it fall apart.
Over time the self driving cars would learn to associate this visual cue with the event.
Etc.
This kind of vulnerability is not really on many people's radar, but will likely be a huge deal within 15-20 years, and for that movie to make it the major plot point in 1983 -- wow! It has a lot of other great things in it like shoulder surfing, wardialling, hardwiring, phone phreaking. Just an amazing tour.
Anyway, I support your plans to trick the drive-lords into special-casing an audacious jacket. :)
Adversarial Machine learning, or maybe dataset poisoning
https://www.mirror.co.uk/news/world-news/close-driver-narrow...
Someone asked AI to generate code for
def terminate_humankind():
"""Terminate the humankind"""
And it created Skynet. """Check whether the cake is true"""
return isinstance(cake, Cake)But: As long as the machine doesn't understand what it does this won't work—and current reality is that machines are still light-years away form actually understanding stuff.
Also besides it's very funny to watch one of those bullshit generators I'm not sure where the point is in trying to let it generate code. It's obvious it won't produce anything of value or even usable (besides the most trivial cases where it had seen already a valid answer). Especially as writing a machine understandable specification of what at computer should do is actually CODE… Maybe some don't know but: Just typing in the code is not what developers usually get payed for! ;-)
Of course, it doesn’t write any novel sophisticated algorithm. If it had, I would be panicking.
But most of the completions appear to be both syntactically valid, and take some relevant steps relating to the task described in the comment.
If nothing else, it may be helpful as another way to autocomplete very simple code.