# How to generate text without generation?

- Speaker: [Nitzan Cohen](/wiki/speakers/nitzan-cohen.md)
- Event: [Reversim Summit 2024](/wiki/years/2024.md)
- Video: https://www.youtube.com/watch?v=OB6cih-UDI8
- Transcript: [/transcripts/2024/38-OB6cih-UDI8.md](/transcripts/2024/38-OB6cih-UDI8.md)
- Language: Hebrew · Type: talk · Level: intermediate
- Topics: [Machine Learning](/wiki/topics/machine-learning.md), [AI and LLMs](/wiki/topics/generative-ai.md), [Cloud Computing](/wiki/topics/cloud.md), [Performance](/wiki/topics/performance.md)

> Written by an LLM from machine transcripts. It can contain errors. Check the transcript before you quote it.

## Summary

This talk explores how to solve text editing and grammar correction problems efficiently without relying solely on slow, resource-intensive generative language models. The speaker shares a real-world project where the team needed a solution that was fast, high-quality, and cost-effective to handle millions of user requests in the background. By reformulating text generation as a sequence editing task using encoder-based architectures, they achieved a ten-fold speedup in runtime. The audience learns how to rethink task definitions and balance expressivity and cost in machine learning projects.

## Key points

- [0:00](https://www.youtube.com/watch?v=OB6cih-UDI8) The speaker introduces the topic of generating text without generation based on a real machine learning project.
- [8:42](https://www.youtube.com/watch?v=OB6cih-UDI8&t=522s) The baseline approach of using large language models is too slow and expensive for high-volume background features.
- [9:55](https://www.youtube.com/watch?v=OB6cih-UDI8&t=595s) Analyzing why generative decoder models are slow reveals that they generate text token by token without parallelization.
- [14:21](https://www.youtube.com/watch?v=OB6cih-UDI8&t=861s) Tasks like summarization, paraphrasing, and grammar correction can be reframed as editing tasks rather than pure generation.
- [16:26](https://www.youtube.com/watch?v=OB6cih-UDI8&t=986s) Method 1 uses a classification approach with encoder models to predict keep, delete, or insert actions in a single forward pass.
- [18:29](https://www.youtube.com/watch?v=OB6cih-UDI8&t=1109s) Method 2 introduces predefined functions to handle more complex transformations without exploding the label space.
- [21:39](https://www.youtube.com/watch?v=OB6cih-UDI8&t=1299s) Method 4 splits the problem into a detect-and-fill strategy using encoder models and masked language modeling.
- [24:43](https://www.youtube.com/watch?v=OB6cih-UDI8&t=1483s) Re-framing the task definition allowed the team to improve runtime performance by ten times without sacrificing quality.

## Takeaways

- Reframe machine learning problems based on the relationship between input and output to unlock more efficient architectures.
- Use encoder-based models for tasks like text correction to benefit from GPU parallelization instead of relying purely on generative decoders.
- Balance expressivity and computational cost by breaking complex generation tasks into simpler classification and editing steps.

## Questions this talk answers

- How can I replace a slow generative large language model with a faster encoder-based model for text editing tasks?
- What is the difference in computational efficiency between encoder and decoder models for sequence processing?
- How do I formulate grammar correction as a classification problem instead of text generation?

## Technologies

Python, PyTorch, GPT, Transformer

## Tags

cost optimization, machine learning, nlp, performance, text generation, transformers
