Showing posts with label decoding. Show all posts
Showing posts with label decoding. Show all posts

Saturday, June 29, 2024

LLM Project 1: Translating, Summarizing, and Paraphrasing (using T5)

Enjoying the LLM journey so far?



I've been introducing LLM concepts so that you can understand what some terms mean and how they appear as code outputs.  This is a reflective post about concepts covered in the previous chapters, namely tokenization, encoding, and decoding.  Don't remember what these words mean?  Have a look at the posts below:

As promised in the last post, this time we'll be looking at how to actually USE T5 models to do the following tasks: translation, summarization, and paraphrasing.  
For future reference, generating answers using LLM models is called "inference."

Have a look at the Python code below!  


You'll be able to see how one can:
  1. Import the model
  2. Execute a query
  3. See the output the model generates
  4. See which tasks the model can perform best.

I'm in the mood for trying something new for a change, so here's a quiz based on the code above.  Read the following questions and comment down below!
Q1:  What was the name of the model that I used?
Q2:  What were the tasks that I had the model perform?
Q3:  Which task did the model perform best at?

Ending

Hi everyone!

Are you enjoying the series so far?  I've actually found all of this to be fun to present.  ChatGPT can be useful and entertaining but I started to enjoy them even more once I started using and training my own models.  It doesn't always work in the way that I want it to... but I guess that's part of what makes them interesting to work with.  🤣

Since it's now halfway through 2024, I'm thinking of sharing a post about neurodiversity next month.  Still considering what to write about but I'll let you know when I'm comfortable sharing it. 👊














Sunday, May 19, 2024

LLM Part 3: Decoding

Tada!  Here's Part 3 of the large language model series!

Are you excited for the next chapter of our LLM 101 series?  So far we've covered tokenization and encoding.  If you need a refresher, have a look at the pages below.
  1. LLM Part 1: Tokenization
  2. LLM Part 2: Encoding
In short, we've learnt how to break down pieces of text and assign a number to each piece.  This ensures that the model will "know" what your question is going to be.  But how do these models answer back in a way humans would understand?  This is where the concept of decoding is important.

If encoding is to turn text into numbers, decoding is the reverse: to turn numbers into text.  Here's a PDF of a Jupyter Notebook which allows us to revise the previous concepts as well as show what decoding looks like in code.


Now that you've had a look at the PDF, we've now covered tokenization (breaking down text to pieces), encoding (converting pieces of text to numbers), and decoding (converting numbers back to text).  

You should now be able to:
  • Type a text-based input into the model
  • Retrieve text back from the model

I know it doesn't sound like you're doing much at the moment but nailing these concepts will help you build and use LLMs in the long run.  Next time, we'll be asking the model to perform simple tasks using Python.  Namely, summarization, paraphrasing, and translation.

Ending

How have you found the LLM series so far?  Hopefully it's been helpful in understanding these basic concepts.  I remember being pretty lost when I first started studying about LLMs, so I'm aiming to make LLM studies more accessible for all!!! It may be easier to use ChatGPT to generate answers (especially since some of the earlier versions are available for free now) but I found that being able to use LLM using code is very satisfying. 💪

A New Frontier: Building bots without code!!!

 Dear Readers,  Welcome back to this month's Chronicles of a Neurodivergent Programmer.  Last month, I took a break from writing about t...