Nguyễn Tuấn Hiệp
0 followers · 819 views
on the atlas — 20
- What Nobody Tells You About RAGs | Towards Data Science2 savers
- Do Not Use LLM or Generative AI For These Use Cases | by Christopher Tao | Aug, 2024 | Towards AI1 savers
- 7 Things I Should’ve Learnt Much Earlier For Python Functions | by Liu Zuo Lin | Level Up Coding1 savers
- Write Killer Prompts: Master Prompt Engineering for Amazing AI Results | by Atef Ataya | AI Advances1 savers
- Document Parsing Using Large Language Models — With Code1 savers
- If I started learning AI Engineering in 2024, here’s what I would do.1 savers
- 17 Mindblowing Python Automation Scripts I Use Everyday1 savers
- How to Add ANY Model to Ollama1 savers
- LLM Instruction Placement in Prompts — It Matters a Lot! ⭐1 savers
- TextGrad: Controlling LLM Behavior Via Text1 savers
- Prompt Like a Data Scientist: Auto Prompt Optimization and Testing with DSPy | by Julian Yip | Towards Data Science1 savers
- Prompt Engineering Is Dead: DSPy Is New Paradigm For Prompting1 savers
- Model troubleshooting | dbt1 savers
- Hierarchical models in dbt | dbt1 savers
- Updating dbt models | dbt1 savers
- What is a dbt model? | dbt1 savers
- Working with a first project | dbt1 savers
- Creating a dbt project | dbt1 savers
- What is dbt? | dbt1 savers
- dbt Tutorial: 7 Must-Know Concepts For Data Engineers | DataCamp1 savers
highlights — 101
The next important tactic is avoiding negative words such as “not.” The word “not” can sometimes confuse LLMs, especially when the task itself is somewhat abstract (how do you define “boring”?).
Write Killer Prompts: Master Prompt Engineering for Amazing AI Results | by Atef Ataya | AI AdvancesReduce Vague and ambiguous descriptions to avoid Hallucinations
Write Killer Prompts: Master Prompt Engineering for Amazing AI Results | by Atef Ataya | AI AdvancesBe specific, descriptive, and as detailed as possible.
Write Killer Prompts: Master Prompt Engineering for Amazing AI Results | by Atef Ataya | AI AdvancesAlways put the instructions at the beginning of the prompt, each on its line. Use delimiters (***, +++, — -, ###, START, END, DELIMITER, INPUT, etc..). Indicate parts of the prompt, such as instructions and data. Ensure that the delimiters aren’t present within the content you’re processing.
Write Killer Prompts: Master Prompt Engineering for Amazing AI Results | by Atef Ataya | AI AdvancesWriting clear instructions with delimiters
Write Killer Prompts: Master Prompt Engineering for Amazing AI Results | by Atef Ataya | AI AdvancesPrinciples and guidelines In the article, we are going to talk about the following principles and guidelines: Writing clear instructions with delimiters Be specific, descriptive, and as detailed as possible about the outcome format or length Specify the response format Few-Shot Prompting Specify the steps required to complete a task Give the model time to “Think.” Reduce vague and ambiguous descriptions to avoid “Hallucinations.”
Write Killer Prompts: Master Prompt Engineering for Amazing AI Results | by Atef Ataya | AI Advancesprompt=''' Write a product review for the new Flip iPhone from APPLE Inc, Write only facts about this product according to sources such as Wikipedia, Google Scholar, Britannica or other reliable public sources. Avoid speculative or fictional content. If you don't find information in reliable sources, just respond with "I have no information about this." '''
Write Killer Prompts: Master Prompt Engineering for Amazing AI Results | by Atef Ataya | AI AdvancesPositive Influences: Begin by discussing potential benefits of social media, such as increased connectivity, access to information, and platforms for self-expression. [PAUSE 4 SECONDS]
Write Killer Prompts: Master Prompt Engineering for Amazing AI Results | by Atef Ataya | AI AdvancesGive Models Time to “Think”
Write Killer Prompts: Master Prompt Engineering for Amazing AI Results | by Atef Ataya | AI Advances2. Respond with HTML5 code to structure the following content blocks:
Write Killer Prompts: Master Prompt Engineering for Amazing AI Results | by Atef Ataya | AI AdvancesBefore responding, ensure that you have strictly followed the instructions outlined above (points 1 to 4).
Write Killer Prompts: Master Prompt Engineering for Amazing AI Results | by Atef Ataya | AI AdvancesAs we can derive from the graph above, there is a clear distinction between the two configurations. The immediate observation is shocking. Placing the instruction at the end of the prompt results in significantly better performance for large prompts compared to placing the instructions at the beginning. This seems true for prompts with at least 2000 characters and more. An additional observation is that for shorter prompts, specifically those with 1000 characters, positioning the instruction at the beginning of the prompt appears to enhance accuracy in this test.
LLM Instruction Placement in Prompts — It Matters a Lot! ⭐Two configurations of Gemini 1.5 were included, one where the instruction is placed at the start of the prompt (instr_first), and another where the instruction is placed at the end of the prompt (instr_last). Both configurations were tasked to extract the hidden information within the large context. The LLMs were evaluated using 100 distinct needle-in-the-haystack datasets for each unique context length. The average accuracy per context length was then calculated.
LLM Instruction Placement in Prompts — It Matters a Lot! ⭐“We observe that performance is often highest when relevant information occurs at the beginning or end of the input context, and significantly degrades when models must access relevant information in the middle of long contexts, even for explicitly long-context models.”
LLM Instruction Placement in Prompts — It Matters a Lot! ⭐The study investigates how well language models utilize long contexts for tasks such as question answering and information retrieval. Their findings were particularly interesting. They observed a U-shaped performance pattern — meaning the LLM remembers the beginning and the end of the prompt best while forgetting what was in the middle!
LLM Instruction Placement in Prompts — It Matters a Lot! ⭐Long Context Prompts 💡
LLM Instruction Placement in Prompts — It Matters a Lot! ⭐we will be using an Optimizer to compile our code which makes language model calls so that each module in our pipeline is optimized into a prompt that is automatically generated for us or a new fine-tuned set of weights for our language model that fits the task that we are trying to solve.
Prompt Engineering Is Dead: DSPy Is New Paradigm For PromptingOptimizer basically takes the entire pipeline and optimizes it on a certain metric and in the process automatically comes up with the best prompts, and even the weights of the Language model are updated in this process.
Prompt Engineering Is Dead: DSPy Is New Paradigm For PromptingParameters: To express a particular signature, any LLM call needs to specify: The specific LLM to call The prompt instructions The string prefix of each signature field The demonstrations used as few shot prompts and/or as fine-tuning data
Prompt Engineering Is Dead: DSPy Is New Paradigm For PromptingThis is where we use the signatures to build our modules, say, if we want to build a CoT module we use these signatures to build it. This automatically produces high-quality prompts, to achieve the behavior of certain prompting techniques. A more technical definition: A module is a parameterized layer that expresses a signature by abstracting a prompting technique. Types of Modules After it is declared, a module behaves like a callable function.
Prompt Engineering Is Dead: DSPy Is New Paradigm For PromptingDSPY infers the role of fields using: Their names, e.g. DSPy will use in-context learning to interpret questions differently from answers. Their traces (input/output examples)
Prompt Engineering Is Dead: DSPy Is New Paradigm For PromptingThese are simply the declarations of the behavior we want from our LLMs. This only defines what needs to be achieved not the specifications of how it would be achieved. A spec that tell DSPy what a transformation does, rather that how to prompt the LLM to do it. Example of Signatures Signature handles structured formatting and parsing logic. Signatures can be compiled into self-improving and pipeline-adaptive prompts or finetunes.
Prompt Engineering Is Dead: DSPy Is New Paradigm For PromptingAnother trick is manually reviewing the SQL output of the generated model.
Model troubleshooting | dbtThe next area to investigate are the dbt logs. The generic logs can be found in the logs directory under dbt.log. There is also a log file for each job called `run_results.json`. This log file contains various information about the tasks and can point out errors found during the run
Model troubleshooting | dbtThe first is using `dbt run` to try generating and creating the dbt objects. If there are errors in creating the models, you'll receive an error message and a suggestion of what to do, if available
Model troubleshooting | dbtTroubleshooting methods
Model troubleshooting | dbtThe default method is to query the tables simply as named, but a different backend may use something different. For example, using Google's BigQuery looks for a context name first, while Databricks will often reference tables with a preceding underscore. A typical problem is trying to reference objects in your queries that have not yet been generated.
Model troubleshooting | dbtLastly, common SQL logic issues can show up when creating dbt models. This includes forgetting to group by all non-aggregated columns as well as incorrectly formatting / referencing CTEs
Model troubleshooting | dbtThese include syntax-related issues such as misspellings, incorrectly ordering the query, or missing some necessary components. Another common problem is using non-standard SQL commands with a database that doesn't support it.
Model troubleshooting | dbtAnother common problem is invalid object references. This could be as simple as misspelling the table name, but it could also indicate trickier issues. Depending on how you reference your objects, you may see them named differently than you expect, causing errors.
Model troubleshooting | dbtsome common problems you may see when creating models in dbt. A widespread issue is errors in your queries that create the model. These can include syntax errors (a misspelled keyword or column) or logic errors (the SQL isn't doing what you initially expected.)
Model troubleshooting | dbtModel troubleshooting
Model troubleshooting | dbtpurpose of a DAG or hierarchy is it allows models to be built and updated with their dependencies in mind
Hierarchical models in dbt | dbtA hierarchy represents the dependencies between models, meaning the relationship between source and transformed data. This is also known as a DAG, or a directed acyclic graph. It's sometimes known as a lineage graph.
Hierarchical models in dbt | dbt. Hierarchical models in dbt
Hierarchical models in dbt | dbtOne interesting note is the file can actually be named anything as long as it exists somewhere in the models/ subdirectory and ends in a .yml extension. You can also have as many of these .yml files as needed.
Updating dbt models | dbtThe model_properties.yml file is specific to settings and details for model information. This can include description, documentation details, and much more
Updating dbt models | dbtThe dbt_project.yml file contains settings that relate to the full project. This can include things such as the project name and version, as well as directory locations. The materialization settings for a model can also reside here, though settings in this file are applied globally. These include defined whether models are created as tables / views / etc in the data warehouse. Note that there is one dbt_project.yml file per project.
Updating dbt models | dbtdbt_project.yml file or in a model_properties.yml file.
Updating dbt models | dbtto directly updating .sql files for dbt models
Updating dbt models | dbtFinally, if any updates have been made and verified to work, you'll want to check the changes back into source control to keep the process easy in the future.
Updating dbt models | dbtsimply running dbt run
Updating dbt models | dbtAfter updating the model or models, you'll need to apply these changes to the project.
Updating dbt models | dbtOnce you have the current project source, you'll want to find the appropriate model file in question and then update the query contents
Updating dbt models | dbtfirst step is to check out a dbt project from your source control system, such as git. An example would be git clone dbt_project, then opening the dbt_project folder
Updating dbt models | dbtworkflow to use when updating a dbt project
Updating dbt models | dbtcommon tools that work with Parquet are Apache Spark, Apache Arrow, and DuckDB.
What is a dbt model? | dbtParquet format. Parquet is a columnar, binary file format used by many tools to efficiently store data.
What is a dbt model? | dbttypically written in SQL
What is a dbt model? | dbtA model in dbt represents something more specific than a basic data model - it represents the various transformations performed on the raw source datasets.
What is a dbt model? | dbt