Building State of the Art Open Weights Tool Use: The Command R Family

Sandra Kublik, Cohere15:03 · Aug 2024 · 1,895 views
Thumbnail for Building State of the Art Open Weights Tool Use: The Command R Family Watch on YouTube
TL;DR
  1. 1

    Command R is optimized for retrieval-augmented generation, while Command R+ adds stronger tool use and advanced retrieval capabilities.

  2. 2

    Cohere trained the models to decide when external information is needed, retrieve it, use it as grounded context, and provide fine-grained citations.

  3. 3

    Multi-step tool use lets the model plan a sequence of actions, reflect on tool results, retry errors, and change its plan when needed.

Summary

Sandra Kublik introduces Cohere's open-weight Command R family and explains the design choices behind its retrieval and tool-use abilities. Command R targets retrieval-augmented generation, while Command R+ is aimed at tool use and more advanced retrieval. Kublik describes the problems the team worked on, including prompt sensitivity, models over-attending to the start of documents, and conflicts between pretraining knowledge and retrieved information. Post-training teaches the models when to retrieve, how to operate retrieval systems, and how to ground answers with fine-grained citations. She also presents Cohere's open-source toolkit UI, which supports conversation history, document uploads, retrieval, and multiple model access options. The talk then moves from retrieval to single-step and multi-step tool use. In the multi-step API, the model creates a plan, calls tools, reviews their outputs, retries failed calls, and revises the plan. Kublik says Command R+ is three to five times cheaper than comparable models such as Claude 3 Opus and GPT-4 Turbo.

Key ideas
01:20

Command R and Command R+ were released as open-weight models for retrieval and tool use

Cohere released Command R on March 11 with a focus on retrieval-augmented generation and a size that makes it suitable for scalable use. Command R+ followed as a model optimized for tool use and advanced retrieval-augmented generation. Kublik says the models quickly gained attention in the open-source community. Command R+ appeared on the LMC Arena, side projects began trending on OpenRouter, and the model was downloaded 150,000 times from Hugging Face within two weeks. Hugging Face also used it as a base model for HuggingChat, which includes a document parser, image editor, and calculator.

04:48

Retrieval systems need to control where the model looks and what information it trusts

Kublik describes retrieval-augmented generation as difficult because models are highly sensitive to prompts. A useful system must distinguish conversation history from retrieved information and must know where to look for an answer. Models also tend to focus on the beginning of a document, a problem shown by retrieval evaluations such as needle-in-the-haystack tests. Another conflict occurs between knowledge learned during pretraining and information supplied in the prompt. For questions about current events, such as the current US president, the model needs to use up-to-date external information instead of relying on older internal knowledge.

06:07

Post-training teaches Command R when to retrieve and how to ground an answer

Cohere used post-training to shape the model's behavior across the retrieval process. The model learns to decide whether external information is needed, run search queries, retrieve useful information, and use it as context for the conversation. Kublik says the goal is for developers to get this behavior out of the box without having to design every part of the retrieval flow themselves. Citations receive particular attention. Command R and Command R+ generate fine-grained citations so users can check where information came from. Kublik connects this design to lower hallucination and more reliable use of retrieved context.

08:45

Cohere opened a toolkit UI so developers can assemble retrieval applications

Cohere open-sourced its UI on April 24 after finding that building a user experience for retrieval and tool use was difficult. The toolkit includes plug-and-play components and source code for a Next.js interface. It supports conversation history through a small SQL database, document uploads, fine-grained citations, model access through cloud providers, the Cohere platform, local deployments, or Hugging Face, and a retrieval component for tools and data sources. The example retriever uses LangChain and web search, but Kublik says developers can add other tools and data sources.

10:26

Tool use extends the retrieval training approach to broader actions

Kublik describes tool use as an extension of the team's work on retrieval systems and vector databases. Cohere first trained the models to work well with retrieval, then moved toward training them to use a wider range of tools, ideally in zero-shot settings. Single-step tool use fits one action or independent actions, such as searching for a document or sending an email. Multi-step tool use fits a dependent sequence. Her example searches for a document, compares it with another document, summarizes the comparison, and sends the result by email.

12:05

The multi-step API lets the model plan, inspect results, and recover from errors

In sequential multi-step use, the model performs actions where each step depends on the previous one. It can reflect on what happened, correct errors, and retrieve information repeatedly from different data sources. Cohere's multi-step API asks developers to describe the available tools, explain what they do, and provide their parameters. After receiving a user request, the model creates a plan and decides how to use the tools. It then reviews each tool result and changes the plan when needed. If an API call returns an error, the model can retry with a new plan. Kublik says this behavior is described in a large multi-step preamble available on Hugging Face.

13:16

Citations expose the tools and claims behind a model response

Kublik presents transparency as an advantage of the Command R family. The models are trained to generate claims that can be checked through citations. The system can also show which tool was used for each response. This gives users a way to inspect the source of an answer and the actions taken to produce it. Kublik argues that this visibility can make the system better. She says Command R+ has performance competitive with Claude 3 Opus and GPT-4 Turbo while costing three to five times less, which she connects to the practical problem of scaling tool use in production.

"We believe that allowing the user to verify where the information comes from and whether it's trusty is really important."07:22
Who should watch
  • You are building a retrieval application and need the model to decide when to search, use retrieved context, and cite its sources.
  • Your application needs a sequence of dependent tool calls, with retries and plan changes when an API call fails.
  • You want an open-weight model and a ready-made interface that can work with hosted models, local deployments, documents, web search, and custom tools.