Weekend with ChatGPT

Reading Time: 5 minutes

A few days ago, OpenAI released a chat-based model called ChatGPT and provided an interface for users to interact with. ChatGPT is a form of conversational AI where you can ask questions or have a conversation with a bot backed by a model. As per the announcement –

The dialogue format makes it possible for ChatGPT to answer followup questions, admit its mistakes, challenge incorrect premises, and reject inappropriate requests

The last time I was this excited by GPT was when a GPT-3 bot was posted comments in AskReddit and no one realized that those comments were from a bot.

Over the weekend, I decided to give this GPT-3.5 (should we start calling these with a T-prefix, like T-1000?) a spin. Needless to say, it has been impressive. I plan to use this bot as a tool in my daily usage (a friend remarked that they would use it to generate poems for holiday greeting cards!).

Following is one such interaction I had with ChatGPT:

As you can observe above, the ChatGPT maintains context from one conversation to the next, though as per the information on the site, it does not personalize. In other words, it is not tailoring responses based on the types of questions asked in the past by the human user. Every session opened at https://chat.openai.com/chat starts anew without any history or memory.

Still, with context maintained within a session, this model of Q&A for information retrieval seems more natural than one with search engines where personalized results lack connection from one to another. The shift from a command/query based structure to a conversational one is very empowering since latter mimics a dialogue between instructor/student or parent/child. As humans tend to be exploratory when researching any subject (or even shopping), the conversational approach is also more practical.

Also, as the research preview blog post indicates, there is an emphasis on safety with several mitigations in place compared to its older sibling InstructGPT (and there is also a contest to provide more feedback). In my tests, the model tends to be aware of bias and avoid generating any replies that may have been inferred (and thus possibly biased) than factual in nature.

Finally, the multi-lingual support also seems to be good –

I further asked for the same haiku to be composed in the style of the famed poet Matsuo Basho

Note the subtle changes in the style of the haiku!

The model is also aware of its limitations in terms of what it has been trained on or its capabilities.

When asked about a word and a follow-up question on recent history (currently chatGPT seems to be not aware of time or its passage) – 

Overall, this is a very exciting development in the conversational AI space. With the rapid growth in AI model sizes, the future seems very promising. Past experiences have not been equally exciting either due to those being solely voice-based (which has not been accurate in parsing even with personalized voice models) or due to lack of a web-based (or even a dedicated app-based one) interface.

While it does seem like Google search is facing serious competition here, there are still a few gaps to ponder over –

  1. The model is trained on a static model of documents, code, and text corpora. In other words, it does not evolve or update itself in real time. It will be interesting to observe the accuracy and capabilities of ChatGPT in an iterative mode.
  2. Since it is not connected to the Internet, the boundaries of its knowledge are well-defined and known. If it needs to be a real-time search engine, these “boundaries of knowledge” may be hard to define. More importantly, only time will tell if these safety mitigations continue to safeguard all the generated responses, especially if they are being generated in real time.
  3. Personalization may be helpful where responses are tailored to the user asking the questions based on history. Care needs to be taken to avoid any filter bubbles by being explicit about it: providing a generic answer and a personalized one separately. Privacy is another aspect to balance when it comes to personalization.
  4. The interaction here is equivalent to a “I am feeling lucky” in a search engine. At the same time, users may be more interested in all sources of information than the most pertinent ones. This behavior can happen since we often may not know what we are looking for until we examine the choices. In this sense, a hybrid mode of a chat-based answer with a list of results on the side seems ideal. Google is already providing handy solutions in response to search queries, but usefulness can be improved with a chat-based interface such as ChatGPT.

Note that in the comparison above, I have excluded the analysis of ChatGPT’s prowess when it comes to code (powered by Codex, which also powers Github CoPilot), where it seems to have no other parallels to compare to.

When it comes to voice assistants, there is much to be said in terms of conversation since the human voice tends to be much richer than text in terms of tone, intonation and many similar characteristics which convey a lot too.

There are questions being asked whether chatGPT can achieve AGI which will make that AI to to be completely indistinguishable from a human in all the traits while being much more efficient and scalable. While it will be a matter of time – question of when and not if – before such a parity is reached, we need to avoid underestimating the usefulness of chatGPT-like tools for humans as a powerful force multiplier.

Augmentation of humans with a powerful AI has been in the realm of science fiction (Daedalus from Deus Ex to pick one) and research papers such as this one from Doug Engelbart from the 1960s (thanks to Notion’s post on their AI assistant for pointing me to this). It is about time when that futurism starts converging with the present.

Finally, from a futuristic standpoint, the NorthStar in this space has to be Star Trek’s onboard computer (voiced by Majel Barrett in multiple episodes) which really understands the speaker, converses with them, and remembers them individually between interactions.

Gossips in Distributed Systems: Physalia

Reading Time: 6 minutes

I often take notes and jot down observations when I read academic/industry papers.   Thinking of a name for this series ‘Gossips in Distributed Systems’ seemed apt to me, inspired by the gossip protocol with which peers in these systems communicate with each other which mimics the spread of ideas and technologies among practitioners and people alike. The goal of this series would be to do a round-up of any new concepts or papers in computer science (often in distributed systems but not always) and share my thoughts and observations.

Today, we are going to talk about the Physalia paper from AWS: “Millions of Tiny Databases”.  This is inspired by Physalia or  Portuguese man-of-war (pictured), a siphonophore, or a colony of organisms.   Overall, the paper, even though slightly on the longer side, is chock full of details and best practices pertaining to design, architecture, and testing of distributed systems.

Given the size of the paper and the wide gamut of topics that it touches, we will be discussing only a few aspects of the paper in this post along with some observations. In subsequent sequels, we will go into others in further detail. 

Before proceeding ahead, the present EBS architecture with Physalia has a primary EBS volume (connected to EC2 instance) and a secondary replica, and data flowing from instance to primary and replica in that order. Also, this chain replication is strictly within an Availability Zone (AZ) mainly due to inter-AZ latencies being prohibitive. The pre-Physalia architecture had a similar replication chain but with the control plane also being part of EBS itself rather than a separate database (which we will soon find out was not a good idea).

Credits: Screenshot of figure in the Physalia paper

Raison d’être

All good-to-great systems have a story that necessitated their existence. In this case, it was an outage of the us-east-1 region in 2011 caused by overload and subsequent cascading failure which necessitated a more robust control plane for failure handling. The postmortem of that outage is here, it is quite long and wordy, so I will summarize it here. 

Continue reading “Gossips in Distributed Systems: Physalia”

Circuit Breakers: Stock Markets and Distributed Systems

Reading Time: 4 minutes

There are many parallels between the stock markets and the distributed systems in computer science. This post, in particular, is about circuit breakers prevalent in them for better resilience against irrational exuberance and upstream service errors respectively. In particular, this is about exploring breakers in stock markets from a distributed systems perspective. 

Of late, the US stock market (and the non-US ones too) has been quite volatile, to say the least. CBOE VIX index  (also known as the ‘fear index’) which measures implied volatility in the S&P 500 index, has traversed a wide range between highs and lows, fluctuating several points on many of the days in March and April, peaking at 82.69 on 16th March (stock market bottomed out on 23 March, both as of May 10, 2020).  

Continue reading “Circuit Breakers: Stock Markets and Distributed Systems”

Haiku and Muffin Top

Reading Time: 3 minutes

My interest in haikus was recently rekindled by James May’s Our Man in Japan series in which he frequently bookends the episodes with a haiku of his own. Accordingly, I started searching for a haiku ebook on Libby (which if you are not using, you should give it a try!) and I found Haiku: Classic Japanese Short Poems.  The book has haikus in Romaji, English, and vertical Japanese. The book is spartan in its use of graphics and has a very simple structure much like the subject matter it deals with. There are about 60-70 haikus in it from the four great haiku masters.

Haiku, for those hearing about it for the first time, is a form of Japanese poetry conforming to certain constraints on syllables (5-7-5) and split over three lines. The book itself does not delve sufficiently enough into the history of haiku, though the Wikipedia page on Haiku proves more than sufficient here. Listing haikus often commence with the famous Matsuo Bashō’s old pond haiku which goes like: 

As it should be evident at this point, they are remarkably short, and often involve nature and seasons. They behoove the reader to invoke their imagination and experience the verses prima facie.  To help with this, the haiku verses are often read slowly, more akin to sipping tea gently. A tabula rasa-esque mindset, for that short period, helps. As a result, the haiku focuses as much on the material as the reader too, a dichotomy similar to an artwork in a gallery and a keen observer. 

Continue reading “Haiku and Muffin Top”

Debugging docker containers with gdb and nsenter.

Reading Time: 3 minutesMany a time you feel the need to debug a process running inside the container with gdb (or anything that uses ptrace). It is not as straightforward (at least for now) as attaching gdb to host pid of the container process or to docker client/daemon.

GDBLogo
docker

You can go about in following ways:

  • If you try to attach gdb to the hostpid (let us call it HPID) of the container process (ie. PID in host namespace), it gives following warning:

  • You can install gdb in container beforehand or with docker exec and attach to the process. However, for a non-privileged container or one which doesn’t have CAP_SYS_PTRACE capability this won’t work. You will get ‘Permission denied’ otherwise. More info on capabilities with docker here.

    Any of the following will do:

    docker run   -d  -i  --cap-add sys_ptrace ---name box centos:centos7 sleep 100000
    docker run   -d  -i  --privileged  --name box centos:centos7 sleep 100000

Continue reading “Debugging docker containers with gdb and nsenter.”

Slides from PLMCE 2014 breakout session

Reading Time: 2 minutesAs many of you already know, PLMCE is an annual MySQL
community conference and Expo organized by Percona in the month of April
(usually). It is a great conference, not only to meet new and eminent people in
MySQL and related database fields, but also to attend interesting talks, and
also to give some.

This year I spoke about synchronous replication at a higher level. The talk was
titled “ACIDic Clusters: Review of current relational databases with synchronous replication”. Having previously given talks with boring titles (but interesting content), this time I decided to go with an interesting title, and it seemed to fit well with topic being discussed.
Continue reading “Slides from PLMCE 2014 breakout session”

My twitter setup

Reading Time: 3 minutesI have been using Twitter for a while under the handle randomsurfer.
I tend to use web interface sometimes, but regularly I use the command-line/ncurses interface.

There are two main clients that I use regularly. One is ttytter
which is a nice command-line client which offers advanced functionality such as
creating/editing lists and scripting. Refer to the linked page for more scoop. I
would say ttytter is one of the best implementations of Twitter API. It allows
for advanced scripting like:

The above invocation can be used to get the list of everyone you follow and
populate the configuration file to allow auto-completion at ttytter prompt. You
can also run ttytter as a daemon.
Continue reading “My twitter setup”

Annoying access keys on web pages

Reading Time: 2 minutes5463604427_8e7998ddcc_b
HTML access keys were introduced to improve web accessibility and
they still seem to serve that purpose. Wikipedia defines them
as “In a web browser, an access key or accesskey allows a computer user to
immediately jump to a specific part of a web page via the keyboard.”
If you
view hover over the link, it should show up in tooltip; for a wikipedia page,
for instance, the ‘view history’ is mapped to ‘alt-shift-h’ by default. In HTML
source, you can see them as accesskey attribute.

Having said that, they can be really annoying many a time. This is true
primarily when you have bound that access key to a mapping in the browser or in
a plugin or even to a global binding (say, with xbindkeys). What makes it even
more worse is that on almost every site it is impossible to disable them.
Continue reading “Annoying access keys on web pages”

MySQL file limit, table cache and max_connections

Reading Time: 4 minutes

MySQL variables open_files_limit, table_open_cache and max_connections are
inter-related, and this is for obvious reasons: all deal with file descriptors
one way or another.

If one of the value is provided but others are left out, mysqld calculates
others using a formula and in some cases, emits a warning if not possible.

The whole calculation behind obtaining the final file descriptor limit is a bit
byzantine and is as follows (for Linux):

EDIT: This applies to MySQL 5.5, in 5.6, as Daniël in comments pointed out,
few things have changed, check comment for details. I will probably make a
followup post on the differences.

  1. First it tries to calculate a minimum requirement based on max_connections
    and table_open_cache. As for other variables, if it is not provided in cnf or
    on command line it uses defaults.

    <br />    /* MyISAM requires two file handles per table. */
        wanted_files= 10+max_connections+table_cache_size*2;
    

    Continue reading “MySQL file limit, table cache and max_connections”