Why Feature Learning Matters for Prompt Engineering

Aug 24, 2023

Blog post title: "Why Feature Learning Matters for Prompt Engineering"
Blog post title: "Why Feature Learning Matters for Prompt Engineering"

Feature learning is the process of how AI models like ChatGPT, and Anthropic’s Claude, interpret concepts and relationships from data. By analyzing vast datasets, the artificial neural networks powering these models can identify patterns and features that allow them to generate useful outputs. Developing an awareness of feature learning is key because it underpins the capabilities of AI systems. 

And for prompting AI, understanding how models develop features based on their training data enables writing prompts which activate more relevant associations. Recall that ChatGPT and Claude use tokens and knowing this fact helps greatly for your prompt engineering to gain intended results - good output! 

As part of feature learning, most natural language AI models tokenize language, breaking text down into discrete units called tokens. Essentially, artificial neural networks power the models analysis of huge training datasets to automatically identify patterns and develop features without needing explicit human programming. The models identify patterns and develop the features based on the frequency and co-occurrence of these tokens in their training dataset. 

The training dataset refers to the large collection of text, dialogues, articles, books, etc. that the AI model analyzed during its development.

For example, a model may learn that certain words tend to co-occur frequently with positive sentiments, while others associate with negative sentiments. These word-sentiment relationships become learned semantic features that the model develops on its own by seeing many examples in contexts during training.

Other features can include associations between entities - like linking a country to its capital city, cause-and-effect relationships, and much more. The model stores these learned relationships between concepts in its neural network.

So, a model's learned feature associations are encoded in the relationships between tokens derived from its training dataset. By breaking down this training dataset into tokens and learning the statistical relationships between them, the model is able to develop connections between concepts that inform its feature learning. 

To improve your prompt engineering, what you instruct the AI to write, do, produce...You do NOT need to know exactly the patterns or tokens used, but rather think about what is likely to happen. 

Overall, the tokenization process is key to how models ingest and learn from language data. And when you get this fact you will write better prompts.

Why Feature Learning Matters for Prompt Engineering

Developing an awareness of a model's learned features enables deliberately structuring prompts to activate relevant associations and shape the AI's reasoning down intended paths. Rather than treating models as black boxes, feature learning reveals vital insights into how they interpret concepts that prompt engineers can actively leverage. 

For example, if we know a model associates certain tokens with positive or negative sentiment, prompts can be constructed to trigger those associations. Or if we understand which entities a model links, prompts can build on those relationships. 

Take Fraud Detection - If a generative model has developed robust features for identifying fraud signals like usage patterns, data anomalies, suspicious account behaviors, etc. based on fraud-related data, prompts can be constructed to trigger these learned fraud associations. Prompts focused on activating the model's fraud detection features, for example asking about anomalous transactions or risky users, will stimulate output drawing directly on the model's existing feature learnings in this domain.

Overall, understanding feature learning is key for prompt engineering because it moves AI interactions from blind trial-and-error to informed, intentional guidance. And it sets the stage for more advanced techniques like few-shot prompting and fine-tuning.


Rules for Leveraging Feature Learning in Prompts

There are some key principles for effectively harnessing a model's feature learnings when crafting prompts:


Focus on activating relevant features - Prompts should seek to trigger associations between tokens or concepts the model has already established through its training. This builds on existing feature foundations rather than trying to create new connections. For example, if the model has learned an to the concept of a Sales Director based on patterns in its training data, a prompt could leverage that feature by asking:


"As a Sales Director, how should I approach pricing high-value enterprise deals?"

This prompts the model to tap into its learned connection about Sales Directors to generate relevant advice tailored to that role.

Build on existing features over introducing new ones - This is commonly called Context in prompt engineering. When possible, prompts should rely on and combine learned features the model already has over trying to teach new associations within the prompt itself. This helps prompts feel coherent to the AI.

The context in prompt engineering refers to the background information and subject matter relevant to the task. It may include details about the topic, genre, tone, target audience, or any specific constraints or guidelines.Here is an example of a problematic prompt that goes against the principle of building on existing learned features:


"John is an account manager at the fictional company Acme Corporation. Acme Corporation is headquartered in Los Angeles and specializes in software services with a focus on cloud computing. The company was founded in 2015 by CEO Jane Smith. Recently, the sales at Acme Corporation are struggling. Provide advice for John, the account manager, on how Acme Corporation can improve sales."


This prompt introduces many new names, companies, and relationships that likely have no learned foundation within the model. It does not leverage any existing feature associations the model is likely to have. This lack of tapping into learned connections makes the prompt feel complex rather than building on what the AI already knows. 


When you are not sure what the model has been trained on it can help to have shorter and more general prompts. Improving the prompt from above could like this:


"John is an account manager at a software company. The company has been struggling with sales. Provide advice for John on how he can improve sales in his role."


Note how the prompt - 

  • Removes fictional new company names and details

  • Relies on learned association between "John" and account manager

  • Uses general "software company" based on broad industry knowledge

  • Focuses prompt on sales advice request leveraging John's role

By stripping away the specific imaginary details and more simply activating the account manager-sales advice features, the prompt becomes more coherent and effective. 

(Note: longer prompts do work, but to do this you should introduce information to the model earlier. Remember, the models need to understand the data and information for it to be able to best answer you. You need to provide as much context as possible)


Align with underlying model architecture - Prompts optimized for certain models balance brevity for smaller ones like LLaMa 2 with 7B parameters vs verbosity for huge models like GPT4. Prompt length and complexity should fit the system. Using the SCRIBE method - Specify, Contextualize, Responsibility, Interpret, Banter, Evaluate - greatly helps you write prompts that get you quality output, and can simple or complex depending on the model you choose.

Holding to the principles of activating relevant learned features, along with minimizing new associations versus the context the model understands or has, results in prompts that flow well with the model's strengths. 

Understanding how models like ChatGPT learn features by analyzing data reveals insights into their reasoning, and this enables us to craft optimized prompts. Rather than treating generative AI as opaque & impenetrable systems, prompt engineers should leverage models' existing knowledge. Make sure you focus on activating relevant learned associations and building on embedded relationships likely to be in the AI’s training models.

And remember - continuous iteration remains key to effective prompt engineering. You must work to ground prompts in feature learning and write with informed starting points versus trial-and-error. 

Takeaways

  • Feature learning reveals how AI models interpret concepts based on their training data. Understanding this enables crafting better prompts.

  • Prompts should activate relevant learned features and associations rather than introducing many new relationships. If you do introduce new relationships or information be sure you have explained them in depth so the model can utilize them effectively.

  • Build prompts on the model's existing knowledge by relying on embedded features over teaching new connections.

  • Align prompts with model architecture - shorter sentences for small models, more detail for large models.

  • Leverage feature learning, but refine prompts through continuous experimentation and iteration based on outputs.


TLDR

This article explains how AI models like ChatGPT learn conceptual relationships from data through a process called feature learning. Understanding this enables writing better prompts by activating relevant learned features that the AI training model contained vs introducing new associations. Prompts should build on models' existing knowledge and align with their architectures. Iterating prompts based on outputs from the AI will always be critical. This is best done when you leverage feature learning from an informed starting point (knowing aspects of the feature learning) over trial-and-error. This guide equips prompt engineers to optimize prompts by harnessing models' embedded knowledge.





Feature learning is the process of how AI models like ChatGPT, and Anthropic’s Claude, interpret concepts and relationships from data. By analyzing vast datasets, the artificial neural networks powering these models can identify patterns and features that allow them to generate useful outputs. Developing an awareness of feature learning is key because it underpins the capabilities of AI systems. 

And for prompting AI, understanding how models develop features based on their training data enables writing prompts which activate more relevant associations. Recall that ChatGPT and Claude use tokens and knowing this fact helps greatly for your prompt engineering to gain intended results - good output! 

As part of feature learning, most natural language AI models tokenize language, breaking text down into discrete units called tokens. Essentially, artificial neural networks power the models analysis of huge training datasets to automatically identify patterns and develop features without needing explicit human programming. The models identify patterns and develop the features based on the frequency and co-occurrence of these tokens in their training dataset. 

The training dataset refers to the large collection of text, dialogues, articles, books, etc. that the AI model analyzed during its development.

For example, a model may learn that certain words tend to co-occur frequently with positive sentiments, while others associate with negative sentiments. These word-sentiment relationships become learned semantic features that the model develops on its own by seeing many examples in contexts during training.

Other features can include associations between entities - like linking a country to its capital city, cause-and-effect relationships, and much more. The model stores these learned relationships between concepts in its neural network.

So, a model's learned feature associations are encoded in the relationships between tokens derived from its training dataset. By breaking down this training dataset into tokens and learning the statistical relationships between them, the model is able to develop connections between concepts that inform its feature learning. 

To improve your prompt engineering, what you instruct the AI to write, do, produce...You do NOT need to know exactly the patterns or tokens used, but rather think about what is likely to happen. 

Overall, the tokenization process is key to how models ingest and learn from language data. And when you get this fact you will write better prompts.

Why Feature Learning Matters for Prompt Engineering

Developing an awareness of a model's learned features enables deliberately structuring prompts to activate relevant associations and shape the AI's reasoning down intended paths. Rather than treating models as black boxes, feature learning reveals vital insights into how they interpret concepts that prompt engineers can actively leverage. 

For example, if we know a model associates certain tokens with positive or negative sentiment, prompts can be constructed to trigger those associations. Or if we understand which entities a model links, prompts can build on those relationships. 

Take Fraud Detection - If a generative model has developed robust features for identifying fraud signals like usage patterns, data anomalies, suspicious account behaviors, etc. based on fraud-related data, prompts can be constructed to trigger these learned fraud associations. Prompts focused on activating the model's fraud detection features, for example asking about anomalous transactions or risky users, will stimulate output drawing directly on the model's existing feature learnings in this domain.

Overall, understanding feature learning is key for prompt engineering because it moves AI interactions from blind trial-and-error to informed, intentional guidance. And it sets the stage for more advanced techniques like few-shot prompting and fine-tuning.


Rules for Leveraging Feature Learning in Prompts

There are some key principles for effectively harnessing a model's feature learnings when crafting prompts:


Focus on activating relevant features - Prompts should seek to trigger associations between tokens or concepts the model has already established through its training. This builds on existing feature foundations rather than trying to create new connections. For example, if the model has learned an to the concept of a Sales Director based on patterns in its training data, a prompt could leverage that feature by asking:


"As a Sales Director, how should I approach pricing high-value enterprise deals?"

This prompts the model to tap into its learned connection about Sales Directors to generate relevant advice tailored to that role.

Build on existing features over introducing new ones - This is commonly called Context in prompt engineering. When possible, prompts should rely on and combine learned features the model already has over trying to teach new associations within the prompt itself. This helps prompts feel coherent to the AI.

The context in prompt engineering refers to the background information and subject matter relevant to the task. It may include details about the topic, genre, tone, target audience, or any specific constraints or guidelines.Here is an example of a problematic prompt that goes against the principle of building on existing learned features:


"John is an account manager at the fictional company Acme Corporation. Acme Corporation is headquartered in Los Angeles and specializes in software services with a focus on cloud computing. The company was founded in 2015 by CEO Jane Smith. Recently, the sales at Acme Corporation are struggling. Provide advice for John, the account manager, on how Acme Corporation can improve sales."


This prompt introduces many new names, companies, and relationships that likely have no learned foundation within the model. It does not leverage any existing feature associations the model is likely to have. This lack of tapping into learned connections makes the prompt feel complex rather than building on what the AI already knows. 


When you are not sure what the model has been trained on it can help to have shorter and more general prompts. Improving the prompt from above could like this:


"John is an account manager at a software company. The company has been struggling with sales. Provide advice for John on how he can improve sales in his role."


Note how the prompt - 

  • Removes fictional new company names and details

  • Relies on learned association between "John" and account manager

  • Uses general "software company" based on broad industry knowledge

  • Focuses prompt on sales advice request leveraging John's role

By stripping away the specific imaginary details and more simply activating the account manager-sales advice features, the prompt becomes more coherent and effective. 

(Note: longer prompts do work, but to do this you should introduce information to the model earlier. Remember, the models need to understand the data and information for it to be able to best answer you. You need to provide as much context as possible)


Align with underlying model architecture - Prompts optimized for certain models balance brevity for smaller ones like LLaMa 2 with 7B parameters vs verbosity for huge models like GPT4. Prompt length and complexity should fit the system. Using the SCRIBE method - Specify, Contextualize, Responsibility, Interpret, Banter, Evaluate - greatly helps you write prompts that get you quality output, and can simple or complex depending on the model you choose.

Holding to the principles of activating relevant learned features, along with minimizing new associations versus the context the model understands or has, results in prompts that flow well with the model's strengths. 

Understanding how models like ChatGPT learn features by analyzing data reveals insights into their reasoning, and this enables us to craft optimized prompts. Rather than treating generative AI as opaque & impenetrable systems, prompt engineers should leverage models' existing knowledge. Make sure you focus on activating relevant learned associations and building on embedded relationships likely to be in the AI’s training models.

And remember - continuous iteration remains key to effective prompt engineering. You must work to ground prompts in feature learning and write with informed starting points versus trial-and-error. 

Takeaways

  • Feature learning reveals how AI models interpret concepts based on their training data. Understanding this enables crafting better prompts.

  • Prompts should activate relevant learned features and associations rather than introducing many new relationships. If you do introduce new relationships or information be sure you have explained them in depth so the model can utilize them effectively.

  • Build prompts on the model's existing knowledge by relying on embedded features over teaching new connections.

  • Align prompts with model architecture - shorter sentences for small models, more detail for large models.

  • Leverage feature learning, but refine prompts through continuous experimentation and iteration based on outputs.


TLDR

This article explains how AI models like ChatGPT learn conceptual relationships from data through a process called feature learning. Understanding this enables writing better prompts by activating relevant learned features that the AI training model contained vs introducing new associations. Prompts should build on models' existing knowledge and align with their architectures. Iterating prompts based on outputs from the AI will always be critical. This is best done when you leverage feature learning from an informed starting point (knowing aspects of the feature learning) over trial-and-error. This guide equips prompt engineers to optimize prompts by harnessing models' embedded knowledge.





Lastest blog posts

Lastest blog posts

Lastest blog posts