Hello! I’m a Senior Software Engineer at Turquoise Health in charge of all things AI. In this post, I’ll take you on a tour of the wild world of AI, LLMs, and GPTs.

Generative AI has taken the world by storm since ChatGPT launched back in November of 2022. You know it’s gone mainstream when even your tech-illiterate friends are using it, perhaps obviously, to write their emails. While products like ChatGPT, DALL-E, and Google Gemini (or whatever they’re calling it now) get all the attention, you might have noticed it’s also snuck into everything from your email to your project management system. AI is suddenly everywhere, even in healthcare.

Does it belong? Do we like this? Hate it? Fear it? Everyone has their answer, but I find the best way to know what you think is to know what you’re thinking about. So in this blog, I want to talk about the unsung hero that is also the secret sauce behind the magic of LLMs (Large Language Models). It's the part that’s behind all those generative text AI features, and the part with the most applications in healthcare: Semantic Language Processing.

Semantics On Semantics

Semantic Language Processing does more than just read text; it deciphers the meanings and intentions behind our messy human language, enabling a level of comprehension previously unattainable by machines.

The most powerful (and fun to demo, IMO) application of this technology is Semantic search. Semantic search goes beyond simple keyword matching by using the meaning (aka semantics) of the search query to find the most relevant content. This unlocks a profound advancement in information retrieval by overcoming the severe limitations of traditional search. Traditional search (aka keyword search or lexical search if you’re feeling fancy) works by matching the words in your search query to words in whatever you’re searching for. Sure, more advanced versions support things like fuzzy matching and word stems but it’s fundamentally all about matching words. Let's break this down.

Imagine you wake up with the dreaded throat tickle and by lunchtime, your nose is running. “Not this time!” You head to WebMD and type “cold treatments” into the search bar hoping to get ahead of your incoming fever.

With traditional keyword searches, only articles with some part of the phrase “cold treatments” would be included in the results. This makes the search quite brittle because it will prioritize the article about cold weather exposure treatments while missing related articles about treatments for the flu, upper respiratory tract infections (the medical term for a common cold), or allergies (often mistaken for a cold). This is because those related articles lack the word “cold.”

Semantic search solves that issue by including results that are semantically related to “cold treatments,” even if they don’t contain the exact keywords.

Allow me to demonstrate. (Note: what follows are snippets of Python code you can understand even if you don’t code, I promise. Feeling ambitious? Feel free to follow along via this Colab notebook for all of the examples discussed in this post.)

Imagine WebMD has the following article topics to search against:

articles = [
"cold weather exposure treatment",
"cold pizza",
"ice cold beer",
"flu treatment",
"upper respiratory tract infection",
Okay, I acknowledge that it’d be weird if WebMD had articles about cold pizza/ice cold beer but I don’t care because it demonstrates my point, and besides -- some people would use those things to treat a cold! ‌‌

Next, we add some random words to represent other articles, and then run our search using both traditional search and semantic search:

# Also adding 50 random words to mix things up
searchable_documents = articles + random_words	
search_engine = SearchEngine(corpus)

search_query = "cold treatments"
Here we use a library that implements the bm25 algorithm; the gold standard for lexical search.

Here are the results:

BM25 / Keyword Search Results for Cold Treatments



cold pizza


ice cold beer


cold weather exposure treatment
















1 Basically: the higher the score is, the more relevant the match is.

As expected, only the articles with exact matching keywords received a score above 0 when using traditional search. It misses the articles for “flu treatment,” “upper respiratory tract infection,” and “allergies” because the keywords don’t match.

Semantic Search Results for Cold Treatments



upper respiratory tract infection




flu treatment


ice cold beer


cold pizza


cold weather exposure treatment










1 We’ll cover what “distance” means in more detail in the next section, but for now, just know that it’s between 0 and 1 and lower is better.

Semantic search did exactly what it promised: it ranked the most relevant articles highest even though they don’t exactly match the keyword search of “cold treatments” (it’s amusing that it still ranks “ice cold beer” and “cold pizza” above the random words, so we know it’s not a complete stick in the mud!). This makes a huge difference when it comes to the success and experience of searching.

It’s more than just semantics

I hope that by now you’re convinced that semantic search is a BIG deal and that this is only the beginning. The field is evolving at a breathtaking pace with innovations such as hybrid search that takes the best features from both keyword and semantic search, or using other contextual clues to guide semantic matching. It won’t be long until semantic search is the new standard and the days of searching for “apple” and getting results for produce, tech blogs, and Beatles records all at once are a thing of the past.

How the semantic sausage is made

So what explains this voodoo? How is a computer able to understand that when you type "cool beans," you're not seeking a chilly legume, but expressing casual agreement (albeit in a very 2000’s way)?

The answer is:

[-0.02167339, -0.04749667, 0.02635822, -0.00636666, -0.0127009, -0.00371625, 0.03063778, -0.00831597, -0.03640871, 0.00945881, -0.00964523, 0.02452644, 0.01120954, 0.02925989, -0.02812516, 0.00485503, -0.03117273, 0.01082859, -0.01775046, 0.00242752, 0.02635822, -0.00636666, -0.0127009, -0.00371625, 0.02635822, -0.00636666, -0.0127009, -0.00371625]

You’re welcome! Of course, I’m being ridiculous…the actual answer would be 150x longer!

This my friends, is a floating point vector, or for the layman, a really long list of crazy-looking numbers. Before machines can make sense of our silly human language, it first needs to convert it to cold, hard, numerical data like this. As before, this is best understood with a (hopefully entertaining) example.

Consider the below zombie movie graph:


This charts zombie movies based on their speed (horizontal axis) and their intelligence (vertical axis). Besides being hilarious and entertaining it’s also informative for how floating point vectors work. It allows us to convert a mushy humanoid sentiment like, “I would not want to mess with the GoT zombies” to raw emotionless data of [10, 10] which represent the x, y coordinates for Game of Thrones on the chart (assuming a 10pt scale).

Now imagine introducing a third zombie attribute, attractiveness, where a 0 is the classic zombie look of decayed flesh with bulging eyes while 10 is a pleasantly surprised “not bad!” To visualize this third attribute, you can imagine a three-dimensional plot with attractiveness on the z-axis.  Starting to feel a bit confusing, isn’t it? Keeping that three-dimensional plot in your feeble ape brain is straining right? Now try 8,000 dimensions. That is what OpenAI’s embedding models can support. With that scale, just think of all the ways you could classify zombie movies. (Editor’s Note: We like to think Pride and Prejudice and Zombies (2016) scores high across all 8k dimensions)

Plotting language in this high-dimensional space allows computers to “understand” meaning beyond the literal characters in a word. It even lets us do semantic arithmetic! Behold:

words = ["man", "woman", "king", "queen"]
searchable_documents = words + random_words

search_engine = SearchEngine(searchable_documents)

man_embedding, woman_embedding, king_embedding, _ = search_engine.get_vector_embeddings_for_documents(words)

# king - man + woman should approximate a queen!
queen_embedding = king_embedding - man_embedding + woman_embedding






















Viola! Queen is indeed returned as the most similar match for king - man + woman I don’t know about you, but this blows my mind 🤯.

This language embedding technology serves as the basic building block for what makes large language models so powerful.

AI in Healthcare (and at Turquoise)

So how does any of this apply to the healthcare industry? I’ll give you a hint: did you know that thirty percent of all healthcare spending is on admin costs? This is in large part because healthcare data is messy! Think of patient medical histories, lab results, clinician notes, imaging reports, prescriptions, payer contracts, health insurance plans, medicare rules, and on and on.

LLM’s to the rescue! LLMs are the perfect tool for this job, and at Turquoise, we’ve seen firsthand how powerful these tools can be. From automated text summarization, data extraction, and semantic search, to document question and answer ChatGPT style. We’ve layered LLMs into managed care contracting, using it to convert what used to be hours of searching reference information into seconds. In a safe environment, any healthcare administration could use LLMs to optimize admin-heavy processes. We are at the dawn of a new age where we can finally offload the time-consuming drudgery to AI and focus on what really matters in healthcare—helping people lead healthier lives.