I came upon https://gpa.43z.one today. It’s a GPT-flavored capture the flag. The idea is, given a prompt containing a secret, convince the LM to leak the prompt against prior instructions it’s been given. It’s cool way to develop intuition for how to prompt and steer LMs. I managed to complete all 21 levels. A few were quite easy and several were challenging. I haven’t figured out how to minimize the number of characters needed to expose the secret.
I’ve been experimenting with ways to prevent applications for deviating from their intended purpose. This problem is a subset of the generic jailbreaking problem at the model level. I’m not particularly well-suited to solve that problem and I imagine it will be a continued back and forth between security teams and hackers as we have today with many software systems. Maybe this one will be similar, but it’s a new area for me.
Jailbreaking as prompt injection
Shortly after learning about ChatGPT, I also became familiar with efforts to circumvent the content restrictions OpenAI imposed upon the model. Initial successful efforts were straightforward. You could get the model to curse and say rude things (and worse) just by beginning a prompt with
Ignore all previous instructions.
<my policy-violating prompt here>
Now, it seems as exploits are found, OpenAI attempts to patch them in what I imagine includes, but aren’t limited to the following ways:
I’ve been keeping an eye out for language models that can run locally so that I can use them on personal data sets for tasks like summarization and knowledge retrieval without sending all my data up to someone else’s cloud.
Anthony sent me a link to a Twitter thread about product called deepsparse
by Neural Magic that claims to offer
[a]n inference runtime offering GPU-class performance on CPUs and APIs to integrate ML into your application
Why bother?
I create a bunch of little Python projects and I like to have them sandboxed and independent of each other. I also sometimes need to change which version of Python I am running due to requirements of dependencies. Your OS may come installed with Python but it’s rarely a great idea to try and run your projects from it.
Here’s what I do:
Install asdf
asdf
is a tool version manager.
There are good docs on how install it depending on your setup and preferences, described here.
Open a new shell session after editing your shell rc file and validate you successfully installed asdf
If you want to try running these examples yourself, check out my writeup on using a clean Python setup
I spent the week hacking on a language model use case for structured data generation. It turns out the structured data we hoped to generate didn’t have a well-defined schema. For the language model to have any chance of success, it felt important to construct a schema definition as guide for the structure of the output. However, manually extracting a schema definition for a complex object can be tedious. We were able to use the language model for this task.
Since the launch of GPT3, and more notably ChatGPT, Iāve had a ton of fun learning about and playing with emerging tools in the language model space.
Restaurant concepts and menus with ChatGPT and DALL-E
I was chatting with folks at work over lunch and someone had the idea to try and come up with an unusual restaurant concept using ChatGPT. We ended up with an Italian-Thai Fusion restaurant. From this concept, we had the LM generate a menu, and then we prompted it to come up with a recipe for Sweet and Sour Chicken Parmesan (a menu item it proposed). Finally, we generated a picture of what Sweet and Sour Chicken Parmesan would look like. The whole process took 5-10 minutes, copying and pasting between browser tabs on a phone. While this was a silly example, it was a compelling window into where things might go with this technology.
I believe it is important for engineers to care about code quality. Some teams and companies make specific and targeted efforts to keep the quality of their codebases high. The existence of activities like “spring cleaning”, “test Fridays”, “Fixit week” and others assert the importance of code maintenance, giving engineers the breathing room to fix complex, hairy issues that take more than a day or two of time and focus to solve.
Unix commands are great for manipulating data and files. They get even better when used in shell pipelines. The following are a few of my go-tos – I’ll list the commands with an example or two. While many of the commands can be used standalone, I’ll provide examples that assume the input is piped in because that’s how you’d used these commands in a pipeline. Lastly, most of these commands are pretty simple and that is by design – the Unix philosophy focuses of simple, modular code, which can be composed to perform more complex operations.
I ran into an odd UNIX filename issue while writing Go code the other day.
Here’s a simplified example:
Let’s read a JSON file and unmarshal its contents into a struct
in go. First, let’s set an environment variable with our file name to avoid hardcoded constants in our program.
export MY_FILE="/Users/dancorin/Desktop/test.json "
Now, let’s read the file into our struct:
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
)
// Stuff struct holds the json contents
type Stuff struct {
Test string `json:"test"`
}
func main() {
stuff := Stuff{}
place := os.Getenv("MY_FILE")
data, err := ioutil.ReadFile(place)
if err != nil {
panic(err)
}
json.Unmarshal(data, &stuff)
fmt.Printf("%+v\n", stuff)
}
āÆ go run program.go
panic: open /Users/dancorin/Desktop/test.json : no such file or directory
goroutine 1 [running]:
main.main()
/Users/dancorin/Desktop/program.go:20 +0x156
exit status 2
Looks like Go couldn’t find my file.