2023-07

2023-07-18 Accessing Llama 2 from the command-line with the llm-replicate plugin

The big news today is Llama 2, the new openly licensed Large Language Model from Meta AI. It’s a really big deal :

Llama 2 is available for free for research and commercial use.

(swyy spotted that it was rebranded from LLaMA 2 to Llama 2 a few hours ago.)

Facebook’s original LLaMA model, released in February, kicked off a seismic wave of innovation in the world of open source LLMs—from fine-tuned variants to from-scratch recreations.

I wrote about the impact this was having a few weeks after its original release in Large language models are having their Stable Diffusion moment.

If anything I under-estimated how significant this was going to be.

There was just one catch: you couldn’t use it for commercial purposes.

That’s changed with Llama 2!

It does still have a couple of interesting limitations, emphasis mine:

You will not use the Llama Materials or any output or results of the
Llama Materials to improve any other large language model (excluding
Llama 2 or derivative works thereof).

If, on the Llama 2 version release date, the monthly active users of
the products or services made available by or for Licensee, or Licensee’s
affiliates, is greater than 700 million monthly active users in the
preceding calendar month, you must request a license from Meta, which
Meta may grant to you in its sole discretion[...]

This still makes it available for most commercial purposes. Let’s try it out. Accessing Llama 2 using LLM

My LLM tool provides command-line access to a wide variety of language models, both via web APIs and self-hosted on your own machine.

Last week I added plugin support for extending it to support new models.

An independently released plugin can now add support for new models to the existing CLI tool.

The brand new llm-replicate plugin provides CLI access to models hosted on Replicate, and this morning a16z-infra released a16z-infra/llama13b-v2-chat which provides Replicate API access to the new Llama 2 13B chat model.

You’ll need a Replicate API key.

Install LLM like this:

pip install llm
(I like to use pipx.)

Or if you don’t have pip setup but can use Homebrew:

brew install simonw/llm/llm

Run llm –version to confirm it’s installed.

Replicate

Next, install the llm-replicate plugin:

llm install llm-replicate

The plugin adds a new llm replicate set of commands—see them with llm –help.

Avertissement

Welcome to Replicate!

Next, you’ll want to: Enter your credit card Use an API token to run models

Pricing

You can use Replicate for free, but after a bit you’ll be asked to enter your credit card. You pay by the second for the predictions you run. The price per second varies based on the hardware the model is run on.

Configure your Replicate API key so the plugin can talk to the API:

llm keys set replicate
Enter key: <paste key here>

Register the new a16z-infra/llama13b-v2-chat model with the plugin:

llm replicate add a16z-infra/llama13b-v2-chat

–chat –alias llama2

This tells the plugin that it’s a “chat” model, which means you can have continuing conversations with it, rather than just sending single prompts.

Now we can send a prompt, using the llama2 alias we configured there:

llm -m llama2 "Ten great names for a pet pelican"

What’s next

I’m really excited about Llama 2. I expect we’ll start seeing all kinds of innovation on top of it as the model weights themselves start to roll out.

I’m particularly looking forward to:

  • The fine-tuned models. Alpaca, Vicuna et-al did amazing things with fine-tuning on top of the original LLaMA. I expect we’ll see dozens of fine-tuned models over the next few weeks.

  • Implementation of the reAct and Toolformer patterns, which will enable Llama 2 to drive external tools in a similar way to OpenAI Functions.

    The Llama 2 paper mentions testing against Toolformer prompts already, so this hopefully won’t be too difficult.

Hopefully this time we’ll start to see a concerted effort from people to document what kind of prompts work well with Llama 2 for practical purposes, since I expect this model will be an influential piece of the ecosystem for some time to come .

2023-07-18 Introducing Llama 2

The next generation of our open source large language model Llama 2 is available for free for research and commercial use.

2023-07-16 Self-hosted language models with LLM plugins, a new Datasette tutorial, a dozen package releases, a dozen TILs

LLM and self-hosted language model plugins

My biggest project was the new version of my LLM tool for interacting with Large Language Models. LLM now accepts plugins for adding alternative language models to the tool, meaning it’s now applicable to more than just the OpenAI collection.

2023-07-04 huggingface: The AI community building the future ( https://github.com/huggingface )

2023-07-04 The LLMentalist Effect: how chat-based Large Language Models replicate the mechanisms of a psychic’s con By Baldur Bjarnason

For the past year or so I’ve been spending most of my time researching the use of language and diffusion models in software businesses.

One of the issues in during this research—one that has perplexed me—has been that many people are convinced that language models, or specifically chat-based language models, are intelligent.

But there isn’t any mechanism inherent in large language models (LLMs) that would seem to enable this and, if real, it would be completely unexplained.

LLMs are not brains and do not meaningfully share any of the mechanisms that animals or people use to reason or think.

LLMs are a mathematical model of language tokens .

You give a LLM text, and it will give you a mathematically plausible response to that text.

There is no reason to believe that it thinks or reasons—indeed, every AI researcher and vendor to date has repeatedly emphasised that these models don’t think.

There are two possible explanations for this effect:

  • The tech industry has accidentally invented the initial stages a completely new kind of mind, based on completely unknown principles, using completely unknown processes that have no parallel in the biological world.

  • The intelligence illusion is in the mind of the user and not in the LLM itself.

Many AI critics, including myself, are firmly in the second camp.

It’s why I titled my book on the risks of generative “AI” The Intelligence Illusion .

2023-07-03 Le colloque « Penser et créer avec les IA génératives » par bortzmeyer

Les 29 et 30 juin 2023, j’ai eu le plaisir de suivre le colloque « Penser et créer avec les IA génératives » . C’était très riche, donc je ne vais pas pouvoir vous raconter tout mais voici quelques informations quand même.

Un petit rappel sur ces « IA génératives ».

Ce sont les systèmes logiciels qui permettent de générer textes, sons et images, de manière « intelligente » (le I de IA), ou en tout cas ressemblant beaucoup à ce que pourrait faire un être humain.

Les plus connues sont dans doute ChatGPT pour le texte et Midjourney pour l’image.

Le domaine est en pleine expansion depuis quelques années, avec le développement de plusieurs modèles de langages (LLM), et a connu une grand succès médiatique avec la sortie de ChatGPT fin 2022. (J’ai écrit un court article sur ChatGPT et un plus long sur son utilisation pour la programmation.)

Depuis, on voit apparaitre de nombreux projets liés à ces IA génératives.

Rappelons aussi (ça va servir pour les discussions sur l”« ouverture » et la « régulation ») qu’un système d’IA générative repose sur plusieurs composants :

  • Un corpus de textes (ou d’images) sur lequel le système s’entraine (comme Common Crawl ). Le choix de ce corpus est crucial, et beaucoup de LLM ne sont pas très bavards sur la composition de leur corpus.

  • Des détails pratiques sur l’utilisation du corpus, comment il est analysé et digéré. Cette condensation du corpus en un modèle est une opération lourde en ressources informatiques.

  • À ce stade, on a le LLM (le grand modèle de langage). Celui de ChatGPT se nomme GPT mais il y en a beaucoup d’autres comme LLaMA ou Bloom. Il reste à le faire tourner pour générer des textes, en réponse à une requête (appelée prompt), ce qui nécessite un autre logiciel, le moteur, souvent moins consommateur de ressources mais qui tourne plus souvent.

Frédéric Kaplan a fait un intéressant exposé sur la notion de « capital linguistique » et le risque posé par la confiscation de ce capital par un petit nombre de gros acteurs.

En récoltant d’énormes corpus, ces gros acteurs accumulent du capital linguistique, et peuvent même le vendre (vente de mots-clés par Google pour l’affichage des publicités).

« L’économie de l’attention n’existe pas, c’est une économie de l’expression. » Une des conséquences de cette accumulation est qu’elle fait évoluer la langue. L’autocomplétion, qu’elle soit sous sa forme simple traditionnelle, ou sous sa forme sophistiquée des IA génétatives va changer la langue en encourageant fortement telles ou telles formes.

« Ce n’est pas par hasard que Google se nomme désormais Alphabet. »

Cela n’a pas que des conséquences négatives, cela peut aussi être un facteur d’égalité ; si vous ne savez pas bien écrire, la prothèse (ChatGPT) peut le faire pour vous, vous permettant de réussir malgré Bourdieu.

Mais il est quand même perturbant que, dans le futur, on ne saura peut-être plus écrire un texte tout seul.

La langue ne nous appartient plus, elle est louée (un peu comme dans la nouvelle « Les haut-parleurs » de Damasio.) Cela sera marqué par une rupture dans les textes, on aura des textes écrits avant 2015, avec peu ou pas d’intervention technique, et des textes produits via un outil comme ChatGPT. Bref, les futures évolutions de la langue ne se feront pas comme avant : elles seront en mode centralisé, alos que les évolutions de la langue étaient auparavant décentralisées.

Est-ce que l’université va devenir l’endroit où on conserve de la ressource primaire (« bio ») ?

Tout·e utilisateurice de ChatGPT a pu observer que la rédaction de la question (le prompt) avait une grande importance pour la qualité de la réponse obtenue.

Valentin Goujon a noté dans son exposé que « Pour avoir les bonnes réponses, il faut poser les bonnes questions » et que savoir écrire un prompt allait devenir une compétence utile (voire, a-t-il spéculé, un métier en soi, AI whisperer).

Il y a eu aussi des exposés plus austères (pour moi) comme celui de Célia Zolynski sur la régulation de l’IA. Le droit, ce n’est pas toujours passionnant mais, ici, c’était pertinent puisque, comme vous le savez, il y a un projet européen (qui est loin d’être abouti) d’une directive de régulation de l’IA. Cette directive, en développement depuis des années, ne prévoyait pas à l’origine le cas des IA génératives, mais ça a été ajouté par un amendement au parlement européen, le 14 juin 2023.

Mais elle a aussi parlé de questions liées au droit d’auteur.

Si les philosophes discutent pour savoir si l’IA est vraiment créative, les juristes ont tranché : seul·e un·e humain·e peut bénéficier du droit d’auteur.

Un texte écrit par ChatGPT n’a donc pas de protections particulières. (La question de savoir si l’auteur·e de la requête, qui a parfois dû fournir un réel travail, a des droits sur le texte produit reste ouverte.)