skip to content
zen catsDeeps.dev

Transformers are mind boggling

/ 4 min read

Exciting are the times that we live in and much exciting are the functions that Language models can help us solve. Recently I got hit with this problem of grouping sentences from a self help book into which categories they fall under. Yes of course, one could do it manually, that’s the level of spirit I aspire to have someday !

Let’s bump up the number to 2000 sentences, how’s the spirit doing now?

That’s where our computer buddies hop right in.

The following lines are representative of the 2% pain that I would face if I had to manually group them into three categories of relationship, fear, pain.

What is pathos?
What is action?
What is your truth?
What is shyness?
What is society?
What is calamity?
Is God everywhere?
Is that true?
What is religion?
What is death?
What is Karma?
What is sorrow?
What are manners?
What is true love?
Why do we get angry?
What is freedom?
What is the sun?
What is interest?
What is love?
Why is there danger?
What is beauty?
What is thinking?
Is love a feeling?

Here is the output that our computer buddy gave at the end of our small adventure to tinker-land !

======================


Query: relationship
Is love a feeling? (Score: 0.6281)
What is love? (Score: 0.6209)
Is that true? (Score: 0.6137)
What is pathos? (Score: 0.6046)
What is interest? (Score: 0.5947)


======================


Query: fear
Why do we get angry? (Score: 0.7722)
What is calamity? (Score: 0.7599)
Why is there danger? (Score: 0.7222)
What is sorrow? (Score: 0.7144)
What is shyness? (Score: 0.6771)


======================


Query: pain
What is sorrow? (Score: 0.8052)
Why do we get angry? (Score: 0.7873)
What is calamity? (Score: 0.7095)
What is Karma? (Score: 0.6442)
What is death? (Score: 0.6329)

Ah! How satisfying it is to get such an output.

Let’s get into the deeper implications and possibilities

I get it that’s it pretty much some quantified vectors and we are just clustering the nearby ones.

However the intention is to spark of an interest into getting you to work on that project that you have been thinking long on what Idea to get started on.

Some ideas that come on the top of my mind are

  • What if you train a music language model to give you a list of songs like the one artist that you like more. (Sounds like spotify, eh. They are already doing that for us. Smart.)
  • What if you are into genomic sequences, which are pretty much like mysterious sentences which make absolutely no sense to the naked eye, you could train a language model in such a case to help you.
  • What if you want to classify a bunch of tweets on the basis of semantic similarity and not in a strict sense of training a hard core area specific classifier and using it, but just simply pasting your tweets and running a search.

What possibilities are waiting to be utilized that’s there in the knowledge captured by these models that can make our life easier.

I used it to help me arrange question into similiar groups, what will you use it for>?

For random sequences that makes no sense to us.

like for example ‘aaaaba’, ‘ccccccas’, ‘rrrrrrrr’, ‘abcbccccc’

if we search for A and C

======================

Query: a
**aaaaba (Score: 0.8174)**
rrrrrrrr (Score: 0.6658)
ccccccas (Score: 0.6398)
abcbccccc (Score: 0.5588)

======================

Query: c
**ccccccas (Score: 0.7573)**
aaaaba (Score: 0.7112)
rrrrrrrr (Score: 0.6494)
abcbccccc (Score: 0.5550)

The tweet example:

for input we just give the top tweets from this place

for output: we searched for Brother, Puppy, terror, love

======================


Query: brother
HELP ME PLEASE. A MAN NEEDS HIS NUGGS (Score: 0.5541)


======================


Query: puppy
For every retweet this gets, Pedigree will donate one bowl of dog food to dogs in need! 😊 #tweetforbowls (Score: 0.4782)


======================


Query: terror
broken. from the bottom of my heart, i am so so sorry. i dont have words (Score: 0.5774)


======================


Query: love
teamwork makes the dream work (Score: 0.5507)
Always in my heart @Harry_Styles . Yours sincerely, Louis (Score: 0.5020)