about
Classifier Free Guidance works on LLMs with a significant boost in performance (arxiv.org)
22 points by famouswaffles on Jul 3, 2023 | hide | past | pdf | 8 comments on HN

In plain words: At each step the model runs twice, with and without the prompt, and the answer is pushed toward what the prompt asks for. On plain language models this beats normal generation across questions, reasoning, code and translation, with gains like doubling the model's size.

Abstract · Stay on topic with Classifier-Free Guidance

Classifier-Free Guidance (CFG) has recently emerged in text-to-image generation as a lightweight technique to encourage prompt-adherence in generations. In this work, we demonstrate that CFG can be used broadly as an inference-time technique in pure language modeling. We show that CFG (1) improves the performance of Pythia, GPT-2 and LLaMA-family models across an array of tasks: Q\&A, reasoning, code generation, and machine translation, achieving SOTA on LAMBADA with LLaMA-7B over PaLM-540B; (2) brings improvements equivalent to a model with twice the parameter-count; (3) can stack alongside other inference-time methods like Chain-of-Thought and Self-Consistency, yielding further improvements in difficult tasks; (4) can be used to increase the faithfulness and coherence of assistants in challenging form-driven and content-driven prompts: in a human evaluation we show a 75\% preference for GPT4All using CFG over baseline.

Guillaume Sanchez, Honglu Fan, Alexander Spangher, Elad Levi, Pawan Sasanka Ammanamanchi, Stella Biderman
arXiv:2306.17806 · cs.CL, cs.CV, cs.LG · submitted Jun 30, 2023
abstract · pdf · html

add comment on HN

More granular prompting like this is a huge deal... If they ever release the code for it. Even if its cherry picked, the effect on that "Dragon flying over France" prompt example is huge.

Also, I noticed Stability and Coreweave provided funding for the compute. That actually makes me kinda suspicious, like they are going to keep the implementation to themself.

The author of the paper has already shared their implementation and are willing to contribute it to hf-transformers: https://github.com/huggingface/transformers/issues/24536
Since many of the advancements in the diffusion Community (lora etc) are applicable to the text generation community, I don't see how this won't hit the local llama scene within the next month or so.
NLP folks are so slow to implement EVERYTHING

Where the hell are negative prompts? Where are word weights? Where is ANYTHING that I can do in Automatic1111?

There are no technical reasons why they can't be implemented.

It appears to be a one-line (or, if you prefer readability, one-function) change - my guess is 80% chance by EOD and 95% chance by end of week :^)
Correct me if I'm wrong, but the change seems to be:

    return_logits = generated_logits + cfg_scale * prompt_logits
Pardon my ignorance, but what exactly does "Classifier Free Guidance" mean, and what are logits?
This is basically a balanced audio cable, but in a bajillion dimensions