Introduction 

Large Language Models (LLMs), such as OpenAI's ChatGPT, are breakthroughs in the field of artificial intelligence (AI). They are a class of machine learning models designed to understand and generate human-like text based on the input they receive. With recent advancements, these models have become increasingly powerful and efficient, capable of a wide range of tasks including drafting emails, creating poetry, answering questions and even writing code. 

The potential societal impact of LLMs is profound. They promise to transform many sectors, from healthcare to customer service, by automating tasks traditionally performed by humans. This increase in efficiency and accessibility may very well shape how we build future businesses and streamline operations.

With that, we embark on a journey between two Consulting Systems Engineers with the latest emerging tech, some free time, and a singular goal in mind – to build something cool.

The challenge

There is no doubt the potential impact that a productized LLM could have on any industry. So, the challenge becomes: what prototype would create an impact with our customers and peers alike? You can only go so far with a song-writing gimmick or a regex syntax generator. We needed a solution to a real, but more so simple, problem.

With the two of us having served in the US Military, we decided to build something and dedicate it to our former selves – junior servicemembers who were constantly out of regulation with our uniforms, grooming and overall appearance. The major benefit of AI is that it can't force you to do pushups.

 The solution

With our combined engineering experience, we decided to create a chatbot tool named SergeantAI. It is the Non-Commissioned Officer (NCO) that neither slept nor ate. All it knew was complex US Army regulations with an unyielding desire to assist your endless journey in adhering to the rules. Next came the creation of our chatbot's persona in the form of an identity prompt:

"You are a motivated and enthusiastic sergeant in the US Army who loves helping fellow soldiers."

SergeantAI would be a responsive, web-based application that performed equally as well on mobile as it did on desktop. It would be built "user first" with human like interactions, and a desire to provide thoughtful context to be more than just a Q&A bot.

Most importantly, it was informed. As part of SergeantAI's training, we provided it access to two public US Army publications and locked it from accessing any other source, including potential fabrications of truth. The documents include:

  • Army Regulation 670-1: Wear and Appearance of Army Uniforms and Insignia
  • Army Pamphlet 670-1: Guide to the Wear and Appearance of Army Uniforms and Insignia

Prototyping

Building a working prototype was rather simple. Making it worthy of public demonstration was another story. This included supplying a clean User Interface (UI) and embedding a feedback system that allowed users to flag incorrect responses for review.

As a method of survival when coexisting development with day-to-day responsibilities, we worked in sprints and used task management tools. We sought user feedback and tested it in cycles. Occam's Razor was our guiding principle – if it couldn't be fixed simply and expediently, we pivoted.

Short of a month, we had a polished prototype that had no issues responding and carrying conversations with our specified parameters. Some of our favorite questions include:

  • Can I put my hands in my pockets?
  • What makes up the maternity uniform?
  • How should my mustache be trimmed?

Architectural Overview

At a very high level, SergeantAI's tech stack consists of the following: 

  • Frontend: Svelte (TypeScript)
  • Backend: NodeJS (TypeScript)
  • Database: PostgreSQL
  • Completion Model: gpt-3.5-turbo aka GPT-3.5 by OpenAI
  • Embedding Model: text-ada-002 by OpenAI

By utilizing server-less components wherever possible, we were able to build the prototype with minimal capital investment – favoring an operating or consumption model. We could track how much each question costs and even limit users based on a token system. Being that the actual LLM was accessible by API with a metered billing system, this consumption visibility extended end-to-end.

Individual queries from the application users followed a five-step process as follows:

 

A picture containing text, screenshot, line, font

Description automatically generated

Everything was done with the mindset that the architecture would be reusable, repeatable and scalable to adjust to any document repository.

What's next?

While it was never meant to reach the hands of every US Army soldier, SergeantAI allowed us to experiment, test and build a thoughtful solution in such a short amount of time. As we reflect upon the experience, we realize that rebuilding it for just about any use case seems far easier than initially thought.

However, as with all AI technologies and the quickly evolving landscape, they raise important questions around ethics, privacy and the need for careful regulation and responsible usage.

Would you like to see a demonstration or learn more about SergeantAI? Email the team at SergeantAI@wwt.com