Saturday, August 31, 2024

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 tech and instead shared by thoughts about a type of imposter syndrome surrounding my identity as a disabled person.  This time, I would like to share a recent experience building bots without a single line of code!  


Up until now, I've had experience using ChatGPT models using the chat interface, created bots using prompt engineering using the Python programmatic interface, and trained my own LLM models using open-source models.  Continuing on in my LLM journey, I was given the opportunity to use an open-source LLM app building platform that allows users to make their own chatbots.  For previous posts related to LLM have a look at the list below:



In this revolutionary platform, the simplest bots could be built with just prompt engineering.  Let's say that you want to build a summarizing bot.  Just write a prompt that reads "You are an expert at summarizing long pieces of text.  You will be given a piece of text, so please answer the summary."  And... that's it!!! Congratulations, you built a bot that can summarize text!  


If you want to make a more complicated bot... you still might not need to write a line of code!  There was an additional option to create your own custom bot using a simple drag-and-drop method.  You're provided with several types of blocks that each serve their own function.  Combine the different blocks you need in a sequence, and you should be able to build the bot you want.  For example, if you want to build that only summarises text written in English but not recognize any other language, you can add a divider that can recognize whether the text was written in English or not.  If the text was in English, then create a summary, but if the text was in.... let's say Spanish, then return a message saying "Sorry, I only know English."  


There are a few other features, including add-ons and writing a few lines of code for detailed specifications, but still this platform makes it much easier for everyone to build their own bots irrespective of their knowledge of LLMs or tech.  


Call me old, but I still remember the time the movie "I. Robot." came out.  There was a very "human" robot existing among other non-sentient robots with an antagonist that was introduced as a very intelligent AI.  With the rise of awareness about generative AI, perhaps we're finally heading to a transitional phase in which mankind is becoming less fearful and more accepting of the existance of AI in society.  As such there may be a growing demand for simple AI-based bots to be accessible to the general population.  


I look forward to venturing further into the realm of generative AI as well as data science in general to see what the future beholds.  I certainly had fun playing speed typing games and learning how to code my first "Hello World."  Hopefully there will be a lot of people in the future that will be able to enjoy the fun world of tech!!!


Sincerely,


Lukas Fleur


P.S. If you're interested in me showcasing this platform on this blog, let me know in the comments below!  

Monday, July 15, 2024

"Am I disabled enough?" A neverending thought

 Hi!  

Have you enjoyed my latest post where I attempted to apply basic LLM concepts to summarize, paraphrase and translate a block of text?  

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


I'm going on a summer break soon so I thought I'd take a bit of a break from coding and generative AI and focus on a topic related to neurodiversity!  This time, I'm going to share my thoughts on my personal experience going back and forth wondering whether I'd be... disabled enough to call myself disabled?  If you're interested in the discussion about whether autism is a disability check out a previous post:  Is autism a disability?


I was inspired by a YouTube video by Jessica Kellgren-Fozard (Am I disabled enough ft. Hannah Witton) and their experiences with that same dilemma.  It seems that it's a very common sentiment and I've also met people in my own life that share that same feeling about themselves.


When it comes to myself... I feel conflicted.  Mainly because on one hand I am able to live an independent life for the most part.  I live on my own while renting my own property, have a full-time job, and I do have close friends and family.  In my every day life, I don't particularly feel like there's a noticeable difference between my life and other presumably neurotypical and/or able-bodied acquaintances.  


However recently I took an exam that affects my future career prospects.  Back when I was in the middle of booking this exam, I was going through the website for information about accessing reasonable accommodations... and they didn't offer the exact accommodation that I needed which was extra time in exams.  When I was first diagnosed as having specific learning difficulties, the psychologist stated that extra time WILL BE REQUIRED in any written exams so the exam provider strictly prohibiting the request of extra time in exams... made me nervous. 😰  (If you want to read more about specific learning difficulties, check out: Unravelling the mystery of specific learning difficulties) Still me passing this exam is a requirement for future promotions, so I scrolled through any other accommodations that the exam provider offered and decided to request the use of ear defenders during the exam so I won't get distracted with people going in and out of the exam room (I suppose this is an example of auditory processing difficulties).  In the end I did manage to book the exam with the use of ear defenders approved and thankfully the exam venue was close to where I live (unfortuately not all exam venues allow the use of ear defenders even if the exam provider approves of it).  I also managed to pass this exam and got a bit of a celebratory allowance from the company I work at, so all's well that ends well!


While I do have to take exams occassionally, it's not nearly as an all-encompassing existance as it used to be compared to my student years.  However I do still experience struggles with specific activities of daily living, most notably shopping, holding a conversation in public spaces (especially with multiple people or in loud spaces), and not being good at consistently make and maintain relationships.  Shopping is diffcult due to an uncomfortable sensory experience that can lead me to have meltdowns (or more accurately shutdowns) if I don't take frequent breaks in between shops.  I struggle to follow a conversation with multiple people since I lose track of the topic, and zone out in the middle of long conversations.  I just sort nod along and respond as little as possible, engaging in my surroundings (or food if it's during a meal) instead.  When it comes to relationships, I do have people I'm close with but most of my friends and family live far away and consistently being active on social media has never been my strong suit so I need to have a rigid schedule to keep in touch with them and if it doesn't work, I'll just lose touch.  


The above instances reminded me that the world is not very accessible and that there is definitely a component of our temperament relative to the rest of society disabling us regardless of whether the condition itself is life-threatening.  It could also be noted that anyone that doesn't identify or suspect themselves as having a disability would rarely, if ever, even think about what can be considered a lack of consideration.  


I remember a conversation I had regarding neurodiversity (although I didn't "come out" at this point) and someone mentioned that they could be neurodivergent but is afraid to be looked down on because of it.  As a response, another person said "it's fine to be a bit quirky if you're not a bother to anyone."  This phrase may have been meant as a reassurance but I personally found it an ableist and honestly offensive response.  Sure I don't recommend intentionally going out of your way to bother other people but the fact that this person said being a bother to other people is the  line between a "quirk" and a disability bothered me.  Surely the line would be whether the person is living a reasonably healthy life, or at least can have opportunities for a good quality of life?  This phrase made me realize the repercussions of an ableist society that 1) judges disabled people by how "able" they appear 2) whether they are a burden on the people around them (and perhaps society as a whole) without considering the wellbeing of disabled people themselves as if they are not a part of the larger human society.  This also disturbed me since disabled people can be considered the largest minority community that ANYONE can be a part of at any given time so discussions about accessibility benefit EVERYONE not just people who are currently disabled.  


Me reflecting on this conversation and thinking about how ableism seeps into the average person reminded me that I'm very much part of the disabled community since anyone that has never considered the possibility of being disabled themselves probably wouldn't even think of this.


Even after all this I still go back and forth in my identity as being disabled because... I can still more-or-less... function without much support, but the fact I still need what's considered to be "special" support in certain situations... means I'm disabled?


How did you all feel about this post?  It may have been a bit ramblier than usual but I hope it gives an additional perspective about the question "Am I disabled enough?"  Please, comment down below because I would love to read your thoughts!

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. 💪

Monday, April 29, 2024

LLM Part 2: Encoding

Welcome to Part 2 of building your own large language model!

Part 1 was about breaking down your input text into smaller subwords. (tokenization)  If you don't remember what subwords are, have a look at the post below:

LLM Part 1: Tokenization

(If this post still doesn't make the concept of subwords very clear, please leave a comment below!  I'll try and make another post to elaborate further.)


This time we will be covering encoding: the process of converting subwords into a list of numbers called "token IDs."  Machines are good at processing numbers so encoding enables the machine to "know" what pieces of text are being fed into it.  However, it is important to note that encoding is NOT about understanding the context of the input.  (That will be covered in a future article.)  Instead it's simply about recognizing the subwords in the input.


Here is a Jupyter Notebook for you all to revise tokenization, and then show you how you can encode those subwords.  I've also added an alternative line of code that can tokenize and encode the input at the same time!

LLM Part 2: Encoding


To summarize:

  • Tokenization:  The process of breaking down the input text as a list of subwords
  • Encoding:  The process of converting the subwords into a list of token IDs
Step-by-step illustration of tokenization and encoding using example text from code.


Ending

How did you find this post?  It may be short but I hope it makes these concepts easier to digest.  Personally I struggled to know where to begin when studying LLM concepts myself when I first started out, so I wanted to explain these as simply as possible.😊  Next time we'll be covering another key process called "decoding."  Then we can finally make LLMs perform simple tasks using a few lines of code!  Stay tuned for future posts.😎

Update (2024/05/19)

The next part of the LLM series is out now!



Friday, March 1, 2024

LLM Part 1: Tokenization

 Hi everyone!


As promised, I will present a tutorial on how to build your very own large language model!  This part focuses on tokenization.

What is tokenization?

It's the process of converting human text into a sequence of numerical IDs that LLMs can understand.  A similar idea among humans is word-by-word translation of individual words from one language to another.  

For example, a word-by-word translation of "I love you." into Japanese can become "私(I)愛(love but this word is in noun-form)君(you)."

(Important: Not including context or meaning at all)

Tokenization is a necessary first step because how would a model do what you want if it doesn't even know what words you're saying!

How does tokenization work?

  1. Prepare text
  2. Break down text into smaller chucks of text:  These can be as following
    1. Words
    2. Alphabets
    3. Sub-words (Common letter combinations in words) - Most common pattern
  3. Convert chunks into numbers called token IDs
That's it!  Tokenization is all about creating a series of token IDs from breaking down your text into smaller chunks.

To get a better understanding, I prepared a mini-project tokenizing and de-tokenization the text "Hi! I'm Lukas Fleur.  Nice to meet you."


Ending

How did you find this first part?  When I was reading about tokenization for the first time, I felt like I had to read around in circles to get a good understanding of it.  Of course, if you want to have more in-depth knowledge there are more resources out there, but this is a good first step in understanding tokenization, and thus LLMs.

For now, we'll be focusing on building our own T5-model but we can revisit the topic of tokenization in the future to see what we can do using this technique!

How did you find this article?  If you enjoyed it, or hated it, comment down below!

Update

I recently re-read this page and I realized that I was actually confused about tokenization and encoding myself!  Apparently, tokenization is simply about breaking down text into smaller units, but the assignment of a token ID per token is actually encoding. (I was confused because of the name token ID haha... 😅)  I've stricken out the bits that were actually to do with encoding, and updated the code in the link to only showcase tokenization.

I'm so sorry if I've caused any confusion!  I am currently working on the next article which will be titled "LLM Part 2: Encoding" where I will expand on what encoding actually is.  Stay tuned! 👀

Update(2024/05/12)

Here's the next part of the LLM series:

Resources








Saturday, January 27, 2024

Introduction: What are Large Language Models?

Happy New Year!

Welcome back!

At the end of 2023, I started mentioning ChatGPT.  

Merry Christimas! ... Also my thoughts about GPT

To show what makes GPT models so special, it would be interesting to give a basic introduction to large language models (LLMs) in general, focusing on building simple LLMs using T5 models.

You may be wondering "What is LLM?", "What are T5 models?", "You talked about GPT last month, so why use T5 models instead?"

What is LLM?

LLM refers to a type of AI that can generate text-based answers.  ChatGPT uses GPT models which are a type of LLM.  You have your LLM, you ask it a question, and it gives you back an answer in text.  

What are T5-models?

T5 models are another type of LLM.  

You talked about GPT last month, so why use T5 models instead?

  • Intuitively easier to understand LLM concepts:  I'll write about this in more details in future blog posts, but building T5 models require a basic understanding to how LLM reads, understands, and generates human text.  T5 models are SUPER easy to build so you can have the satisfaction of building your own AI while also learning how they work at the same time!  GPT models are very easy to use but most of how the LLM generates text isn't made apparent.  (GPT models are really cool in this aspect but more on this in the future.)
  • Cost: OpenAI gives an initial $5 credit to use OpenAI models, including GPT models, but after that's spent we have to pay to use them.  T5 models are completely free to build!  
  • Simple coding:  Basic T5 models only require a few lines of code!  

Starting next month, I'll be introducing key concepts related to how LLMs generate text:
Don't know what these mean?  Stay tuned!  On February, we're going to be learning "tokenization."  Get ready to build your own LLM!

Have any questions?  Any requests?  Do you just want to chat?  Comment down below!








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...