查找

公告
· 十月 8, 2024

[Video] Using AI to Automate and Improve Resident Funding in Nursing Homes

Hey Community,

Watch this video to learn how InterSystems partner Mirus uses InterSystems IRIS to deliver clean data from multiple systems and feed a robust AI model that ensures that providers receive full funding for each resident while reducing administrative burden:

⏯ Using AI to Automate and Improve Resident Funding in Nursing Homes @ Global Summit 2024

Presenters:
🗣 Robert Covino, Founder and Partner, Mirus Australia
🗣 Alejandro Moran, Head of AI Development, Mirus Australia  

Subscribe to our YouTube channel InterSystems Developers to get notifications about new videos!

讨论 (0)1
登录或注册以继续
问题
· 十月 8, 2024

Docker build with merge results in error

Hello,

I'm trying to create a custom IRIS4Health docker container utilizing CPF Merge but getting an error below. The merge file has been copied to the container within the docker file. Anybody know what would cause this error?

ERROR: failed to solve: process "/bin/sh -c iris start IRIS && iris merge IRIS mergefile.cpf" did not complete successfully: exit code: 133

1 Comment
讨论 (1)2
登录或注册以继续
问题
· 十月 8, 2024

How to convert IRIS from 8-bit into Unicode ?

I have an IRIS installation that is using 8-bit charset encoding (set to deu8 / Latin 1). I would like to convert everything (database and system)  to Unicode

Charset encoding is something asked during installation, is it possible to change this on the fly ? The installer clearly say that Unicode systems cannot be converted. What about 8 bit ? 

Same for database : is there possible conversion ?

My current plan is the following :

- export all globals from 8-bit instance
- install a new Unicode instance
- import all globals into Unicode instance

Is there a simpler approach ?

5 Comments
讨论 (5)3
登录或注册以继续
文章
· 十月 8, 2024 阅读大约需 4 分钟

LLM Models and RAG Applications Step-by-Step - Part I - Introduction

You have probably heard a lot about LLMs (Large Language Models) and the associated development of RAG (Retrieval Augmented Generation) applications over the last year. Well, in this series of articles we will explain the fundamentals of each term used and see how to develop a simple RAG application.

What is an LLM?

LLM models are part of what we know as generative AI and their foundation is the vectorization of huge amounts of texts. Through this vectorization we will obtain a vector space (excuse the redundancy) in which related words or terms will be closer to each other than to less related words.

Although the simplest way to visualize it is a 3-dimensional graph like the one in the previous image, the number of dimensions can be as large as desired; the greater the dimensions, the greater the precision in the relationships between terms and words and the greater the resource consumption of the same.

These models are trained with massive data sets that allow them to have enough information to be able to generate texts related to the request made to them, but... how does the model know which terms are related to the question asked? Very simple, by the so-called "similarity" between vectors, this is nothing more than a mathematical calculation that allows us to elucidate the distance between two vectors. The most common calculations are:

Through this type of calculation, the LLM will be able to put together a coherent answer based on terms close to the question asked in relation to its context.

All this is very well, but these LLMs have a limitation when it comes to their application for specific uses, since the information with which they have been trained is usually quite "general." If we want an LLM model to adapt to the specific needs of our business, we will have two options:

Fine tuning

Fine tuning is a technique that allows the retraining of LLM models with data related to a specific topic (procedural language, medical terminology, etc.). Using this technique, we can have models that are better suited to our needs without having to train a model from scratch.

The main drawback of this technique is that we still need to provide the LLM with a huge amount of information for such retraining and sometimes this can fall "short" of the expectations of a particular business.

Retrieval Augmented Generation

RAG is a technique that allows the LLM to include the context necessary to answer a given question without having to train or retrain the model specifically with the relevant information.

How do we include the necessary context in our LLM? It's very simple: when sending the question to the model, we will explicitly tell it to take into account the relevant information that we attach to answer the query made, and to do so, we will use vector databases from which we can extract the context related to the question submitted.

What is the best option for my problem, Fine tuning or RAG?

Both options have their advantages and disadvantages. On the one hand, Fine tuning allows you to include all the information related to the problem you want to solve within the LLM model, without needing third-party technologies such as a vector database to store contexts. On the other hand, it ties you to the retrained model, and if it does not meet the model's expectations, migrating to a new one can be quite tedious.

On the other hand, RAG needs features such as vector searches to be able to know which is the most exact context for the question we are passing to our LLM. This context must be stored in a vector database on which we will later perform queries to extract said information. The main advantage (apart from explicitly telling the LLM to use the context we provide) is that we are not tied to the LLM model, being able to change it for another one that is more suited to our needs.

As we have presented at the beginning of the article, we will focus on the development of an application example in RAG (without great pretensions, just to demonstrate how you can start).

Architecture of a RAG project

Let's briefly look at what architecture would be necessary for a RAG project:

On the one hand we will have the following actors:

  • Users : who will interact with the LLM by sending queries.
  • Context : Provided in advance to be included in user queries.
  • Vectorization model : to vectorize the different documents associated with the context.
  • Vector database : in this case it will be IRIS and it will store the different vectorized parts of the context documents.
  • LLM : LLM model that will receive the queries, for this example we have chosen MISTRAL.
  • Python application : intended for querying the vector database for context extraction and its inclusion in the LLM query.

In order not to complicate the diagram too much, I have omitted the application in charge of capturing the documents from the context, their division and subsequent vectorization and insertion. In the associated application you can consult this step as well as the subsequent one related to the query for extraction, but do not worry, we will see it in more detail in the next articles.

Associated with this article you have the project that we will use as a reference to explain each step in detail. This project is containerized in Docker and you can find a Python application using Jupyter Notebook and an instance of IRIS. You will need an account in MISTRAL AI to include the API Key that allows you to launch queries.

In the next article we will see how to register our context in a vector database. Stay tuned!

1 Comment
讨论 (1)1
登录或注册以继续
文章
· 十月 8, 2024 阅读大约需 5 分钟

Modelos LLM y aplicaciones RAG paso a paso - Parte I - Introducción

Seguramente hayáis oído en el último año hablar continuamente de los LLM (Large Language Model) y el desarrollo asociado a los mismos de las aplicaciones RAG (Retrieval Augmented Generation), pues bien, en esta serie de artículos desgranaremos los fundamentos de cada término utilizado y veremos como desarrollar una sencilla aplicación RAG.

¿Qué es un LLM?

Los modelos LLM forman parte de lo que conocemos como IA generativa y su fundamento es la vectorización de gigantescas cantidades de textos. Mediante esta vectorización obtendremos un espacio vectorial (valga la redundancia) en las que palabras o términos relacionadas estarán más próximas entre si que respecto a palabras menos relacionadas.

Si bien la forma más sencilla de visualizarlo es un gráfico de 3 dimensiones como el de la anterior imagen el número de dimensiones podrá ser tan grande como se desee, a mayores dimensiones más precisión en las relaciones entre términos y palabras y mayor consumo de recursos del mismo.

Estos modelos son entrenados con conjuntos masivos de datos que les permite disponer de la información suficiente para poder generar textos relacionados con la petición que se les haga, pero... ¿cómo sabe el modelo que términos están relacionados con la pregunta realizada? Muy sencillo, por la llamada "similitud" entre vectores, esto no es más que un cálculo matemático que nos permite dilucidar la distancia que hay entre dos vectores. Los cálculos más comunes son:

Mediante ese tipo de cálculo el LLM podrá montar una respuesta coherente basada en términos próximos a la pregunta realizada en relación a su contexto.

Todo esto está muy bien, pero estos LLM tienen una limitación de cara a su aplicación para usos específicos ya que la información con la que han sido entrenados suele ser bastante "general", si deseamos que un modelo LLM se adapte a las necesidades específicas de nuestro negocio tendremos dos opciones:

Fine tuning

El fine tuning es una técnica que permite el reentrenado de modelos LLM con datos relativos a una temática en específico (lenguaje procesal, terminología médica, etc). Mediante esta técnica se podrá disponer de modelos más ajustados a nuestra necesidad sin tener que entrenar un modelo desde 0.

La principal pega de esta técnica es que todavía necesitamos proporcionarle al LLM una cantidad ingente de información para dicho reentrenamiento y en ocasiones este puede quedarse "corto" para las expectativas de un determinado negocio.

Retrieval Augmented Generation

El RAG es una técnica que permite incluir al LLM el contexto necesario para contestar a una determinada pregunta sin necesidad de entrenar o reentrenar al modelo específicamente con la información relevante.

¿Cómo incluimos el contexto necesario a nuestro LLM? Muy sencillo, en el momento de enviar la pregunta al modelo le indicaremos explícitamente que tenga en consideración la información relevante que adjuntamos para contestar a la consulta realizada y para ello haremos uso de bases de datos vectoriales de las que podamos extraer el contexto relacionado con la pregunta remitida.

¿Cual es la mejor opción para mi problemática, Fine tuning o RAG?

Ambas opciones tienen sus ventajas y sus inconvenientes, por un lado el Fine tuning te permite incluir dentro del modelo LLM toda la información relativa al problema que quieres resolver, no necesitando de terceras tecnologías como puede ser una base de datos vectorial donde almacenar contextos, pero por otra parte te ata al modelo reentrenado, y si este no cubre las espectativas del mismo la migración a uno nuevo puede ser bastante tedioso.

Por otra parte RAG necesita de funcionalidades como las búsquedas vectoriales para poder conocer cual es el contexto más exacto a la pregunta que estamos pasando a nuestro LLM. Este contexto deberá almacenarse en una base de datos vectorial sobre la que posteriormente realizaremos consultas para extraer dicha información. La principal ventaja (a parte de indicarle al LLM explicitamente que utilice el contexto que le proporcionamos) es que no estamos atados al modelo LLM, pudiendo cambiarlo por otro que sea más ajustado a nuestras necesidades.

Como hemos presentado al comienzo del artículo, nos centraremos en el desarrollo de un ejemplo de aplicación en RAG (sin grandes pretensiones, sólo demostrar como podéis empezar).

Arquitectura de un proyecto RAG

Veamos de forma somera cual sería la arquitectura necesario para un proyecto RAG:

Por un lado tendremos los siguientes actores:

  • Usuarios: que interactuarán con el LLM enviando consultas.
  • Contexto: proporcionado previamente para incluirlo en las consultas del usuario.
  • Modelo de vectorización: para vectorizar los diferentes documentos asociados al contexto.
  • Base de datos vectorial: en este caso será IRIS y almacenará las diferentes partes de los documentos de contexto vectorizadas.
  • LLM: modelo LLM que recibirá las consultas, para este ejemplo hemos elegido MISTRAL.
  • Aplicación Python: destinada a la consulta sobre la base de datos vectorial para la extracción del contexto y su inclusión en la consulta al LLM.

Para no enredar demasiado el diagrama he obviado la aplicación encargada de la captura de los documentos del contexto, de su troceo y posterior vectorización e inserción. En la aplicación asociada podréis consultar este paso así como el posterior relativo a la consulta para la extracción, pero no os preocupéis, lo veremos con más detalle en los próximos artículos.

Asociado a este artículo tenéis el proyecto que usaremos como referencia para explicar con detalle cada paso, dicho proyecto está contenerizado en Docker y podéis encontrar una aplicación en Python haciendo uso de Jupyter Notebook y una instancia de IRIS. Necesitaréis una cuenta en MISTRAL AI para incluir la API Key que os permita el lanzamiento de consultas.

En la próxima entrega veremos como registrar nuestro contexto en una base datos vectorial. ¡Permanezcan a la escucha!

1 Comment
讨论 (1)1
登录或注册以继续