Data

Optimising the 5 stages of AI for meaningful data-driven decisions 

Steve Elcock is the Founder and CEO of elementsuite.

Cutting through the hype and hyperbole, it is becoming clear that AI holds the power to significantly enhance or disrupt almost every aspect of our lives. In my role as CEO and Founder of elementsuite, a specialist HR and Workforce Management SaaS provider, we are making significant progress in harnessing the power of AI to reset the future of HR and workforce management systems to help organisations optimise their people and processes through powerful data insight.  

Business leaders are rushing to explore the possibilities of AI within their organisations as a report by Accenture reveals 73% of businesses claim that AI is their top digital investment priority. Whilst leaders can be forgiven for not knowing the technicalities and subsets of AI, such as understanding the differences between “machine”, ”deep”, and “reinforcement” learning, there’s an increasing need to catch up, and a basic level of understanding about AI that’s critical to ensure it’s done effectively.  

Done right, it looks like AI could solve one of business leaders’ greatest challenges, which is to increase productivity in a changing world where the workforce talent pool is shrinking, whilst workers are being expected to make sense of more and more data being available. That incoming tide of data for analysis also needs to be handled in a way that ensures data privacy and security are upheld at all times. The truth is that most people don’t know where to start with AI or have a simple framework in mind to make use of its capabilities. I believe that although new developments in AI are coming out daily, there are some key principles, and it is useful for us to consider a simple five-stage model to progress with an AI strategy, to optimise it for the best business outcomes. 

The power of Large Language Models (LLMs) 

Large Language Models (LLMs) use deep learning AI techniques to understand, generate, and process human language. LLMs excel in question answering, content generation, classification, and summarisation or generalisation tasks. Using sophisticated AI techniques, an AI tool like ChatGPT can use an LLM to respond to your requests, use your data, apply your HR data security, in your tone, and use your company policies and guidance. This might be a request for a mortgage reference letter, queries about shifts or holiday allowance, or onboarding support. A 24/7 assistant can enhance productivity whilst ensuring data security. 

The five stages of AI 

An AI tool should provide flexibility and control over the five key AI techniques to fully unlock the power of Large Language Models (LLMs), to generate the best responses and business outcomes: 

  1. Prompt engineering 
  1. Retrieval augmented generation (RAG) 
  1. Fine tuning of domain-specific models 
  1. Reinforcement learning using human feedback (RLHF) 
  1. AI-powered workflow 

1. Prompt engineering 

When you start experimenting with ChatGPT and asking it questions, you begin to realise that the reason it’s so good is that it seems to “align” with what you’re asking and there are dimensions of higher-level reasoning that exist in the model. This is because when an LLM is trained, there’s a “base” model, and then layered over this there are many additional prompts that tell the model how to respond to certain questions or behave in certain ways. This is called an “instruct” model which makes it possible to prompt. The way in which you prompt is the secret to getting the most out of your AI. As you’ve probably found using ChatGPT, even if you did nothing else, using prompts effectively would be a powerful stage for any pre-trained AI tool. 

An instructed language model allows you to teach it responses based upon giving it examples in the prompt – this is sometimes known as one-shot/few-shot/multi-shot learning. For instance, if you want a letter drafted and you give it basic prompting it will write you a basic letter based on the weights in its model. But let’s say instead of writing a question in your prompt, you gave it an example – (“one-shot”) of a letter, but with the kind of formatting and language/content, it should use. This means you are giving it additional context in your prompt, based on what is known as “one-shot learning”. Extending this idea further in a different domain, perhaps you are using your AI to classify customer support tickets, so you can feed it many previous examples of how things are classified. This is called “few-shot learning”, and it’s a really powerful method of getting the most out of your AI toolset using early-stage prompting.  

You can even ask it to do different styles or ask the prompts to come back in certain formats, for instance, respond in Japanese or even in a programming language like JavaScript. One of the most recent popular applications of this in the IT domain is to use AI as a Generic Function Caller – where given enough sample inputs, the AI can produce logical/reasoned output that previously would have required code – and can produce the output in an industry-standard structured format such as JavaScript Object Notation (JSON). If you give it enough examples in your few shot prompt it comes back with JSON as an output.  

Importance of Context Windows and Chain of Thought Reasoning 

Understanding the context window is critical to creating prompts. There are a limited amount of “tokens” you can use in your prompt. A token can be thought about as a part of a word in your prompt. For instance, GPT3.5-Turbo (the LLM that underpins the free version of ChatGPT) was originally limited to 4096 tokens, although this has been increased, and most recently with ChatGPT4 (GPT-4 Turbo) this context window has increased to 128,000 tokens. You can bring carefully curated questions and answers or JSON function calls into your prompt. It could even be a whole book or a whole bunch of code that goes into this context window. 

The size of this context window can be seen both as a constraint and an opportunity. The bigger the context window, the better the chances you’re going to get more examples and therefore more accuracy with the way it comes back with the answer. You pack the context window with relevant data and give it the thing you want it to do – for instance, preferred corporate tone or translations. If you have packed it with highly relevant questions and answers, this will fine-tune the responses it will give. For instance, in an HR context, it can give a user elements of the maternity policy, what their holiday entitlement is, and it brings back all that information based on the prompting that has been designed. 

In recent months, something known in the industry as Chain of Thought or Graph of Thought reasoning has emerged, which is a way of improving the prompt that you submit to the LLM. As you build prompts you have various steps of building it up. Using a support ticket example, for example, you might need to first decide the classification – is it an absence, payroll, or other kind of ticket? Then you might perform a sentiment analysis, perhaps to detect whether the customer is in distress. If you get the prompt to work out this chain of thought, it’s much more likely you’ll create a prompt that’s more effective in answering the final question. You can save your interim steps and plan the way you construct the prompt to make it even better. 

2. Retrieval augmented generation (RAG) 

The second and equally essential stage in optimising your AI is a stage where you need to pull up data, to augment your prompt from a range of different sources not just your brain. In building the prompt a technique known as Retrieval Augmented Generation (RAG) can be used. Building your prompt involves going to data stores to get relevant stuff, for instance, your data stores, question banks, supply chains, documents, databases, and HR systems (with the right security). On the journey to construct the most effective prompt you likely need to augment that prompt with the most effective and useful context, so you go to these places, or even call specific tools such as a calculator, or web search to do certain functions, and use that to create the best possible prompt. 

A reasonably new and highly powerful retrieval augmented generation technique is using vector databases. With a vector database store, you can take a sentence and it will embed it as numbers in a database. As humans, we think in terms of space and time, but in vector stores, space can be calculated by mathematical techniques which are very powerful for spotting patterns, question and answering, similarity search, and other things. It’s not strictly an AI technique as such, rather vector stores allow you to much more easily and readily perform fuzzy matching with existing stuff. As a result, you end up with an incredible prompt now that you’ve augmented it with all this amazing data context before you open the door of an AI LLM. 

3. Fine-tuning of domain-specific models 

Fine-tuning refers to the additional training of an LLM using low-level AI techniques. In stages 1 and 2 above, we have shown how it is possible to construct a great prompt with great context and simply pass this to a foundation instruct model. However, you can also go further, and create your own instruction-aligned model in this third stage of AI training techniques. The foundation LLM itself can be fine-tuned with your data, context, and instructions. This means that instead of a model being fed with examples and context to steer it in the prompt, the model itself can be adjusted, instructed, and steered at its core within its model weights. This is called fine-tuning, and it can be particularly important if you run out of context window (e.g. too many examples are required to feed into a prompt that is more than the size of the context window), or if you need to train a model for a very specific task. 

You can also fine-tune it further. For example, I was skeptical about fine-tuning, so I took a non-aligned foundation model (called Llama-2), and gave it loads of question-and-answer pairs about elementsuite. I trained it for about 90 hours on my laptop, and after about 1000 passes when all the weights had changed, it knew the answer to the question: “Who is the CEO of elementsuite” (me!), despite having known nothing about elementsuite previously. When you further fine-tune the model to have more context and steering, then you create it for very specific functional tasks. LLMs are typically quite large, but it’s important to remember that you don’t need them to be large when they are fine-tuned for specific tasks, – if for instance, all you want to know is about elementsuite. 

4. Reinforcement learning using human feedback (RLHF) 

Stage 4 then requires you to take a look at the output and ask whether your AI is doing a good job of answering the question. This is where Reinforcement Learning using Human Feedback (RLHF) comes in to check whether you think the answer is any good as a human. This is where AI can become a bit more labour intensive, as you need humans to rate the output. RLHF strictly means training another model to see how the AI is going as a generator of output, whether it’s a good or a bad answer. As you are gradually training it and it gradually learns, it can detect or recognise a good or bad answer, as over time it gets better and better at detecting this. 

For any bad answers, you can try again with more data or better prompts, which makes the answer progressively better over time. The human feedback could be the support agent trying to generate a response and rating how the AI is doing before sending a response back to the customer. In this stage, the AI team works out how to make it respond effectively. Human reinforcement feedback techniques can suggest improvements to the prompts and context data (stages 1 and 2) or the dataset used in fine-tuning your instruction-aligned model (stage 3). 

5. AI-powered workflow 

Workflow is a powerful partner of successfully optimised AI – to control what’s carried out when AI has nailed its task and made good decisions. Organisations can let AI-powered workflow run semi-autonomously (with review/approval stages built-in) or when confidence and security is tested and proven this may run fully autonomously. For instance, an AI-powered workflow could book my employee’s absence or create a mortgage reference letter. It’s about trusting AI to trigger events based on rules and roles in the world to control another action. In an AI world, this is the stage where you can extract huge productivity and time savings out of your AI. 

Another interesting technique is called ‘agency’, which is the concept of different AI models acting in different ways for different reasons. It’s rather like a board meeting with all the different C-level viewpoints being debated and coordinated. One might be an optimist, and another might be a critic. The “optimistic” primary content generator may be challenged by an adversarial critic model – that says how they would improve the content. This might mean further levels of QA reasoning running through different models. Or you might run an entirely different set of prompts that check the sentiment is right for the person being responded to so that the tone can be changed as necessary.  

The concept of agency can also help with chain of thought prompt engineering, and all stages in improving a model’s output. A recent powerful approach called Brainstorm Search Hypothesise Refine (BSHR) has been proposed, which extensively uses “agency” techniques and provides a conceptual framework for improving AI outcomes. 

The evolving role of the AI team 

Due to the sheer demand for AI and the complexity of implementation, there will inevitably be new roles required for organisations to tackle AI – the next big challenge for the industry. Whilst to date, the prompting in stage 1 has been typically taken on by data engineers, and a solutions architect may perform the RAG required for stage 2, the landscape is changing rapidly, and more and more specialisms are emerging as the stages of AI optimisation become clearer.  

Although large AI vendors like OpenAI, Microsoft, and Google are making it easier for people to set up their AI tools effectively, it’s inevitable given the speed and transformational importance of the technology, that organisations will be universally hunting for more and more AI expertise. Trained data and AI practitioners will need to keep a close eye on AI announcements and research, as the landscape is continually evolving, and their skills will need refining to keep pace with this change. 

The end-to-end process of training AI 

Starting on an AI journey for your organisation can seem daunting – especially when so much is changing so fast. Amid this rapidly changing landscape, we have tried to summarise five stages for understanding how to best utilise and train your own AI model and to help you navigate the AI revolution. 

Some organisations are in the early stages of their AI development, and stages one and two might be enough to augment their prompts with data and get out of the starting blocks. Breaking down a complex task or question to enable the LLM to think step by step is the key to successful prompting, and the more data you feed it, the better the outcome will be, as long as the data is good and carefully curated. 

But to get the most value and productivity gains from their AI investment, leaders will need to consider all five stages comprehensively and most importantly measure and manage the human engagement and feedback further down the chain. You can take it as specialised as you want to go, there’s so much to learn as it’s constantly evolving.  

Asking your AI tools to generate responses, checking if it’s a good or bad answer, and then keep refining it to ask it to try better, feels like a bare minimum that organisations will need to have in place to start to navigate the AI world. But finding those skills, and the right AI tech partner to wrap around this strategy and bring it to life, whilst staying aligned with the latest techniques and breakthroughs will be a perpetual challenge. 

The ‘wait and see’ approach can be tempting. Perhaps you can’t see the true benefits of AI just yet, or perhaps you’re waiting for an ‘easier-to-use’ AI tool that makes current investment seem unnecessary. But the risks of procrastination are high, as companies (and your competitors) increasingly begin to unlock the value of today’s rapid technological advances, quickly adopting the techniques outlined in this article.  

Our hope is that the five stages we have described will help you understand AI techniques in practical ways, and overcome “AI analysis paralysis”, to join the AI revolution. 

Author

  • Steve Elcock

    Steve Elcock, CEO and founder of elementsuite, is a visionary technology entrepreneur with over 25 years experience in HR technology. With a unique combination of a background in neuroscience and technology alongside a passion for AI, Steve’s vision to universalise enterprise HR processes is perfectly embodied by elementsuite’s all-in-one cutting-edge HR solution, which has the powerfully adaptable foundation to continually evolve and embrace the latest technological advancements.

Related Articles

Back to top button