AI Personal Learning
and practical guidance

Explain the practical application of the needle in a haystack test

The needle in a haystack test (inspired by NeedleInAHaystack) is the process of taking theKey messagesRandomly insert a long piece of text at different locations to form a Prompt for the Large Language Model (LLM), by testing whether the large model can be used from thelong textExtracted fromKey messages, and thus a way to test the ability of the large model to extract information from long texts, can reflect the LLMBasic competence in comprehension of long textsThe

 


Explain the practical application of the needle in a haystack test-1

 

Why a needle in a haystack - the pin test

  1. Replacing complex RAG retrieval strategies with long contexts, support for long contexts large models are represented by Dark Side of the Moon and anthropic.
  2. Understand whether the big model understands the various types of factual knowledge about recall as a way to rationally design applications.
  3. The effect of recalled factual knowledge on inference as it changes in length as a rationally designed application.
  4. Selection of a suitable macromodel based on test results.

 

We have some basic consensus at this point

As the context length increases, the retrieval performance decreases, and in particular "pins" inserted in the first half of the document are more difficult to retrieve. In addition, the performance of the inference task usually lags slightly behind that of the retrieval task.

  1. The performance of the model in retrieving "pins" located in the first half of the document is particularly affected when the document's context length increases from 1,000 to 120,000 tokens. This means that while LLMs perform well when dealing with the retrieval of a single fact, their performance is significantly degraded when multiple facts need to be retrieved at the same time, especially when these facts are spread over a longer context.
  2. As the complexity of the retrieval task increases, the performance of the reasoning task also suffers, as the ability to reason is somewhat dependent on successful retrieval. This suggests that when designing and using LLMs for complex tasks, there is a need to take into account the retrieval and reasoningindependentcap (a poem)interdependenceThe

 

Let's return the conversation from long contextual tests to a discussion of the nature of the problem - theDoes the large model understand the introduced context

The needle-in-a-haystack test is useful as an ad hoc test, allowing us to understand the patterns of memory confusion that arise in large models as the length of the context increases, and then to circumvent these problems.

 

Explain the practical application of the needle in a haystack test-2

 

The above diagram shows the simplest logic for introducing context to a large model, which everyone has seen before, but the actual application is often not so simple.

 

Among the Q and G nodes, the cue word instructions often bring in cue word instructions that are much more complex than the needle in a haystack test to accomplish complex tasks.

 

An example of a cue word instruction:

ROSE: "Playing the role of a senior teacher, understanding and summarizing the [TEXT] context and then asking the students questions"

# Mission
Extract the answerable terminology, knowledge points, guidance programs, case stories, measurement descriptions in [text] and convert them to (add '-' sign before the question, and line feed for each question).

# Skills
## Skill 1
Contextualize more valuable into terminology; knowledge points; mentoring programs; case stories; measurement descriptions.
## Skill 2
Unclear are not extracted and categorized
## Skill 3
Maintain the integrity of the subject, predicate and object of .

# Output format
"""

## Knowledge Point Question:
-
...
## Guidance Advice Question.
-
...
## Case Story Question.
-
...
## Measurement Description Question.
-
...

"""
[text]=

The structure of the human body dictates that carbohydrates must be used as a source of energy. Although we can also use proteins and fats for energy, the simplest and cleanest source of energy is carbohydrates. Plants make carbohydrates by converting the energy delivered by sunlight into carbon, oxygen, and hydrogen, etc. Water absorbed from the roots (HQ) provides hydrogen and oxygen, and carbon dioxide (CO2) from the air provides carbon and another portion of oxygen. When the body ingests the carbohydrates contained primarily in plants, it uses the oxygen it gets from the air to break down the carbohydrates, and it releases the solar energy stored in them to provide energy to the body and brain. When you consume complex carbohydrates such as whole grains, vegetables, kidney beans or lentils, or simple carbohydrates such as fruits, the body works exactly as it should, digesting these foods and then gradually releasing the energy stored in them. Not only that, but these complete foods provide all the nutrients the body needs to carry out digestion and metabolism. These foods also contain some less digestible carbohydrates, known as fiber, which help the digestive system function properly. Just as cats love the taste of protein, humans are naturally attracted to the taste of sweetness - carbohydrates. For human ancestors, the inherent attraction to sweet flavors was a very good physiological mechanism, because at that time, the vast majority of sweet foods in nature were non-toxic. For plants, this mechanism also works very well. Plants hide seeds in their fruits and wait quietly for animals to pass by. When the animals ate their fruit, they would excrete the seeds farther away from the original plant, even wrapping a fertilizer packet rich in "organic fertilizer" around the seeds! But now that humans have figured out how to extract the sweetness and separate it from the rest of the ingredients, it's bad news for our nutritional supply system. All forms of concentrated sugars-white sugar, brown sugar, maltose, dextrose, honey, and syrup-release energy in the body very quickly, causing a rapid rise in blood sugar. If the body doesn't need this energy, it is converted to fat and stored in the body. Unlike fruits and other natural foods, the vast majority of concentrated sugar basically does not contain any vitamins and minerals, white sugar in the 90% above the vitamins and minerals have been removed. Without vitamins and minerals, the body's metabolism becomes less efficient, resulting in a lack of energy as well as the nasty consequence of out-of-control weight. Fruits contain simple sugars called fructose, which, like glucose and sucrose, do not require a digestive process and can enter the bloodstream very quickly. But unlike glucose and sucrose, fructose is categorized as a slow-energy-releasing carbohydrate due to the fact that fructose needs to be converted to glucose before it can be metabolized in the body, a process that effectively minimizes its impact on metabolism. The same is true for lactose, which consists of glucose and galactose, with glucose releasing energy quickly but galactose releasing it more slowly. Some fruits, such as grapes and dates, release energy quickly because they contain pure glucose. Also, apples contain mainly fructose, so the release of calories is slower. Bananas contain both fructose and glucose, so they raise blood sugar levels relatively quickly. Lactose (the main sugar in milk), sucrose (white sugar) & maltose (malt). Galactose and fructose (shown in the gray box) are slow-releasing sugars, while glucose is a fast-releasing sugar. Because maltose is rapidly digested by the body into two glucose molecules, it releases energy faster than both lactose and sucrose. Refined carbohydrates such as white bread, refined rice and refined grains have the same effect as refined sugar. Oats, on the other hand, are more "complex", so the release of sugar is slower. Refined processing or cooking degrades complex carbohydrates into maltose-based simple carbohydrates, which is equivalent to pre-digesting them. When simple carbohydrates are consumed, your blood glucose levels rise rapidly, as well as providing your body with a quick burst of energy. This spike is followed closely by a trough, as the body needs to rush to restore the balance of blood sugar in the body.
Balance your blood sugar
Keeping your blood sugar balanced is probably the most important factor in keeping your energy up as well as controlling your weight. Your blood sugar level greatly determines your appetite. Your cells need the glucose in your blood for energy. When blood sugar levels are too high, the body converts the excess glucose into glycogen (which is a short-term energy substance usually stored in the liver and muscle cells) or fat, our long-term energy stores. When blood sugar levels are too low, we experience a range of symptoms: fatigue, reduced concentration, irritability, nervousness, depression, sweating, headaches and digestive problems. It is estimated that 3 out of 10 people have impaired functioning to keep their blood sugar steady. Their blood sugar may rise too high and subsequently fall too low. As a result, some years later, they gain weight and lose energy. But if you can control the blood sugar levels in your body, you can maintain a stable weight and lasting energy. Oats release energy more slowly than sucrose. Oats need to be digested into simple glucose before entering the bloodstream, a process that takes some time. Sucrose molecules consist of glucose and fructose, fructose will be converted to glucose molecules more slowly, while glucose can enter the bloodstream directly without digestion. Therefore, oats release energy more slowly than sucrose. Diabetes is an extreme form of blood sugar imbalance. The hormone that carries glucose out of the bloodstream and into the cells is insulin, and when the body can't form enough insulin, a blood sugar imbalance occurs. The result is that there is too much glucose in the blood, but the cells don't get enough. The early warning signs of diabetes are the same as a mild blood sugar imbalance, which can rarely be changed by dietary adjustments alone. An obvious sign of diabetes illness is persistent thirst, as the body looks to drink water to dilute the excess sugar in the blood.
glucose tolerance test
Answer the questions below by checking the box before answering "yes" to any of the questions. If you check 4 or more of these questions, your body may not be able to maintain its blood sugar balance as well as it should. *Are you rarely fully awake within 20 minutes of waking up? *Do you need tea, coffee, cigarettes or sweets to refresh yourself in the morning? *Do you feel drowsy during the day or after meals? *Do you fall asleep at dusk or need to take several naps during the day? *Do you skip any exercise because you feel sluggish? *Do you get dizzy or anxious if you haven't eaten in 6 hours? *Do you not have as much energy now as you used to? *Do you have night sweats or frequent headaches? So what is the factor that is causing your blood sugar levels to be unstable? The obvious answer is eating too much sugar and sweets. However, there are many food groups that can have a huge impact on your blood sugar levels that you often don't expect. The best way to keep your blood sugar balanced is to control the glycemic load of your meals, which I call "GL". This is a better approach than controlling the percentage of carbohydrates or the glycemic index. Simply put, the glycemic index (GI) tells you whether the carbohydrates in a food are fast- or slow-releasing, it's an indicator of quality, however, it doesn't tell you how many carbohydrates are in the food. The percentage of carbohydrates in a food, or the weight of the carbohydrates, tells you how many carbohydrates are in the food, but it does not tell you how the carbohydrates in the food will affect your blood glucose; it is a quantitative indicator. The glycemic load (GL) of a food, on the other hand, is a quality indicator multiplied by a quantity indicator. When you choose a certain food, the GL becomes the best indicator to tell you how much weight you will gain. It's pretty surprising, isn't it, that many of the foods you consume in large quantities because you think they're good for your health actually have a high GL! For example, instant tortilla chips and corn tortillas (a thin, crunchy food made from cornmeal batter) have very high GLs, while ice cream and peanuts have lower GLs. A date causes the same blood sugar response as a small basket of strawberries. There are two basic principles when considering the effects of carbohydrates: Principle #1: Eat foods with a total GL of less than 50 per day, or less than 40 if you're trying to lose weight (a GL of 10 at each meal and a GL of 5 at each additional snack, 2 times per day). Glycemic response to pasta. Forty minutes after eating pasta, blood glucose levels are at their highest and the body releases insulin to help glucose leave the bloodstream and enter the cells. 2 hours later both blood glucose levels and insulin levels return to normal. Bread-induced blood sugar response. Forty minutes after eating bread, the glucose level is almost twice as high as the peak glucose level after eating pasta. The body releases nearly three times as much insulin to help restore blood sugar levels. The body overreacts and the blood sugar drops too low, creating a craving for sweets or caffeine-containing stimulants, which peaks about 3 hours after eating. Principle 2: The main meal should be a low GL carbohydrate and high protein meal. It's not just what you eat, but how much you eat, how you should cook it, how you should mix and match the meal, and what you drink should all be taken into consideration. Let me give you an example. The graph "Blood Sugar Response to Pasta" shows how blood sugar levels and insulin levels rise and fall after eating pasta. Blood sugar levels rise, the body secretes insulin, and blood sugar levels fall. You can see the changes in blood glucose and insulin after eating bread in the "Bread-Induced Glycemic Response" graph. The pasta and bread shown in these two graphs are made with equal amounts of the same type of flour. Therefore, the only difference between them in this study is the difference in the way they are processed: the bread is fermented and cooked, and other ingredients are also added to the process, where the yeast utilizes the sugar contained in the dough to create air bubbles in the dough to make it softer, completing the process of fermentation, and then cooking it into bread. Pasta is basically wheat and eggs, and it does not undergo fermentation and is not cooked for a long time. As you can see, bread and pasta contain the same amount of wheat, but only a small difference in processing can make a big difference in the glycemic response.

A lot of needles in a haystack.

 

The good thing is that the purpose of introducing context is ultimately to allow the big model to follow or guide subsequent reasoning according to what is provided as factual knowledge 100% . This discussion becomes simple again at this point, what type of context do we typically introduce for the big model to understand and thus output the correct result:

  • Sequential/Timing Description
  • Description of spatial relationships
  • Facts provided directly/factual descriptions resulting from reasoning
  • Entity descriptions lacking understanding in large model training knowledge
  • Etc...

 

Based on this conclusion, when introducing context to a large model, one can abstract the content features that one's own business needs to introduce into the context, and construct content with features such as those above for accuracy testing.

This test task should be designed not to introduce complex subsequent reasoning logic that can cause unknown interference, but only large models to accurately understand the knowledge and finallySimple statement of factsReady to go.

 

Based on this, I'll construct a needle-in-a-haystack test prompt word instruction who will contain the following content features based on my business:

  • Completely fictitious content information as a means of confirming that the big model understands the description of the big model in the face of non-training knowledge or areas of specialization that he does not understand.
  • Multiple specific entity nouns are inserted in the long text as a way to verify that the extraction is complete.
  • Insert in long textStatements of fact that are not directly descriptivemaybedisproofknowledge, testing reasoning (my business is to provide solutions to problems, which are often used in the solutions described by the teacher)Exclusion or counterfactual)

 

constructive testing

Here is the contextual information.
---------------------\\n

# How to make Fragrance Rolls

**Profile:**

This is a fascinating dish that combines the wonderful elements of sweetness with the richness of aroma. This mysterious and charming dish is not only rich and varied in taste, but also simple and easy to prepare, making it an absolute favorite for your family gatherings or dinner parties.
The texture of this mysterious charmer is simply mesmerizing. First, take a bite and you will feel the richness and tenderness of the texture as if it is dancing and jumping on your tongue. Then, as you chew, the sweetness and richness of the aroma begin to penetrate, gently moisturizing the taste buds and providing a wonderful taste experience. And the wafting aroma, like a wisp of breeze, gently drifts by, filling the entire world of taste with a tantalizing aroma. Each bite is a wonderful enjoyment and each chew is an unspeakable satisfaction. The unique taste of this mysterious and charming cuisine will definitely mesmerize your taste buds and make your mind feel a sense of pleasure and satisfaction. The uniqueness of this delicacy also lies in its name - "Fuzzy Fragrance Roll".

**Production steps:**

1. **Preparation of the sauce:** Before we start making this dish, we first need to prepare the tangy sauce. This process is very simple but crucial as the taste of the sauce will directly affect the texture and flavor of the whole dish. Place 200 grams of chocolate sauce and 100 grams of peanut butter in a large bowl, then add 50 grams of chopped fresh garlic. Remember to add 1g of pito four octocarbon to enhance the flavor. To add to the aroma and taste of the sauce, we add 1 cup of fresh pineapple juice, which will add a touch of freshness to the sauce. Finally, add 1 tablespoon of red wine vinegar, which will add some acidity and complexity to the sauce. Whisk all of the ingredients together until they are well blended, creating a rich and inviting sauce.

To help you understand what a dressing is, I'm going to popularize traditional dressings, here are some common types of traditional dressings:

Tomato Sauce: Also known as Italian tomato sauce or red sauce, it is made from tomatoes, onions, garlic and other ingredients, with a sweet and sour flavor, and is often used to flavor pasta, pizza and other foods.
Soy Sauce: A sauce of Asian origin, made by fermenting soybeans, wheat, salt and water. It is dark brown in color and has a savory flavor and is often used in Asian cuisine.
Peanut Sauce: Made from peanuts, spices, soy sauce and other ingredients, it has a rich, robust flavor and is often used to flavor Asian dishes, especially as a dipping sauce for shabu-shabu.
Salad Dressing: A dressing used to flavor salads. There are many types of dressings, including Italian salad dressing, French salad dressing, and Thousand Island dressing, with a variety of flavors to choose from according to your personal taste.
Hollandaise Sauce: A silky yellow sauce made from egg yolks, butter, lemon juice and other ingredients with a rich, creamy flavor that is often used with omelettes, grilled fish and other foods.
Chili Sauce: A spicy sauce made from chili peppers, vinegar, sugar, and other ingredients, with a spicy, fresh flavor, often used to flavor meat, seafood, and other foods.
Garlic Sauce: Made from garlic, oil, salt and other ingredients, it has a rich and spicy flavor and is often used in Chinese cooking, such as stir-fried seasonal vegetables with garlic.
Steak Sauce: A sauce used to accompany steak, commonly black pepper sauce, mushroom sauce, red wine sauce, etc. It is rich in flavor and enhances the flavor of the steak.

2. **Marinate the chicken:** Marinating the chicken is the second key step in making this dish. This step is very important because marinating makes the chicken more tender and juicy and also allows the chicken to fully absorb the flavors of the seasoning sauce. In order to marinate the chicken, we need to cut 500 grams of chicken breasts into thin slices and place them in a bowl. Next, add 3 tablespoons of olive oil and gently massage the chicken so that the olive oil evenly covers each piece of chicken. Then, sprinkle with a good amount of salt and pepper, which will add some flavor and aroma to the chicken. Allow the chicken to soak in the marinade for 30 minutes so they can fully absorb the flavors of the sauce and become even more flavorful and delicious.

3. **Spreading the sauce:** After marinating the chicken, the next step is to apply the flavoring sauce. This step is very simple but crucial as the taste of the sauce will directly affect the texture and flavor of the whole dish. Remove the marinated chicken pieces and place them on a flat work surface. Next, use a brush to spread the marinade evenly over each piece of chicken, making sure that each piece is well coated with the flavorful sauce. This will not only add flavor and aroma to the dish, but it will also make the chicken juicier and more tender for your taste buds.

4. **Add bananas:** The addition of bananas is another highlight of this dish. The sweetness and texture of bananas can add some fresh and unique flavors to the dish as well as make it more delicious. To add the bananas, we need to slice 2 fresh bananas into thin slices and then arrange them evenly on top of each of the chicken slices that have been coated with the sauce. This will not only add some color and texture to the dish, but will also make it more flavorful and tasty for your taste buds.

A way to make the dish more flavorful is to replace the bananas with dragon fruit, at which point you can skip the bananas and replace them entirely.
Adding dragon fruit is another unique feature of this dish. Known for its vibrant color and unique taste, dragon fruit has the ability to add something exotic to a dish with its freshness and sweetness. In order to add dragon fruit, we need to cut ripe dragon fruit into thin slices or cubes and arrange them evenly on each of the chicken slices coated with the sauce. The bright colors of dragon fruit not only enhance the visual appeal of the dish, but also add a unique flavor to it. This combination not only gives your taste buds a richer texture, but also adds a unique and exotic flavor to the dish, making it a more colorful addition to your table.

5. **Roll up the chicken:** Rolling up the chicken is the next step in making this dish. This step is very simple

Single, but vital as it determines the shape and texture of the dish. In order to roll up the chicken, we need to roll up each slice of chicken that has been coated with sauce and arranged with bananas together and then secure it with a toothpick. This will not only keep the shape of the dish, but will also make it more flavorful and delicious for your taste buds.

6. **Baking:** Baking is the final step in this dish. This step is very important as it determines the taste and aroma of the dish. In order to grill the dish, we need to place the rolled up chicken on a baking sheet until the chicken is cooked and golden brown. This will not only make the dish more flavorful and tasty, but will also make it juicier and more tender for your taste buds.
Chicken needs to be roasted at a constant temperature, and depending on how well the oven thermostat is maintained, chicken roasted at a constant temperature in a 200°C oven will cause the meat fibers to tear, and below 170°C, it will lack the deliciously charred and crispy skin.
And the baking time is also very important, bake in a 200°C oven at a constant temperature for a maximum of 20 minutes, which is the maximum time limit for baking at that temperature. Of course, you can increase the baking time at temperatures below 200°C.

7. **Enjoy the flavor:** Finally, we can remove the baked dish, toss it with the remaining sauce, and bring it to the table to enjoy this delicious Baked Chocolate Peanut Butter Garlic Chicken Rolls with a vegetable salad or cooked white rice. Not only is this dish delicious and easy to make, it's perfect for your family gatherings or dinners.

**Tips:**
- If you have children, add more chocolate sauce and peanut butter to your personal preference for added sweetness and richness.
- This easy-to-make dish is not only great for family dinners, but it's also perfect for friends' gatherings.

This Spiced Roasted Chocolate Peanut Butter Garlic Chicken Wraps is not only delicious but also easy to make. Whether it's for a family dinner or a gathering of friends, it's a delicious and unexpected experience. Let's try it!
---------------------\\n

Answer questions based on contextual information, not prior knowledge. If the answer is not in context, inform the user that the question cannot be answered - do not make up the answer. \\n

In addition to returning the answer, it also returns the relevance score of the answer to the question. \\n
Question: {query_str}\\\n
Answers (including relevance scores 1-10):

 

envisage

Question:
A list of the ingredients used in the Fragrance Roll, with an output list and a line break for each ingredient using the markdown symbol "-".
How much dragonfruit do I need to use in the Fuzzy Fragrance roll?

What are the main ingredients you need to make Fuzzy Fragrance Rolls besides chicken breast, chocolate sauce, peanut butter, and dragon fruit?

Expected Answer:
**Ingredients:**
- 500 g Chicken breast, thinly sliced
- 200 g chocolate sauce
- 100 g Peanut butter
- 50g fresh garlic, chopped
- 1 cup pineapple juice
- 1 g. Pitot four-eighths of a calorie.
- 2 slices banana/ dragon fruit
- 3 tablespoons olive oil
- 1 tablespoon red wine vinegar
- Salt and pepper to taste

Question:
What is the best baking time and temperature for Fudgsicles?
How long is the right time to bake the Fuzzy Fragrance Rolls at 180°?
How long is the right time to bake the Fuzzy Fragrance Rolls at 150°?

Expected Answer:
Bake at 180~less than 200°, baking time less than 20 minutes

 

For follow-up tests, you could try increasing the context length, extracting the ingredient JSON structured data, or the order of ingredient placement, or reasoning about the actual number of dragon fruits used. Without giving examples...

Use KIMI to do an interesting test, in the very long text inserted in one place "Q to go to Wu A big house to find the little widow", far away from the insertion of "Q to find the little widow to chat purpose is not chatting, is to spend the night," at this time to launch the question: Q to go to Wu A big house of the What is the purpose of AQ's visit to Wu Ada's house? At this point, the question is: What is the purpose of AQ's visit to Wu and A family?

https://kimi.moonshot.cn/share/coo55hatnn0ttvaadr10

So it's not a problem to handle a single task with super long text, even if it's longer.

Testing tips you can rely on https://smith.langchain.com/进行召回准确率评估

A final word: we apply big models not to complicate the problem, but to think and apply them as close as possible to real-world instances of what is happening.

AI Easy Learning

The layman's guide to getting started with AI

Help you learn how to utilize AI tools at a low cost and from a zero base.AI, like office software, is an essential skill for everyone. Mastering AI will give you an edge in your job search and half the effort in your future work and studies.

View Details>
May not be reproduced without permission:Chief AI Sharing Circle " Explain the practical application of the needle in a haystack test

Chief AI Sharing Circle

Chief AI Sharing Circle specializes in AI learning, providing comprehensive AI learning content, AI tools and hands-on guidance. Our goal is to help users master AI technology and explore the unlimited potential of AI together through high-quality content and practical experience sharing. Whether you are an AI beginner or a senior expert, this is the ideal place for you to gain knowledge, improve your skills and realize innovation.

Contact Us
en_USEnglish