• Daily SITREPS
  • Posts
  • The Right Tool for the Job: How to get the best out of AI for analytical tasks

The Right Tool for the Job: How to get the best out of AI for analytical tasks

Combine data and AI for the best results

Before we jump in, don’t be put off by the technical aspects of this: the overall concept is pretty straightforward and something you can put into practice yourself (I explain how to at the end).

Using the Right Tool for the Job

Despite their incredible capabilities, even the best LLM*-based AI suffers from a tendency to exaggerate or make up facts - AKA hallucinate. That's not such an issue when you're asking it to help tweak some text or brainstorm ideas, but it’s a big problem when you're trying to use AI for analysis. (*Large language model.)

On the other hand, simply dumping a mountain of data into a report or sending someone a spreadsheet without any commentary creates a different set of problems.

However, when we take a combined approach, we can get some pretty impressive results as long as we make sure we're using the right tool for the job.

Here's an example of how I've combined these approaches in DCDR, most recently to create a series of quarterly country stability assessment reports. These reports require a combination of data - e.g. news reports - analysis, and text summarization.

I’ve combined these individual functions together into a single process, each focused on a single task. Here’s how these elements work together.

Example: The DCDR Assessment Chain

(Note that I’m just using DCDR as an example; you can apply the same techniques anytime you’re conducting analysis with AI.)

Step 1- gather the news (DATA)

The app gathers news headlines for each country multiple times per day via an API (an application programming interface, in this case, a way for me to access a news data feed). The parameters of the API can be adjusted to narrow the results down but this isn't perfect so I need a way to deal with non-relevant stories.

Step 2 - check the news relevance (ANALYSIS)

Each story is passed to a specially trained instance of an LLM (currently an OpenAI model) which is asked to determine if it is 'relevant' or 'not relevant' with respect to country stability. This takes advantage of an LLM's ability to detect sentiment, in this case, relevance to DCDR’s definition of country stability. This tags each story for relevance so irrelevant news can be ignored.

Step 3 - Extract Keywords and Summarize the News (SUMMARIZATION)

Next, DCDR uses an LLM’s straightforward text management abilities to extract a list of keywords from stories and write a summary of the news for the period in question.

At this point, you'll note that we've used the three different techniques- data, analysis and summarization - to achieve different outcomes at different stages of the process. You'll also see how inappropriate wrong tool could be. For example, trying to get the API to only give us news relevant to country stability would give us very mixed results, and asking an LLM for country news will provide unverifiable, possible incorrect, results.

Now you've got the gist of the approach, we'll speed through the rest of the process, but here’s an overview of the whole sequence so you can see how the DCDR switches between functions.

Step 4 - Collect Background Country Information (DATA)

An API call collects factual background information on the country and stores this in a database.

Step 5 - Conduct a Stability Assessment (ASSESSMENT)

The stability assessment uses a very narrowly trained, fine-tuned version of an OpenAI model. This uses the country's news feed and background data to ascribe a stability rating for the country.

Step 6 - Search for Upcoming Events (DATA)

Another API call searches the web for upcoming events in the country. This produces up-to-date but raw search results, so we need a way to clean these up.

Step 7 - Summarize Upcoming Events (SUMMARIZATION)

Another LLM reviews the raw search results, extracts relevant upcoming events, and summarizes these in a readable format. As with the other LLMs, this model has a different prompt and set of conditions to narrow its focus and improve consistency.

Step 8 - Conduct Forward Assessment (ASSESSMENT)

The final stage uses the specially trained country assessment model from step 5 to conduct a forward-looking stability assessment for the country. (There’s an example of an assessment at the very bottom of this post.)

Time-Consuming, But Time Well Spent

This is a time-consuming process that requires careful sequencing and a lot of computation. Cutting down the number of steps and hoping that a general LLM gives us a decent response would be significantly faster and cheaper from a processing standpoint.

Can you tell when I was running the quarterly assessments..?

However, chaining the different processes together like this, and using the right tool for the job, plays to the strengths of each component. This ensures that we get the desired results at each stage of the process and decreases the opportunity for error and hallucination.

This is an occasion when the juice is definitely worth the squeeze.

The Non-Technical Approach

At the start, I promised that this was something you could do without getting too deep into the technology, so what does that look like?

In short, you take the same approach, but instead of chaining together a series of tools, you move along the process manually.

For example, instead of an API call for the news, simply filter your browser search for ‘news’. Then, extract the data from those results and clean it up a little before dropping that into the LLM prompt. Next, adjust the LLM prompt to give you the results you want.

Getting the prompt right can take time but once you have one that works, save it for future use. (And, for a real meta-experience, ask your LLM to improve the prompt before you use it in anger.)

Here’s an example of one of the prompts DCDR uses.

f'''
You are an expert AI analyst trained specifically on understanding factors that critically influence a country's stability, safety, and security. You have assessed the stability of {country} and explained your assessment reasoning. Now, I want you to consider these upcoming events that may affect {country} and provide a forward-looking assessment. I require two things:

1. Your assessment of whether these events are likely to result in the situation improving, deteriorating, or remaining broadly the same based on the news. You must use one of these terms to describe the effect: 'Improves', 'Degrades', or 'Negligible Effect'
2. Explain why you came to that conclusion.

Construct your response as follows: 
Based on these upcoming events, the situation in {country} likely [stability description]. This assessment is based upon the following factors [assessment reasoning].
'''

The upcoming events data is about 1,500 words which is supplied to the request separately. You could do the same with a version of this prompt, followed by a cut and paste of the web search results.

So the overall concept is simple and remains the same: use the right tool for the job and deliberately pass the output from one stage of the process to the next, whether that’s in code or manually.

DCDR Updates

I had a great break over the holidays but also managed to get a lot of essential work done on DCDR. Here’s what I did on my vacation…

🌎 Country Assessment Loading

The most obvious improvement was to the country assessments which were taking. Forever. To. Load. That’s fixed, and these pop up right away, so there’s no delay in getting to the stability assessments.

Country Assessments at your Fingertips: No Waiting Required

🔮 Stability Forecasts Added

The next big addition is country stability forecasts (the process I described above). These complement the country assessments to provide a forward-looking assessment of where things seem to be heading. They’re not intended to be specific predictions (I’ll share a post soon on why I think forecasting is a double-edged weapon), but highlight directional trends to help you prepare for what might lie ahead.

I just finished the first run on Tuesday and am checking the results before I add the assessments to the live app but I’ve included the text of an assessment below as an example of the raw output.

👋 Individual Access Opens on January 31

Finally, the early access program is closed but don’t worry, all is not lost!

Open access for individual users starts on January 31st.

Even better, if you join the waitlist now, you’ll be eligible for a special discounted subscription. That’s going to give you access to all of DCDR’s tools and services at a significant discount. 🎁 

And when you consider that DCDR’s tools can save you literally hours of time each week, that’s going to be quite an ROI.

More details on the subscriptions to follow, but if you think DCDR can help you in your risk and crisis work (it will, I promise), join the waitlist now.

That’s it for this week - I hope you’re as excited about the New Year as I am!

All my best

~Andrew

PS - Here’s an example of a quarterly assessment which includes the forward-looking assessment. (Please note the caveats at the bottom.)

Quarterly Assessment Example: India

This report was produced on 2024-01-02

Background

This assessment of India was produced by the DCDR.io assessment toolkit based on events over the last 90 days and upcoming events to assess the current situation and to consider the effect of upcoming events on India's stability.

Current Stability Assessment

India is Stable

Upcoming Events

Upcoming events that might affect the political stability of India include:

1. National and State Elections: India's political landscape can be significantly influenced by the outcomes of elections. Scheduled elections, particularly the general elections which are due in 2024, can lead to shifts in power dynamics and policy directions.

2. Economic Reforms and Policies: The government's approach to economic reforms and policy decisions can impact political stability. Any major reforms, such as changes in taxation, labor laws, or trade policies, can lead to public dissent or support, affecting the political climate.

3. Social Movements and Protests: India has a history of social movements and protests that can influence political stability. Issues such as citizenship laws, agricultural reforms, or caste and religious tensions can trigger widespread protests and potentially destabilize the current political environment.

4. Regional Conflicts: Tensions in regions like Kashmir or the Northeast, which have a history of insurgency and demands for autonomy, can escalate and affect national political stability.

5. International Relations: India's relations with neighboring countries, especially Pakistan and China, can have implications for domestic political stability. Border disputes or diplomatic incidents can lead to nationalistic sentiments and influence the political discourse.

6. Judicial Decisions: High-profile court cases and judgments, particularly those related to corruption, political leaders, or sensitive social issues, can have an impact on the political landscape.

7. Coalition Dynamics: In a multi-party system like India's, the stability of coalitions at the central or state level can be crucial. Any rifts within or between coalition partners can lead to political uncertainty.

It's important to note that these are potential events and the actual impact on political stability would depend on the specific circumstances and developments at the time.

Assessed Effect on India's Stability

The anticipated impact of the upcoming events on the situation in India is Negligible Effect. This conclusion is based on the following analysis:

India is a country with a history of managing and navigating through various political, social, and economic challenges. While the upcoming events listed above have the potential to impact political stability, India has demonstrated resilience in the face of such events in the past. The country has a robust democratic system, with regular elections and a strong judiciary, which helps to manage political transitions and maintain stability. Additionally, India has a diverse and vibrant civil society, which provides a platform for peaceful expression of dissent and grievances. While these events may lead to short-term disruptions or localized tensions, the overall stability of the country is expected to remain intact.

Report Ends

Note: These assessment results are based upon the best available data but the model remains in training mode so additional research and consideration are advised before taking specific action with respect to India.