Skip to main content

Accelerating ML Content Creation with ML

It's ML all the way down. – Published 2022-04-01
Created on March 26|Last edited on April 1
If you're anything like me, you just can't get enough quality machine learning content. Between NeurIPS, ICLR, ICML, KDD, ODSC, the ArXiV, Twitter threads, LinkedIn posts, Podcasts, and curated blog communities like Fully Connected–there simply is not enough to read.
Similarly, our head of content was recently bewailing his inability to feed the masses of enthusiastic members of our Fully Connected community:
How can I keep up?! We've published over 1000 technical blogs, reports, paper reproductions, and primers on a variety of Machine Learning topics, but it's not enough. Every day there's a new paper about radiance fields, reinforcement learning, or positional representations, but community beckons for more!
Here at Weights and Biases, we pride ourselves on enabling people to solve difficult problems – we build tools and platforms to help practitioners work efficiently and effectively on whatever task they endeavor to solve with Machine Learning. How could we ourselves overcome this dearth of writing about AI.
I knew that my good friend Justin needed help, and I remembered my friend Ivan's recent work on text generation. Ivan was able to generate episodes of Dr. Who in case the BBC wants to give their writers room a long vacation; that's when it came to me: we could use GPT to generate reports about machine learning. At last, a practical use of ML!
Utilizing our extensive catalog of public reports on Fully Connected, I could provide Ivan with over a thousand examples of what a great Machine Learning report looks like. He could use the wandb GPT fine-tuning integration to help GPT learn to write for our community.

GPT Fine Tuning

Having "successfully" challenged BBC writers while fine-tuning GPT-3 on Doctor Who synopses, I felt it was only fair that I challenge myself in kind. After all, if I was going to insinuate a model could outdo a staff of sci-fi writers, I had to see if it could beat me writing about machine learning.
Flash forward a few days and there I am, looking at a massive spreadsheet with over a thousand public W&B reports. The reports were looking back at me. It was intimidating in a weird and confusing way.
Why was I staring at those reports? That's what we'd be using for fine-tuning. From my prior Dr. Who experiment, I knew that GPT-3 could generalize well for paragraph-sized text snippets. But sci fi language is one thing. Could it really handle entire technical reports? In fact, not even regular reports but markdown.
It looked something like this:

When we're fine-tuning, OpenAI API asks us to provide a dataset with prompt and completion columns. I've set the prompts to be report titles and completions to be the body of the reports. With the data ready, I've defined a few hyperparameters and initialized the fine-tuning:
!openai api fine_tunes.create \
-t reports_train.jsonl \
-v reports_valid.jsonl \
-m $model \
--n_epochs $n_epochs \
--batch_size $batch_size \
--learning_rate_multiplier $learning_rate_multiplier \
--prompt_loss_weight $prompt_loss_weight
After about 20 minutes, the fine-tuning was finished and I was ready to test the results. I logged the training metrics and metadata from OpenAI API to W&B with this one line of code.
!openai wandb sync --project "GPT 3 for Generating Reports"
As it turns out, when you train a model to generate W&B reports (and it learns the reports formatting we know and love), the best place to visualize and test the results is actually within a a W&B report itself. Without further ado:

Examples

Let's see some example output from the model. The goal is to provide GPT-3 a title suggestion, and let it take over the hard work of writing an ML article.
Note: In the following example we try the best we can to leave the output as it is from GPT without fixing the markdown syntax.
💡
Leave us comments on your favorite parts below and we'll be sure to try to coach the model in the future moving forward. We're giving you introductions written by a real human, but all the toggles below show what GPT-3 came up. And it came up with some unorthodox techniques, some of which ensure complete and total accuracy in elegant ways.

Prompt 1: "GANs and Transformers"

The model outputs some really fascinating results! It has clear sections, coherent discussions, and plenty of ML buzzwords. I especially like the references with links, unfortunately these additional references don't seem to be the most relevant, but I highly recommend you click on some of the links it generated for initialization. 😏
GAN-made GAN image with the prompt of "GAN"

Introduction

Autoencoder Model

Transformer Model

Conclusion

References

More resources

Prompt 2: "MNIST and Weights & Biases"

A classic combination, wandb and MNIST; what's the SOTA methodology these days? Seems like a combination of a CNN/Inception model with... pre-training from a BERT dataset... and XGBoost. Hmm; these ensemble models are getting stranger and stranger. A few highlights in this one are the impressive combination between named parameters and loss functions – note the noncommutative behavior of this local-global relationship. The model was kind enough to provide us some code to get started, although I'm running into a syntax error or two.

Introduction

Methods

Pre-training methods

Validation metrics

Prompt 3: "How to learn machine learning for beginners"

A common and important question for many these days. We're very thankful that GPT has some great advice for us. The model decided to include a lot of references, although a few are harder to track down than I was expecting. I also appreciate that the model is open to feedback, and you should definitely leave a comment about it's advice.
Rather avant garde GAN-made image with the above prompt

Introduction

Resources

Feedback

Prompt 4: "W&B Sweeps"

Weights & Biases' Sweeps is an extremely popular tool for improving the performance of your models, and exploring parameter spaces. Does GPT have any advice for how to use it? Hmm, seems like a quite technical summary of the core features. I especially like that sweeps use both gradient and gradient descent.

W&B Sweeps

How to use them

Example

More information

Prompt 5: "How to generate text with fine-tuning GPT-3"

Honestly, now that we're in a post-writing world where GPT can take responsibility for these tasks, it's a wonder we even bothered to write this post. Might as well let GPT handle this one too. I really appreciate that:
the validation dataset is the same as the training dataset
which I think is something we can all aspire to in our future ML projects. This post also references GPT-5 so it's certainly forward thinking!
GAN-made image for "machine writing"

Introduction

Fine-tuning GPT-3 and the Dataset

Results

Conclusion

Conclusion

So there you have it. That's how you can use fine-tuning GPT-3 to generate text. With the fine-tuning integration we're able to help GPT learn what an FC report is all about. However, it seems like for now, we're going to have to continue to rely on our colleagues and community to write brilliant reports.
Have a great April and check out our newly revamped Fully Connected.
Tags: Articles
Iterate on AI agents and models faster. Try Weights & Biases today.