Wednesday, April 10, 2024

Prompt Engineering for ChatGPT

Power of Generative AI models

Output produced by Generative AI models closely resembles that of humans. 

- Relevant
- Contextual
- Imaginitive
- Nuanced
- Linguistically Accurate



There are 3 modules in this course
  1. Module 1: 
    1. Concept of prompt engineering: how to define a prompt and its elements.
    2. Best practicers for effective prompts
    3. Common prompt engineering tools
      1. IBM Watsonx, Prompt Lab, Spellbook, Dust
  2. Module 2: 
    1. Prompt engineering approaches:
      1. Interview pattern
      2. Chain of thoughts
      3. Tree of thoughts
    2. Techniques for skillfully crafting prompts
      1. Zero shot
      2. Few shot
    3. Precise and relevant responses.
  3. Module 3: 
    1. Final project
    2. Graded quiz
1. What is a prompt?

A prompt is an "instruction" you provide to the Generative AI model. It is an input that produces a desired output. Example, write a small paragraph describing your favorite holiday destination. Another one is Write HTML code to generate dropdown selection of cities within an online form. 

Prompts can also be a series of instructions that refine an output step by step to acheive a desired results. 

Example:

> Write a short story about a scientist studying life in Mars. 
> What were some of the challenges he faced during the research?

Gen AI then,






Building blocks of a well-constructed prompt:

Prompts contain questions, contextual texts, guiding patterns or examples and partial examples for the model.  


Instructions: Give distinct guidelines regarding the task you wish to execute. 

Example:

Write an essay in 600 words analyzing the effects of global warming on marine life.

Context: Provides a framework for generating relevant content.

Example

In the recent decades, global warming has undergone significant shifts, leading to rising sea levels, increased storm intensity, and changin weather patterns. These changes have had a severe impact on marine life. Write an essay in 600 words analyzing the effects of global warming on marine life.

Input Data: Any piece of information provided as a part of prompt. This can be used by the Generative AI model to obtain specefic data. 

Example

You have been provided with a data set containing temperature records and measurements of sea levels in the Pacific Ocean. Write an essay in 600 words analyzing the effects global warming on marine life in the Pacific Ocean.

Output Indicator: Offers benchmarks for assessing attributes of the output. (Tone, length, quality of output)

Example 

The output generated should be an essay of 600 words. It will be evaluated based on the clarity of analysis and incorporation of relevant data or case studies.

2. Prompt Engineering

The process of designing effective prompts to generate better and desired responses is called prompt engineering.

Prompt Engineering is a blend of:
  • Critical Analysis
  • Creativity
  • Technical Acumen
It includes framing the question in the right context with the right information and your expectation of desired outcomes to elicit the most appropriate response.

Example

The captain of a ship is planning a strategic voyage in the Atlantic Ocean. To help the captain navigate effectively, provide weather forecasts for the upcoming week from 28th August 2023 to 1st September 2023. The coordinates of the target location are between 20 degrees north and 30 degrees north latitude and 40 degrees west and 20 degrees west longitude

To help plan an effective navigation in the Atlantic Ocean, provide detailed information about expected wind patterns, wave heights, precipitation probabilities, cloud cover, and any potential storms that might affect the voyage during a specified time frame and location

Process involved in prompte engineering


Define the Goal


Craft Initial Prompt


Test the Prompt


Analyze the Prompt



Refine the Prompt

Specificity, providing additional context, or rephrasing.


Iterate the process

Last 3 of the above steps are repeated until results are satisfactory. 


Benefits of prompt engineering
  • Optimizes model efficiency
    • Prompt engineering helps design intelligent prompts that allow the users to harness the full capabilities of these models without requiring extensive retraining. 
  • Boosting performance for specific tasks.
    • Prompt engineering empowers generative AI models to deliver responses that are nuanced and have a context, rendering them more effective for specific tasks.
  • Understanding model constraints
    • Refining prompts through each iteration and studying the corresponding responses of the model can help us understand its strengths and weaknesses. Helps in enhancing future development of the models. 
  • Enhancing model security:
    • Skilled prompt engineering can prevent issues of harmful content generation due to poorly designed prompts, thereby enhancing safe utilization of the model.
EXERCISES

Before doing the exercises let us learn some basics.

LLMs

Large language models (LLMs), like ChatGPT, are advanced artificial intelligence systems capable of understanding and generating human-like text. These models are trained on vast amounts of text data, learning the patterns, structures, and nuances of human language. They can perform various language-related tasks such as text generation, language translation, summarization, question answering, and more. The "large" in "large language models" refers to the vast size of the neural networks that power these models, typically containing hundreds of millions to billions of parameters.

Neural Network

A neural network is a computational model inspired by the structure and functioning of the human brain's interconnected network of neurons. It consists of layers of interconnected nodes, known as neurons or units. Each neuron receives input signals, processes them using weighted connections, and produces an output signal.



LLMs are pretrained on vast amounts of data to generate novel content, texts, images, and video. 

Example with Prompt Instructions fed to drive the output in a specific format.



Adding Context-specifics to prompt to influence the output

Tell me about the relevance of generative AI in the content marketing sector


make it listed


Make it listed, and then go on to explain each listed item in detail


start with simple list followed by expanding on each list


Prompts in different formats

Prompts can be presented in different formats, such as questions, statements, or instructions. Let's experiment with how prompts in different formats can yield different results.
  • What are the benefits of water reservoir?
  • Discuss the advantages of water reservoirs.
  • List the top five benefits of water reservoirs.
Limit the output length
  • Create an announcement for starting a new job at ABCTech company as a lead data scientist in a tweet-length message.
Writing effective prompts - best practices
  • Supervise the style, tone and content of the output generated.
    • Clarity: includes using simple and concise language.
      • User clear and concise language.
      • Avoid jaron, specialized terminology or complex terms.
      • Provide explicit instructions.


    • Context: provides background and required details.
      • Establish the context
      • Include relevant information.


    • Precision: means being specific and providing examples.
      • Be specific
      • Use examples

    • Role play / persona pattern: role play enhances responses by assuming a persona and offering relevant context.
      • Assume a persona
      • Provide a context for role play


LAB

Naive prompting and persona pattern

> What is the best way to get fit.

Now the same approach using persona.

> Acting as a fitness expert, tell me the best way to get fit.

You will act as a fitness expert who is current with the latest research data and provide very detailed step-by-step instructions in reply to my queries.

You'll see that we structured this in three parts:

We told the LLM the persona it should act as;
We specified a qualifier about being research-based;
We told the AI the response format we wanted.

Now the actual query is:

  1. Create a gym workout program to lose weight and build strength for an out-of-shape beginner.
Output will look like below:

For an out-of-shape beginner looking to lose weight and build strength, here is a sample gym workout program that combines cardiovascular exercise, strength training, and flexibility work:

1. Warm-up (5-10 minutes):
- Start with a light cardio warm-up such as brisk walking on the treadmill or cycling.
- Follow with dynamic stretches to prepare your muscles for the workout ahead.

2. Cardiovascular Exercise (20-30 minutes):
- Choose a cardio machine such as the treadmill, elliptical, or stationary bike.
- Aim for a moderate intensity level where you can still hold a conversation but are slightly out of breath.
- Alternate between periods of higher intensity (1-2 minutes) and lower intensity (1-2 minutes) to increase calorie burn and cardiovascular fitness.

3. Strength Training (30-45 minutes):
- Perform compound exercises that target multiple muscle groups at once, such as squats, deadlifts, bench presses, and rows.
- Start with 2-3 sets of 10-12 repetitions for each exercise, using lighter weights to focus on form and technique.
- Gradually increase the weight as you get stronger and more comfortable with the movements.
- Include exercises for all major muscle groups, including legs, back, chest, shoulders, arms, and core.

4. Flexibility Work (10-15 minutes):
- Finish your workout with static stretches to improve flexibility and prevent injury.
- Focus on stretching all major muscle groups, holding each stretch for 15-30 seconds.
- Incorporate yoga poses or foam rolling to release tension and improve range of motion.

5. Cool Down and Hydration:
- End your workout with a light cardio cool down and more static stretches.
- Remember to hydrate throughout your workout and after to replenish fluids lost through sweat.

This sample gym workout program can be done 3-4 times per week, with rest days in between to allow your muscles to recover. It's important to listen to your body, start at a pace that feels comfortable, and gradually progress as you get stronger and more fit. Consult with a fitness professional or personal trainer to tailor the program to your individual needs and goals.

When the persona is someone famous

Naive prompt: Give me a list of 10 article titles to promote my new book about dog training

Now with a famous persona

Acting as marketing expert Seth Godin, give me a list of 10 article titles to promote my new book about dog training.

Common Prompt engineering tools

Prompt engineering tools provide features and functionalites to optmize prompts. 

Functionalities
  • Suggestions for prompts
  • Contextual understanding
  • Iterative refinement
  • Bias mitigation
  • Domain specific aid
  • Libraries of predefined prompts







Text to text Prompt techniques

- Explicitly specify objective of LLM.
- Provide context
- Domain expertise - use domain specific terminology when needed - law, engineering, medicine.
- Bias mitigation - provide explicit instructions to generate neutral responses if you see any bias in responses.
- Framing - limit the word length or scope out the subject matter to ensure relevance.
Zero shot prompting - a method wherein model can generate meaningful responses to prompts without prior training. Example Select the adjective in this sentence. Anita bakes the best cakes in the neighbourhood - output is Best.
- User feedback loop - keep on looping until the output is close to your need.

Explainability

Is how well a user can understand and interpret the model's decision making process and the reasons behind the generated output. Explainability helps users, developers and stakeholders understand how the model works.

Explainability helps users, developers, and stakeholders understand how the model works. Why it makes certain predictions or generates specific text. And whether it can be trusted in various applications. Explainability is crucial to addressing ethical concerns related to AI. It helps all stakeholders evaluate and ensure the LLM's behavior is consistent with the specific domain's ethical guidelines and legal requirements.

Interview pattern approach

Involves designing prompts by simulating a conversation or interacting in the interview style. 




Chain of thought approach

The Chain-of-Thought (CoT) methodology significantly bolsters the cognitive performance of AI models by segmenting complex tasks into more manageable steps. By adopting this prompting strategy, AI models can demonstrate heightened cognitive abilities and offer a deeper understanding of their reasoning processes.

Constructing series of prompts or questions to guide model to generate desired response.

It involves breaking down a complex task into smaller and easier ones through a sequence of more straightforward prompts, with each prompt building upon the previous one to guide the models toward the intended outcome. Before posing a question directly to the model, you feed it with related questions along with their corresponding solutions. This chain-of-prompts helps the model think about the problem and use the same strategy to answer more such questions correctly. In simpler words, the prompt includes a question and an accurate answer to the question to provide the required context and step-by-step reasoning for the model, then it poses a different question to be answered using the same line of reasoning. 


Tree of Thought approach (ToT)

At its core, Chain-of-Thought prompting solicits a step-by-step thinking process from the LLM. Compared to the naive/standard/Input-Output prompting, we get far better results with it.


  • ToT is built to expand the capabilities of Chain of Thought. 
  • Involves hirarchically structuring a prompt or query akin to a tree structure. 
  • Enables Generative AI models to demonstrate advanced reasoning capabilities. 
  • This approach is particularly useful when you want to provide explicit instructions or constraints to the model to ensure it generates the desired output.
  • It involves generating multiple lines of thought resembling a decision tree to explore different possibilities and ideas. Unlike traditional linear approaches, this technique allows the model to evaluate and pursue multiple paths simultaneously. Each thought or idea branches out, creating a treelike structure of interconnected thoughts. The model proceeds by assessing every possible route, assigning numerical values according to its predictions of outcomes. And eliminating lesser promising lines of thought, ultimately pinpointing the most favorable choices.
- Generate multiple lines of thought resembling a decision tree to explore different possibilities and ideas.
- Each thought or idea branches out, creating a treelike structure of interconnected thoughts. 
- The model proceeds by assessing every possible route, assigning numerical values according to its predictions of outcomes. And eliminating lesser promising lines of thought, ultimately pinpointing the most favorable choices.



Example

Act as a human resource specialist design a recruitment and retention strategy for an e-commerce business, focusing on attracting and retaining skilled remote employees. Building such prompt instruction will allow the generative AI model to consider a step-by-step process and think logically. It will also make it consider intermediate thoughts, building upon them, and exploring branches that may or may not lead somewhere. This practice will maximize the use and capabilities of the model, rendering more useful results.

Exercise that shows GPT3.5 inadequacies

Dave Hulbert suggested a few rather convincing prompts that leverage this approach and yield, anedotically, great results. I particularly like how he incorporates the Persona pattern and recommend you approach ToT prompting using his prompts or similar variations you might develop yourself.

Bob is in the living room.
He walks to the kitchen, carrying a cup.
He puts a ball in the cup and carries the cup to the bedroom.
He turns the cup upside down, then walks to the garden.
He puts the cup down in the garden, then walks to the garage.
Where is the ball?

My output

The ball is in the garden. In the scenario you described, Bob put the ball in the cup in the kitchen, then carried the cup to the bedroom and turned it upside down, so the ball would have fallen out. Therefore, the ball is in the garden where Bob left the cup.


I set up this context

Imagine three different experts are answering this question. 
All experts will write down 1 step of their thinking, then share it 
with the group. Then all experts will go on to the next step, etc. 
If any expert realises they're wrong at any point then they leave. The question is...

and then prompted the question. Output was a below:

The ball is in the living room because Bob put the ball in the cup in the kitchen and then carried the cup to the bedroom without taking the ball out.


Then used the tree method

Simulate three brilliant, logical experts collaboratively answering a question. Each one verbosely explains their thought process in real-time, considering the prior explanations of others and openly acknowledging mistakes. At each step, whenever possible, each expert refines and builds upon the thoughts of others, acknowledging their contributions. They continue until there is a definitive answer to the question. For clarity, your entire response should be in a markdown table. The question is...

| Step | Expert 1 | Expert 2 | Expert 3 | |------|----------|----------|----------| | 1 | Bob is in the living room. | Bob is in the living room. | Bob is in the living room. | | 2 | Bob walks to the kitchen, carrying a cup. | Bob walks to the kitchen, carrying a cup. | Bob walks to the kitchen, carrying a cup. | | 3 | Bob puts a ball in the cup and carries the cup to the bedroom. | Bob puts a ball in the cup and carries the cup to the bedroom. | Bob puts a ball in the cup and carries the cup to the bedroom. | | 4 | Bob turns the cup upside down in the bedroom. | Bob turns the cup upside down in the bedroom. | Bob turns the cup upside down in the bedroom. | | 5 | Bob walks to the garden and puts the cup down. | Bob walks to the garden and puts the cup down. | Bob walks to the garden and puts the cup down. | | 6 | Bob walks to the garage. | Bob walks to the garage. | Bob walks to the garage. | | 7 | **Where is the ball?** | **Where is the ball?** | **Where is the ball?** | Expert 1: The ball is in the cup in the bedroom. Expert 2: The ball is in the cup in the bedroom. Expert 3: The ball is in the cup in the bedroom. | Step | Expert 1 | Expert 2 | Expert 3 | |------|----------|----------|----------| | 1 | 5 | 5 | 5 | | 2 | 5 | 5 | 5 | | 3 | 5 | 5 | 5 | | 4 | 5 | 5 | 5 | | 5 | 5 | 5 | 5 | | 6 | 5 | 5 | 5 | The consensus solution is that the ball is in the cup in the bedroom.

The same prompt when it was given to LLAMA 3 (80GB), response was below.

A classic lateral thinking puzzle!

Let's break it down step by step:

1. Bob starts in the living room.
2. He walks to the kitchen, carrying a cup.
3. In the kitchen, he puts a ball in the cup and carries the cup to the bedroom.
4. Then, he turns the cup upside down (which means the ball would fall out).
5. After that, he walks to the garden and puts the cup down there.

Now, let's think about what happens to the ball:

* When Bob puts it in the cup in the kitchen, the ball is inside the cup.
* When he turns the cup upside down in the bedroom, the ball would fall out of the cup. So, at this point, the ball is on the floor or bed, but we don't know exactly where.
* Finally, Bob leaves the cup (with no ball) in the garden.

So, where is the ball? Ah-ha! The answer is... it's still in the bedroom, on the floor or bed, after Bob turned the cup upside down and the ball fell out!

Text to Image Prompt Techniquees using Stable Diffusion

An image prompt is a text descritpion of an image you want to generate. 

Style Modifiers: are descriptors used to influence the artistic style or visual attributes of images.
- You can include Visual Elements: colour, contrast, texture, shape, size.
- You can include:
    > Art styles
    > Historical periods of art
    > Photography techniques
    > Types of art materials
    > Traits of well known brands or artists

 Examples:

A man running through the park, charming, cozy water colour illustration on a grey background. 
A big, fat cow admist an ancient marketplace, (medieval manuscript drawing)
A dreamy, surreal landscape, pastel colours, with high contrast

Quality booster: are terms used to enhance the visual appeal

- Avoid blurriness and pixelation which leads to low quality images
- Noise reduction, sharpening, colour correction, resolution enhancement
- Use terms like:
    High Resolution
    2k, 4k, hyperdetailed
    sharp focus
    complementary colours

Examples

- Generate close-up image that highlights the texture of tree bark with 4k resolution
- Create a human portrait with sharp, crisp details and fine lines
- Create an image of a tall, gigantic fort with complementary colours and a blurred background for the subject to stand out.

Repetition: leverages the power of iterative sampling to enhance image diversity. 

Repetition involves emphasizing a particular visual element within an image to create a sense of familiarity for the model, allowing it to focus on a specific idea or concept you want to highlight. This can be accomplished by repeating the same word or similar phrase within the image prompt. Repetition helps reinforce the message conveyed through the image and increase the memorability of the model. Rather than producing just one image based on a prompt, the model generates multiple images with subtle differences, resulting in a diverse set of potential outputs. This technique is particularly valuable when generative models are confronted with abstract or ambiguous prompts to which numerous valid interpretations are possible. 



Weighted terms: are words or phrases that have a powerful emotion or psychological impact.

Words like, limited time offer, guaranteed, elicit a sense of urgency, security and trust.
Words like exclusive, premium, luxury, elicit a sense of exclusivity and sophistication.

Examples
- Craft an image of a cozy living room with a warm:10 | crackling:8 | fireplace.
- Generate a vibrant cityscape with shimmering:6 | neon-lit: 8 | skyscrappers.
- Depict a bustling street market, with colourful:-6 | exotic: 10 | food stalls.

Negative weight of 6 to colourful - so model will de-emphasise colourful and adds more weight to exotic.

Fix deformed generation

This is a technique used to fix deformities or anamolies that may impact image effectiveness ( such as distortion of human limbs).

Example

- Mother Teresa with waving hand [disfigured, deformed hands, distorted hands, distorted fingers, bad anatomy, bad hands]
- A smiling little girl [bad, ugly, deformed body, distorted face, cross-eyed, blurry]
- A man running on treadmill [bad legs, disfigured body, bad anatomy, photoshopped]

Negative prompts are in the square brackets which tell model what not to do.

Best Practices for writing Prompts

















Tuesday, April 09, 2024

Servant Leadership

  • Servant leadership is all about teams winning. When they win, you win.  
  • Habits
    • External self
    • Reflective self
    • Don't become a slave of rat race. Think reflectively. 
    • How do you want to be remembered?
    • What are your values?
  • The number 1 customer for companies is its people.



Become a leader people love


1. LEADING WITH A HEAVY HEART
    • Read the room, tap into pour humaneness, focus on what is possible.
    • Carry on continue in business while still bearing the weight on what is happening to us, families, lives, and those we love, our companies, employees and our communities.
    • Heart, feelings, empathy - contemporary leadership.
  • Sometimes the right thing to do is not try to be happy.
    • Saying let's try to be positive at times when things are clearly not okay can create gap between the leader and the team.
    • Creates crisis of confidence - team may say we see what you cannot see.
  • Emotional labour - is the gap between who we are naturally, and who we put effort into becoming for a situation. Bigger the gap more the stress and challenges.
  • Instead of being trying to happy and staying positive, think of what is possible. 
  • Focus on this -----
    • Things might not be okay, but there are opportunites to move forward.
  • Confront reality
    • Ground yourselves on what is going on.
    • What we think it means to us.
    • And what might come next.
  • Confronting reality might sound like this:
    • Here is what we know.
    • Here is what we d not know, but that we are working on.
    • This is what we think it will mean.
  • It is far more important to have the right questions than the right answers.
    • Identify and focus on what can be controlled.
    • Maybe there are areas where we may not have control but we may have influence.
    • Discuss on sphere of activity we are leaning into. 
    • Can i control the individual experiences of my team members.
    • Can i influence other things they are experiencing in a positive way. Talking to them on that, agreeing on that, etc. etc.
  • Communicate that there are certain things that are not in your control. 
  • Be honest about things around you that are not in our control.
  • Invite team members to share their perspective. Questions
    • How are you doing? Ask for their perspective of things. 
    • What's one thing I can do to be a better leader for you?
    • If you ever left us, what would be the reason? How can we make sure that does not happen?
  • When you are personally in deep pain
    • Consider your Mental health and wellbeing
      • Are you physically okay
      • Are you mentally okay
      • Are you emotionally okay
      • Can you be in the game?
  • Take time for yourself.
2. SERVANT LEADERSHIP
  • Servant leadership is all about teams winning. When they win, you win.  
  • Habits
    • External self
    • Reflective self
    • Don't become a slave of rat race. Think reflectively. 
    • How do you want to be remembered?
    • What are your values?
  • The number 1 customer for companies is its people.
3. JOB MOTIVATION
  • Your underlying premise about others should be:
    • Do care, they want to contribute, they want to do right thing and want to contribute. They ware willing to work hard.
    • Above premise is more noble, and closer to human nature. 
    • This will lead to success for both you as leader and teams as well.
  • Build workplaces that go with the grain of human nature.
  • Controlling Contingent Reward
    • Also called IF-THEN Reward.
    • If you do this, then you get that.
    • Are extremely effective with simple tasks with short time horizons.
    • Because people love rewards.
    • If then rewards are less effective for complex tasks with longer time horizons.
    • Above sentence is more relevant to white collar jobs.
  • Money is a motivator. Money is proxy for fairness
    • Internal fairness. You and i do same kind of job, contribution etc. If I know you are getting 10% more, then i get demotivated. Because we are doing same work, but you are getting more.
    • You and I are getting same amount, but another Org in same labor market for same work is paying 20% more. We get demotivated. Because we think it is not fair.
    • Humans are attuned to the norm of fairness.
    • If you violate the notion of fairness, you are toast.
If you are running an organization or managing a team, then to motivate your team, put the two key ideas in place:

- Pay people fairly. Paying people failry does not mean paying everyone equal, but means pay people depending on their contribution. Some people are better at job than others. Some people contribute more than others. They deserve more money. 

- Take the issue of money off the table. For more creative, complex work, money alone is not the motivator. For your team to effectively work and stay motivated, pay them enough so they don't think about money, and can focus all their energies in pursuing the solutions to problems. 

For simple tasks, paying more will improve motivation, however this is not true for complex tasks. 

For enduring performance once above are satisfied there are 3 motivators:

1. Purpose: Do people know why they are doing something? Not merely how to do it. Are they making a difference, are they making a contribution? 
2. Mastery: are people getting better at something that matters? Are they making progress in meaningful work? 
3. Autonomy: Do people have a say? Do they have some control over what they are doing?

As a leader, it is your responsibility to ensure you create an environment where purpose, mastery and autonomy can blossom.

PURPOSE

- Purpose (Capital P). Making a difference to the world. Like solving climate crisis, feeding hungry. 
- purpose (Small p purpose). Are you simply making a contribution? Is my team making a difference?

Both purposes are important. Two interesting studies.

1. University of Michigan. Work study students working in a call centre to raise funds for the university. Turned out that when students spent 5 mintues reading a letter from people who were beneficieries of the funds, or even better meeting the beneficiaries, their performance increased significantly. This is the power of capital P purpose.

2. Study of Harvard business school cafeteria. Cooks cannot see customers and customers cannot see cooks. The study with the help of a rigged iPad enabled cooks to see customers and vice versa. The quality of the food improved. Cooks when saw their beneficieries increased their performance. 

Promoting purpose

Whose purpose is it anyway? using a blank card to pass around in the team asking them to write down the purpose. Turns out the results usually can be categorized into two groups - first where people are clueless, and second where there seems to be a common theme, a hum, or music that resonates the purpose of organization.

How to promote purpose?

1. By talking about why instead of how.

We always talking about how, but never why. Why is an enormous performance enhancer. Once people know why they are doing something, their performance automatically improves because humans are deeply motivated by a sense of purpose.

Have fewer conversations on how and more on why. Use why conversations than how conversations.

2. By building belonging in organizations. 

Let belonging emerge from the bottom like team members initiating activities like pot lucks, or someone bringing in cake/ bake items to intiaite the camaraderie and belongingness. Mandatory happy hours mandatory team lunches are forced fun that doesn't resnoate with the bottom, and therefore doesn't help nurture belongingness.

MASTERY
  • Self feedback
    • At end of everyday, take 60 secs to write down 3 things you got done that day.
    • This will allow you to see the progress, and sustain the progress.
    • Summon intrinsic motivation.
  • The best feedback is frequent and informal.
  • Traditional performance reviews do not do a good job of promoting mastery because they are infrequent, formal, and ineffective. Kabuki style, everything seems orchestrated.
  • Weekly 1-1's with a twist (You are the manager, and you checkin your reportee)
    • Week 1 checkin, how are you doing; what do you need.
    • Week 2 checkin, how are you doing; what do you need.
    • Week 3 checkin, how are you doing; what do you need.
    • Twist: We talk about something diff. What do you love about your job, what you don;t
    • Next month - check in, check in, check in, then talk about how to remove barries to doing your job effective. 
    • 4th slot is customizable, continuous improvement.
  • Give feedback on performance. Negative feedback. It is uncomfortable to deliver and receive.
    • It is called WISE FEEDBACK.
      • 19 words you can use to negative feedback as a source of mastery.
      • I am giving you these comments because I have very high expectations, and I know that you can reach them.
      • Do not shy away from negative feedback.
AUTONOMY
  • Some jobs are inherently autonomous than others.
  • Hospital Janitor research.
    • Managers told the janitors 
      • Craft the job in a way meaningful to you.
      • If you want, go beyond your boundaries of what you are supposed to do if doing that makes you enjoying your job more.
        • Saying hi, talking to patients, etc. etc.....help nurse, etc.
    • Above made their job more meaningful, engaged more, were more productive, and stuck to their jobs longer.
  • Every job deserves autonomy and self direction.
  • As manager, make sure that happens.
How to promote autonomy

Ask:

1. Do my people have control in what they do?
2. Do they find it challenging?

If no to any one of above, you got work to do.



Autonomy Audit

Have your team rate it on a scale of 1 to 10.
  • How much autonomy do you have over your tasks at work?
  • How much autonomy do you have over your time at work? (when you show up and when you leave, how you allocate hours each day)
  • How much autonomy do you have over your team at work? (How much say you have with people you work with collaborate with)
  • How much autonomy do you over your technique at work  - how you actually perform the main responsibilities of your job.
Atlassian 

- Once a quarter, thu afternoon next 24 hours -- do whatever you want. But showcase it on Friday.
- These are called A Ship It Day. One day of intense undiluted autonomy
- Similar to hackathons, Google 20% time

PEOPLE DO GREAT WORK WHEN THEY HAVE PERIODS OF UNADULTERATED AUTONOMY

Autonomy is the pathway to innovation and creativity 

Reconfigure environments
Create islands of undiluted autonomy (1/2 hours of each week or 1 day a month kind of)

4. TRANSFROMATIONAL LEADERSHIP

Transformational leadership is a theory of leadership where a leader works with teams or followers beyond their immediate self-interests to identify needed change, creating a vision to guide the change through influence, inspiration, and executing the change in tandem with committed members of a group; This change in self-interests elevates the follower's levels of maturity and ideals, as well as their concerns for the achievement.[

This leader affects change through inspiring and motivating others to be more productive and involved.

Transformational leaders use four practices that help the people on their team perform at their best. Let's explore each of the four practices.
  1. Lead with a purposeful mission for change
    • Transformational leadership begins with a clear and purposeful mission for change. Leaders articulate a compelling vision that inspires and motivates their team members to commit to a common goal. They communicate this mission effectively, ensuring that every member of the organization understands the direction in which they are headed and the significance of their contributions. By providing a sense of purpose and direction, leaders foster a shared commitment to driving meaningful change, energizing their teams to overcome obstacles and pursue ambitious objectives.
  2. Role model integrity
    • Integrity lies at the heart of transformational leadership. Leaders lead by example, demonstrating honesty, transparency, and ethical behavior in all their actions. They uphold high moral standards and adhere to a strong sense of right and wrong, earning the trust and respect of their followers. By modeling integrity, leaders create a culture of accountability and credibility, where individuals feel confident in the integrity of their leaders and the organization as a whole. This commitment to ethical conduct fosters a positive work environment built on trust, honesty, and mutual respect.
  3. Stay curious and inspire innovation
    • Transformational leaders embrace a mindset of continuous learning and curiosity. They encourage their teams to question assumptions, explore new ideas, and challenge the status quo. By fostering a culture of curiosity and experimentation, leaders inspire innovation and creativity within the organization. They celebrate new approaches and encourage risk-taking, recognizing that innovation often requires stepping outside of comfort zones. Through their openness to new possibilities and willingness to embrace change, leaders create an environment where innovation thrives, driving ongoing improvement and adaptation.
  4. Empower each to be their best.
    • Empowerment is a cornerstone of transformational leadership. Leaders recognize the unique talents and strengths of each individual and empower them to reach their full potential. They provide opportunities for growth and development, offering support, guidance, and resources to help team members succeed. By delegating authority and decision-making responsibilities, leaders foster a sense of ownership and autonomy, empowering individuals to take initiative and make meaningful contributions. This culture of empowerment not only enhances individual performance but also cultivates a sense of ownership and commitment to the organization's goals, driving collective success.
Purposeful leadership
  • Leader energizes a group of people to a shared goal. 
  • Purpose is how you create a positive impact for others
  • Vision is the outcome; the better future you want to create
  • Discover other's strengths and energizers (what motivates and propels them forward). You may use assessment tools.
Managing resistence to change.
  • Change is seen as a threat.
  • Triggers fight or flight survival mechanism - 
  • Fight: openly resist.
  • Flight: disengage from participation.
  • Freeze: inaction due to being confused or overwhelmed.
  • Appease: a need to please that is motivated by fear, not real buy-in.
How to manage resistance to change?
  • Create a stakeholder map.
  • What is at stake for them? // how will change impact them?
  • How do you see them reacting? Are they in fight or flight mode?
  • Get your stakeholders out of fight or flight mode:
    • Engage in powerful conversations that builds trust.
    • Start with what is important to people.
    • Common interests between you and them.
    • Practice curiousity. Ask what is imp to you, what is the impact of this change on you?

Check
  • Have i built trust?
  • Have i discoverd motivators and aspirations?
  • Am i nurturing their confidence?
  • Am i helping them become self aware?
  • Am i bringing in curiosity?





Friday, April 05, 2024

Generative AI and LLMs for Dummies

Source: Generative AI and LLMs For Dummies®, Snowflake Special Edition

Traditional AI

Traditional AI is also referred to as Machine Learning (ML) focusses on analytical tasks like classification and prediction. 

Generative AI 

Generative AI goes a step further with its ability to create new, original content. 

Gen AI is a type of artificial intelligence that uses neural networks and deep learning algorithms to identify patterns within existing data as a basis for generating original content. By learning patterns from large volumes of data, gen AI algorithms synthesize knowledge to create original text, images, audio, video, and other forms of output.


Tuesday, April 02, 2024

Data Strategy (IBM)

 

Components of Data Strategy

(Some definitions are taken from IBM.com)

Data Pipeline: 

A data pipeline is a method in which raw data is ingested from various data sources, transformed and then ported to a data store, such as a data lake or data warehouse, for analysis.

Before data flows into a data repository, it usually undergoes some data processing. This is inclusive of data transformations, such as filtering, masking, and aggregations, which ensure appropriate data integration and standardization. This is particularly important when the destination for the dataset is a relational database. This type of data repository has a defined schema which requires alignment—that is, matching data columns and types—to update existing data with new data. 

Data can be sourced from:
- APIs
- SQL/Non-SQL databases
- Flat files
- Other formats

Before data flows into a data repository, it usually undergoes some data processing. This is inclusive of data transformations, such as filtering, masking, and aggregations, which ensure appropriate data integration and standardization. This is particularly important when the destination for the dataset is a relational database. This type of data repository has a defined schema which requires alignment—that is, matching data columns and types—to update existing data with new data. 

Type of data pipelines

a. Batch Processing

Batch processing loads “batches” of data into a repository during set time intervals, which are typically scheduled during off-peak business hours. This way, other workloads aren’t impacted as batch processing jobs tend to work with large volumes of data, which can tax the overall system. Batch processing is usually the optimal data pipeline when there isn’t an immediate need to analyze a specific dataset (for example, monthly accounting), and it is more associated with the ETL data integration process, which stands for “extract, transform, and load.”

Batch processing jobs form a workflow of sequenced commands, where the output of one command becomes the input of the next command. For example, one command might kick off data ingestion, the next command may trigger filtering of specific columns, and the subsequent command may handle aggregation. This series of commands will continue until the data quality is completely transformed and rewritten into a data repository.

We did it using Control-M scheduling where an out condition is passed on to the downstream application(s), which picks it up as an in condition to continue the ingestion, transformation, etc. 

b. Streaming data pipelines / event-driven architectures

Unlike batching processing, streaming data pipelines—also known as event-driven architectures—continuously process events generated by various sources, such as sensors or user interactions within an application. Events are processed and analyzed, and then either stored in databases or sent downstream for further analysis. 

Streaming data is leveraged when it is required for data to be continuously updated. For example, apps or point-of-sale systems need real-time data to update inventory and sales history of their products; that way, sellers can inform consumers if a product is in stock or not. A single action, such as a product sale, is considered an “event,” and related events, such as adding an item to checkout, are typically grouped together as a “topic” or “stream.” These events are then transported via messaging systems or message brokers, such as the open-source offering, Apache Kafka. 

Since data events are processed shortly after occurring, streaming processing systems have lower latency than batch systems, but aren’t considered as reliable as batch processing systems as messages can be unintentionally dropped or spend a long time in queue. Message brokers help to address this concern through acknowledgements, where a consumer confirms processing of the message to the broker to remove it from the queue.

Data Pipeline Architecture

Remember DDEP zones - 

Raw zone or Landing zone: (no user access, true source data stored in source format, history is retained), 
Democratized zone: Source with field level encryption, natural keys extracted to enable integration, history is retained. Seamless access to enterprise data without the overhead of stringent and bureaucratic access controls. Sensitive data is encrypted.
Publish zone: Operational data sets. Downstream applications connect to source data; SLA driven. Data structures are designed to meet consumption patterns. Publish data is consumed by downstream apps, APIs, EDW, and Bi Analytics tools.
Discovery zone: is another zone beneath the democratized zone from where data science tools and BI/analytics tools connect to derive their individual needs.
FDP/BDP/XDP: Data Product: are additional layers to the right of Publish from where applications source data for individual needs. 

> Ingestion: data is ingested into raw and from there to publish/bdps where it is stored. 
> Transformation: transformation happens prior to moving data to publish and bdps. 
> Storing: data is stored
When sending downstream, the data is sent outbound via outbound job on to Sterling or another system via passing out condition.

ETL Vs. Data Pipelines

An ETL Pipeline ends with loading the data into a database or data warehouse. A Data Pipeline doesn't always end with the loading. In a Data Pipeline, the loading can instead activate new processes and flows by triggering webhooks in other systems.

Data Lineage

Data lineage is the process of tracking the flow of data over time, providing a clear understanding of where the data originated, how it has changed, and its ultimate destination within the data pipeline.

Data lineage tools provide a record of data throughout its lifecycle, including source information and any data transformations that have been applied during any ETL or ELT processes.

This type of documentation enables users to observe and trace different touchpoints along the data journey, allowing organizations to validate for accuracy and consistency. This is a critical capability to ensure data quality within an organization. It is commonly used to gain context about historical processes as well as trace errors back to the root cause.

Reliable data is essential  to drive better decision-making and process improvement across all facets of business--from sales to human resources. However, this information is valuable only if stakeholders remain confident in its accuracy as insights are only as good as the quality of the data. Data lineage gives visibility into changes that may occur as a result of data migrations, system updates, errors and more, ensuring data integrity throughout its lifecycle.

Data lineage documents the relationship between enterprise data in various business and IT applications.

Datawarehouse vs. Data Lake vs. Data Mart

A data warehouse is a system that aggregates data from multiple sources into a single, central, consistent data store to support data mining, artificial intelligence (AI), and machine learning—which, ultimately, can enhance sophisticated analytics and business intelligence. Through this strategic collection process, data warehouse solutions consolidate data from the different sources to make it available in one unified form. 

A data mart is a focused version of a data warehouse that contains a smaller subset of data important to and needed by a single team or a select group of users within an organization. A data mart is built from an existing data warehouse (or other data sources) through a complex procedure that involves multiple technologies and tools to design and construct a physical database, populate it with data, and set up intricate access and management protocols.

While it is a challenging process, it enables a business line to discover more-focused insights quicker than working with a broader data warehouse data set. For example, marketing teams may benefit from creating a data mart from an existing warehouse, as its activities are usually performed independently from the rest of the business. Therefore, the team doesn’t need access to all enterprise data.

A data lake, too, is a repository for data. A data lake provides massive storage of unstructured or raw data fed via multiple sources, but the information has not yet been processed or prepared for analysis. As a result of being able to store data in a raw format, data lakes are more accessible and cost-effective than data warehouses. There is no need to clean and process data before ingesting.

For example, governments can use technology to track data on traffic behavior, power usage, and waterways, and store it in a data lake while they figure out how to use the data to create “smarter cities” with more efficient services.

Data Identification:

Critical Data Elements

Every organization handles a vast volume of data, but not all data are equally crucial to their objectives. They prioritize data governance based on business goals, regulatory requirements, and risk tolerance. By focusing efforts on critical data, particularly Critical Data Elements (CDEs), they effectively manage data risks as part of our Risk Management Strategy.

Data Element is a unit of data. Critical Data Elements are those that if missed or of low quality will impact a business' ability to carry out business.  

Data Storage

Data Provisioning

Data Integration

Data Governance


If we already have automation, what's the need for Agents?

“Automation” and “agent” sound similar — but they solve very different classes of problems. Automation = Fixed Instruction → Fixed Outcome ...