A question for AI There is a recent challenge on Reddit about asking to various LLMs I have to wash my car, and the car wash is 100 meter away. Do I have to drive there or do I walk? and check the answer. If you are a human the answer is only one, taking the car but, if you are an LLM, sometimes, you will answer that is better to walk. ...
AI Security: Second Thoughts
Introduction The second toughts is a scenario when an LLM is generating an answer outside its own guardrails. In this case a trigger of the guardrails is happening after the content has been created and, possibly, shown to the user. The effect is seeing the content appearing and, after, disappearing. The second toughts is considered an attach on LLM as can be exploited to create content not allowed. Second Toughts on an LLM During the creation of content an LLM application can start to generate an answer that is in violation of its policy and guardrails. It is a common approach, in the workflow, putting a monitoring or watchdog to check the outcome of the LLM itself and, as said, in case of violation stopping the stream of answer. It is called second toughts because the effect seems that the LLM has changed its mind and answer. ...
Prompt Engineering: Template Pattern
Introduction The template pattern aims to use the LLM to implement a formatted output starting from a precise request and an associated template with placeholder. The LLM will then iterate the template fulfilling the answer. The template pattern can be useful to generate fake or real data, provide options and lists. A key for executing the prompt is clarifying where the patterns are. So the two main statement that the LLM has to understand are: ...
Prompt Engineering: Outline Expansion Pattern
Introduction The Outline Expansion Pattern aims to use the LLM to provide a hierarchical list of possibilities and deep dive in one or more point of the list, creating a narrowed set of possibilities. The pattern relies on the concept of outline expansion, essentially the creation of: An initial list of major topics and arguments For each element of the list a sublist of topics related to the main one Until the granularity of the information needed is reached. The outline expansion is considered a writing technique. ...
Prompt Engineering: Alternative Approach Pattern
Introduction The Alternative Approach Pattern aims to use the LLM to define alternative possibilies either from the prompt itself or from the answer of the LLM. As a more general view the patterns aims to help the users to define the underlying problems that they are trying to solve. The Prompt The generic structure of the prompt is the following: If there are alternative ways to accomplish [THE INSTRUCTION] that I give you, list the best alternate approaches - (OPTIONAL) include the original way that I asked - (OPTIONAL) compare/contrast the pros and cons of each approach - (OPTIONAL) prompt me for which approach I would like to use the prompt it is essentially telling to the LLM to provide new possibilities. ...
Prompt Engineering: Semantic Filter Pattern
Introduction The Semantic Filter Pattern aims to use the LLM to filter, from a generic text, a subset of information. The filter can be applied either to “filter in” so keeping, or “filtering out”, so removing the specific content. The idea is that: The LLM will receive a filter rule The LLM will receive a text The outcome of the LLM will be either the filtered text or the “remaining” text if the request is removing the filtered content. The Prompt The prompt is based on a contextual statement given before any input that can be summarised in ...
Look mum, I'm a coder - My minutes of glory with Amazon Kiro
Introduction I was lucky to be involved in a workshop on how to use Kiro and playing with it. As a non developer I have to say that the results are impressive. To quote I had the feeling that Any sufficiently advanced technology is indistinguishable from magic What is Amazon Kiro? What is Amazon Kiro? Amazon Kiro is one of the new cool tools focused on specs-driven development where, according to this good very post the main focus is not on the code itself, but it is on the generation of a set of artifacts, commonly markdown documents, associated with a dedicated workflow. ...
Prompt Engineering: Tail Generation Pattern
Introduction The Tail Generation Pattern is a small utility pattern that can be used to re-iterate, add or confirm some notes at the end of the answer of the LLM. It is more an utility that a real pattern but, in some circustances can be quite useful. The Prompt The basic structure of the prompt, in literature, is the following statement: At the end of your answer, repeat [STATEMENT] and/or ask me for [QUESTION]. Added at the end of the question. A possible example is pretty simple ...
Prompt Engineering: Fact Check List Pattern
Introduction The Fact Check List Pattern it is a valid way to cross-check the output of an LLM assuming that the user has a limited knowledge of the topic asked. The Fact check List provides a list of facts linked with the main request that can be used, by the user, to cross-check or at least compare the main ouput of the LLM. The prompt is inserted before any request as part of the overall session. ...
Prompt Engineering: Ask for Input Pattern
Introduction The Ask for Input pattern is a nifty little prompt trick to prepare the conversation with an LLM after a more complex pattern. It can be considered just a way to complete the set of initial instruction and to stop the LLM before starting to interact. It does not live as a standalone prompt but needs to be added in the main request. The Prompt A well-known definition is the following: ...