Home · Blog · Lesson 6: Context Window and Its Limits

Lesson 6: Context Window and Its Limits

By Tanzeel-ur-RahmanCodeHubb & MindCrafts AIFree AI Course اردو میں پڑھیں

🌹 Lesson No: 6

Context Window: AI's Information Capacity and Its Limits

By Tanzeel-ur-Rahman (CodeHubb & MindCrafts_AI) Farooka (Sargodha)

Assalamu Alaikum wa Rahmatullahi wa Barakatuh!

Suppose you are preparing for your exams. In front of you is a desk on which books, notes and registers are placed. As long as the necessary material is present in front of you, you can look at it and answer the questions. But if too many things collect on the desk, finding the necessary information can become difficult.

While working with AI, a similar concept also comes before us, which is called the Context Window.

Many people think that once AI is told something, it will always remember it in every conversation. The reality is that the information present before AI also has a specific capacity. Understanding it is necessary so that, while working on long conversations, large documents and complex projects, we can obtain better results from AI.

1. What Is a Context Window?

Context Window means the capacity within which an AI model can keep the conversation and related information in front of it in order to prepare an answer.

This can include the messages of the current conversation, instructions and provided material. This capacity is usually expressed in Tokens.

To understand a Token, it is enough to know that AI does not necessarily count text word by word. One word can consist of one or more than one token. The number of tokens can also differ in Urdu, English and other languages.

For example, you are taking AI's help to build a website. You told it the purpose of the website, then explained the necessary features, provided several pieces of code and had various changes made. All this information can become part of the context of the conversation and uses some part of the available Context Window.

If the conversation becomes very long, then, according to the system's method of working, old information can be shortened, or some details may not be used effectively while preparing the answer.

Important point: The capacity of the Context Window is not the same in every model. Different models can handle different amounts of information.

2. The Difference Between Context Window, Memory and Chat History

These three terms are certainly related to one another, but they do not mean the same thing.

Context Window: The capacity of the information available before the model to prepare the current answer.

Memory: A facility of some AI platforms through which a user's related information or preferences can be saved for future conversations.

Chat History: The record of previous conversations, which can be opened and viewed later.

For example, in one conversation you said that you are a web developer and usually work on WordPress. If the relevant AI platform saves this information in its Memory, it is possible that it will also be used in a future conversation.

But the existence of a record of a previous conversation does not mean that every sentence of that conversation will automatically come before the model in every new chat.

Similarly, information being saved in Memory and that information necessarily being used in every answer are also two separate things.

3. Does a Large Context Window Mean Better Results?

Not necessarily.

The benefit of a large Context Window is that the model can keep a greater amount of text and related material in front of it during a single task. This facility can be useful in long documents, research material and large projects.

But greater capacity does not mean that the model will necessarily understand every detail correctly or include every important point in its answer.

For example, you provided AI with a long document in which fifty important points are present. Despite reading the document, AI can overlook an important point or interpret it incorrectly.

Therefore, instead of relying only on a large Context Window, it is also necessary to keep the question clear, point out the necessary information and verify important results.

4. How to Keep Important Information Safe in a Long Conversation

Suppose you are building a web application. At the beginning of the conversation, you told AI which technology will be used in this project, which features are necessary and which things must not be changed.

After several stages, the conversation has become quite long. Now you want to add a new feature.

In such a situation, do not simply assume that all the previous instructions will still be present in front of it in the same way. Instead, adopt the following method:

First step: Have a summary of the important decisions made.

Tell AI to write down, in brief points, the important decisions decided so far, the necessary conditions and the remaining work.

Second step: Save the summary.

Save it on your computer, in your notes or in the project's relevant file.

Third step: Provide the relevant information in a new conversation.

If a new chat has to be started, provide the project summary and the necessary instructions along with it.

Fourth step: Verify the important conditions.

Before an important change, tell AI to make clear which necessary conditions its answer is based on. Then compare them with the original notes or document.

By this method, keeping important information organised and continuing work on long projects can become easier.

5. Practical Exercise: The Method of Reminding AI of Important Information

To understand this concept, do the following exercise.

Step No. 1: Open a new conversation in your favourite AI tool and give these instructions:

"We are working on a web development project. Its name is CodeHubb Portal. It should include the facility of user registration, login and profile management. For now, record this information briefly."

Step No. 2: In the same conversation, ask a few questions about website speed, SEO, social media marketing or some other topic. Then come back to your project.

Step No. 3: Ask AI:

"What basic features of our CodeHubb Portal project were decided?"

See how accurately it states the information provided earlier.

Step No. 4: Now tell AI:

"Prepare a brief summary of the important decisions decided so far about our project, the necessary features and the remaining work. About anything you do not know, state it clearly instead of guessing."

Save this summary.

Step No. 5: Open a new conversation, provide the saved summary and ask AI to state the project's basic features.

Now compare its answer with the first answer.

The purpose of this experiment: It is not to prove that the Context Window ends after a few messages. From this exercise, what is to be understood is why saving a summary of important information and providing it again when needed is useful in long projects.

If AI forgets something, the reason for it is not only the Context Window; it can also overlook information or fail to use it correctly.

Today's Takeaway and Task

Today's practical work is to have AI prepare a brief Project Summary for one of your ongoing projects.

Include these four things in this summary:

1. The purpose of the project.

2. The important decisions decided so far.

3. The necessary conditions and features.

4. The next stages and the remaining work.

Save it so that, when needed, it can be used in a new conversation.

Be sure to write this difference in your notebook:

Context Window: The capacity of the information available for the current answer.

Memory: The facility of related information saved for future conversations.

Chat History: The record of previous conversations.

Tell us in the comments: In a long conversation, has it ever happened that AI overlooked an important instruction? In that situation, what method was adopted?

Tanzeel-ur-Rahman

#Lesson6 #ContextWindow #AIMemory #ChatHistory #AIProjects #PromptEngineering #MindCraftsAI #codehubb

Join the WhatsApp channel for all previous lessons, and check the comments for Lesson 5.

Enjoyed this lesson?

The full course is completely free — a new lesson every day on the Facebook Page and WhatsApp channel.