> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# FAQ Solution

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

[localhost link]: http://localhost:3000/docs/4/fusion-ai/concepts/smart-answers/faq-solution

[mintlify link]: https://doc.lucidworks.com/docs/4/fusion-ai/concepts/smart-answers/faq-solution

[old doc.lw link]: https://doc.lucidworks.com/fusion/5.9/464

Smart Answers model training and deployment with an existing FAQ

<img src="https://mintcdn.com/lucidworks/1R8QVvJzt46cZDT6/assets/images/4.2/diagrams/QnA-FAQ-solution-flow.png?fit=max&auto=format&n=1R8QVvJzt46cZDT6&q=85&s=ae855e677f77aa04b470b7fac2fa10e8" alt="FAQ solution flow" width="1981" height="1250" data-path="assets/images/4.2/diagrams/QnA-FAQ-solution-flow.png" />

The FAQ solution consists of two parts:

1. **FAQ Solution Part 1**\
   Model training is performed in a Docker image, downloaded from the Lucidworks Docker hub. The deep learning/word vector training modules and configuration UI are installed in the Docker image, and it can be used on-prem or in the cloud.\
   After training is finished, two `.zip` files are generated which each include a model and associated files. The model is basically an encoder which transforms documents into digital vectors which can be used to measure similarities.
2. **FAQ Solution Part 2**\
   The deployment part is performed in Fusion:

<AccordionGroup>
  <Accordion title="FAQ Solution Part 1">
    The [FAQ solution for Smart Answers](/docs/4/fusion-ai/concepts/smart-answers/faq-solution) begins with training a model using your existing data, as explained in this topic. Once you have trained a model, you can deploy it.

    <img src="https://mintcdn.com/lucidworks/1R8QVvJzt46cZDT6/assets/images/4.2/diagrams/QnA-FAQ-model-training.png?fit=max&auto=format&n=1R8QVvJzt46cZDT6&q=85&s=3efc8ea9726a1f069206ce46aeacf8a1" alt="FAQ model training" width="1742" height="453" data-path="assets/images/4.2/diagrams/QnA-FAQ-model-training.png" />

    See also [Advanced Model Training Configuration for Smart Answers](/docs/4/fusion-ai/concepts/smart-answers/smart-answers-advanced-model-config).

    <LwTemplate />

    ## Prerequisites

    You need a [Docker Hub](https://hub.docker.com/) account with access to the `lucidworks/ai-lab` repository. Contact Lucidworks AI Labs with your Docker Hub account name to gain access to this repository.

    ## Hardware requirements and instance setup

    The Docker training module can run on either a CPU or a GPU.

    CPU is sufficient for most use cases.

    GPU is 2-8 times faster. GPU is recommended if want to try our model auto-tune feature on a large dataset (e.g. over 20k QA pairs) or if the training data size is over 1 million entries for any of the training scenarios.

    You can run the Docker image either on-prem or in the cloud. We recommend a minimum of 32GB RAM and 32 cores for a CPU server or a cloud instance. If you choose a GPU machine, one GPU with 11GB memory is sufficient for most training use cases.

    Below are examples of the AWS instance types that we recommend:

    **CPU:**

    * AMI: Ubuntu Server 18.04 LTS (HVM), SSD Volume Type
    * Instance Type: c5.9xlarge (36 vCPUs, 72 GB RAM)
    * Recommended storage volume: Suggested 150GB plus 2.5 times the total input data size
    * Networking
      * Allow inbound port 4440
      * Allow inbound port 5550

    **GPU:**

    * AMI: Deep Learning AMI (Ubuntu) Version 22.0
    * Instance Type: p2.xlarge (11.75 ECUs, 4 vCPUs, 61 GB RAM, EBS only)
    * Recommended storage volume: Suggested 150GB plus 2.5 times of total input data size.
    * Networking
      * Allow inbound port 4440
      * Allow inbound port 5550

    Below are examples of the Azure GPU instance type that we recommend:

    * Deep Learning Virtual Machine
    * Linux OS
    * VM Size: 1x Standard NC6 (6 vcpus, 56 GB memory)
    * Recommended OS Disk Size: Suggested 150GB plus 2.5 times the total input data size
    * Networking
      * Allow inbound port 4440
      * Allow inbound port 5550

    ## Docker image setup

    1. Determine the instance’s external hostname.
       Refer to your cloud provider’s documentation for instructions on how to do this.
    2. Create a directory, such as `/opt/faq_training`, and ensure it meets [disk space requirements](#hardware-requirements-and-instance-setup). Also ensure that it is writable by the `docker` Linux user account.
       The training Docker container requires this directory to read input files, write temporary files, and write the output (deep learning models).
    3. Run `docker login` and enter your account credentials.
    4. Pull the `lucidworks/ai-lab:latest` image:
       ```bash theme={"dark"}
       docker pull lucidworks/ai_lab:latest
       ```
    5. Run the Docker image:\
       For GPU instance:
       ```bash theme={"dark"}
       docker run -d --rm \
               -e "RD_HOSTNAME=<external hostname here>" \
               -e "ENABLE_GPU=1" \
               --name deep_faq \
               -v <working directory here>:/src/DL/working_dir \
               --net=host \
               --runtime=nvidia \
               lucidworks/ai_lab:latest
       ```
       For CPU-only instance:
       ```bash theme={"dark"}
       docker run -d --rm \
               -e "RD_HOSTNAME=<external hostname here>" \
               --name deep_faq \
               -v <working directory here>:/src/DL/working_dir \
               --net=host \
               lucidworks/ai_lab:latest
       ```
       This starts the Docker container in the background.
    6. Wait about one minute for the container to initialize.\
       In your working directory, you should see these directories:
       ```bash theme={"dark"}
       conf   data   input   models   output   rundeck
       ```
       * The `input` directory is where all training data and input files should be placed.
       * The `output` directory contains the models that result from the training.
       * All other directories are used by the model training container to save persistent files or temporary files.
         <Tip>     You can clear the `data` folder periodically to save disk space.</Tip>
    7. Point your browser to `http://<external hostname>:4440`.
       This redirects you to a Rundeck login screen.
    8. Log in with your username and password.

    ## Running Jobs

    We use [https://www.rundeck.com/](https://www.rundeck.com/) to control job runs.

    1. When Rundeck has started, click on the `deep_faq` project.\
       This opens the **JOBS** panel, where you will see three jobs for different training scenarios and one job for query pipeline evaluation.

       * Click on a job to configure job parameters.
       * Click **Run Job Now** to start the job.
       * You can monitor the progress of a job by clicking on the **running** button under the **Activity for Jobs** section as shown in the screenshot below.

    <Note>If similar jobs have run before, then Rundeck estimates the total run time and displays a progress bar.</Note>

    <img src="https://mintcdn.com/lucidworks/1R8QVvJzt46cZDT6/assets/images/4.2/qna-rundeck-jobs.png?fit=max&auto=format&n=1R8QVvJzt46cZDT6&q=85&s=329b48d8a56371a88fb94862fa403218" alt="Rundeck Jobs page" width="2562" height="1280" data-path="assets/images/4.2/qna-rundeck-jobs.png" />

    You can click on the running job to enter the activity control page, where you can kill the job or watch the log output.

    If you want to reuse the previously-configured job, click the **recent** button under **Activity for Jobs**.

    <img src="https://mintcdn.com/lucidworks/1R8QVvJzt46cZDT6/assets/images/4.2/qna-rundeck-recent.png?fit=max&auto=format&n=1R8QVvJzt46cZDT6&q=85&s=b7e27f9f5ae9d0a6af67df7cc168f720" alt="Recent Jobs" width="2562" height="862" data-path="assets/images/4.2/qna-rundeck-recent.png" />

    Select a recent job configuration that you want to modify, then click the button to enter the configuration page with previously-entered values.

    For more details about Rundeck job control, refer to the [Rundeck documentation](https://docs.rundeck.com/docs/manual/04-jobs.html).

    ### Input data format

    * FAQ data format

      The expected FAQ input is Q\&A pairs, that is, a question and its corresponding answer in each row. If there are multiple possible answers for a unique question, then repeat the questions and put the Q\&A pair into different rows to make sure each row has one question and one answer. Specify the question and answer field names in the **Question field name** and **Answer field name** parameters in the job configuration, respectively.

      <Tip>  Be sure that your data has the correct JSON format such as in this example:</Tip>

    ```json wrap theme={"dark"}
      [{"question":"How to transfer personal auto lease to business auto lease?","answer":"I would approach the lender that you are getting the lease from..."} +
        {"question":"How to transfer personal auto lease to business auto lease?","answer":"See what the contract says about transfers or subleases..."}]
    ```

    * Content document input data format

      If you choose to generate customized embeddings (as described [below](#training-scenarios-and-important-configuration-parameters)), then put the documents from which you want to learn the vocabulary into one or multiple fields and specify the field name in the **Field which contains the content documents** parameter.

    <Check>For both methods, we only support Parquet and JSON files. Make sure your data filename ends with either `.parquet` or `.json`.</Check>

    ### Training scenarios and important configuration parameters

    There are three main scenarios supported by three different jobs in the `deep_faq` project:

    * If you have FAQ records available for training and want to use our auto-tune feature to automatically find the best model through hyper-parameter search, click on the **Training with FAQ using autoTune** job.

      <Note>  We recommend using GPU for auto-tune if the FAQ data size is over 20k. GPU training speed for auto-tune can be 2 to 6 times faster than CPU. Specify whether you have GPU using the **GPU available** parameter.</Note>
    * If you have FAQ records available for training and want to tune the model yourself, click on the **Training with FAQ** job.

      Only one set of hyper-parameters, which are specified in the UI, will be used to run the model. If you have a big dataset but do not have GPU, you can consider running this job using default parameter settings, or run autoTune mode once to help find best parameters, then use the found parameter in this job in future model updates.
    * If you don’t have FAQ records and want to use our cold start solution, click on the **Cold Start solution** job.

      This job can learn about the vocabulary that you want to search against through Word2vec. And we can combine Solr with Word2vec at query time using our query pipeline.

    ### Input data parameters

    * For training on FAQ data, these parameters are required:
      * QA pair file name
      * Question field name
      * Answer field name
    * For cold start solution input, these parameters are required:
      * Content documents file name
      * Field which contains the content documents

    For each of the [three scenarios above](#training-scenarios-and-important-configuration-parameters), there are two vocabulary learning options:

    * You can use the pre-trained word embeddings shipped with our training module.

      In the FAQ solution, these pre-trained word embeddings transfer words into embeddings for initialization of the deep learning model.

      In cold start mode, it gets the Word2vec vectors from the pre-trained file directly. The pre-trained word embeddings are built on a large corpus from the Internet, covering common words we use daily.
    * If there are many domain-specific words or special tokens in your documents, we recommend training Word2vec using your own data.

      Set the **Generate customized embeddings** parameter to true to train from your own data. This uses the data and field specified in **Content documents file name** and **Field which contains the content documents** to train Word2vec vectors. This dataset can be the same as the FAQ input. If that’s the case, then set the **Content documents file name** parameter to blank. Otherwise you can specify a different dataset, especially when the FAQ dataset is small.

    <Tip>When you use the pre-trained embeddings, the log shows the percentage of covered vocabulary words (search for vocab coverage by embeddings in the log). If the number of covered vocabulary words is less than 80%, then you should train Word2vec from your own data.</Tip>

    <Note>For all training scenarios, you must provide a **Model name** for model tracking and version control purposes. If you use the same model name across different runs, the new model will replace the old model with the same name.</Note>

    See also the [Advanced Model Training Configuration for Smart Answers](/docs/4/fusion-ai/concepts/smart-answers/smart-answers-advanced-model-config).

    ### Result models

    Track the running steps in the log, which provides information on data pre-processing, training steps, evaluations, and model generation in the end.

    After training is finished, the final models and their associated files are saved in zip file format, which can be downloaded from `http://<external hostname>:5550/{modelName}`.

    Download the two zipfiles ending with `_a_fusion_model_bundle.zip` and `_q_fusion_model_bundle.zip` to be used in the model deployment phase.
  </Accordion>

  <Accordion title="FAQ Solution Part 2">
    The Smart Answers deployment procedure for the FAQ solution and the cold start solution is the same:

    1. [Upload the question and answer models](#how-to-upload-the-models-to-the-blob-store) to the blob store.
    2. [Configure the `question-answering` index pipeline](#configure-the-index-pipeline) so that it uses the answer model.
    3. [Configure the `question-answering` query pipeline](#configure-the-query-pipeline) so that it uses the question model.

           <img src="https://mintcdn.com/lucidworks/1R8QVvJzt46cZDT6/assets/images/4.2/diagrams/QnA-FAQ-model-deployment.png?fit=max&auto=format&n=1R8QVvJzt46cZDT6&q=85&s=1716ffd1ffae0a2e846075ef0334ddfa" alt="FAQ model deployment" width="1981" height="738" data-path="assets/images/4.2/diagrams/QnA-FAQ-model-deployment.png" />

    See also [Best Practices](/docs/4/fusion-ai/concepts/smart-answers/best-practices).

    ## How to upload the models to the blob store

    Two model files are generated by the model training Docker job:

    * `x_a_fusion_model_bundle.zip` - The answer model.
    * `x_q_fusion_model_bundle.zip` - The question model.

    Both files must be deployed to the Fusion [blob store](/docs/4/fusion-server/concepts/indexing/blob-storage).

    **How to upload the deep-learning models to the blob store**

    1. In the Fusion UI, navigate to **System** > **Blobs**.
    2. Click **Add** > **ML Model**.
    3. Click **Choose File** and select one of the model files.
    4. Make sure the **Is Mleap?** checkbox is selected.

           <img src="https://mintcdn.com/lucidworks/1R8QVvJzt46cZDT6/assets/images/4.2/qna-model-upload1.png?fit=max&auto=format&n=1R8QVvJzt46cZDT6&q=85&s=bf6de4fc890857570669512d4e4add1a" alt="Add a blob" width="2562" height="1280" data-path="assets/images/4.2/qna-model-upload1.png" />
    5. Click **Upload**.

           <img src="https://mintcdn.com/lucidworks/1R8QVvJzt46cZDT6/assets/images/4.2/qna-model-upload2.png?fit=max&auto=format&n=1R8QVvJzt46cZDT6&q=85&s=b7f0baecc658db47c9cbbb0770276d03" alt="Uploaded blob" width="2562" height="1280" data-path="assets/images/4.2/qna-model-upload2.png" />
    6. Repeat steps 2-5 for the other model file.

    ## Fusion configuration overview

    * Fusion index pipeline

      The index pipeline uses the trained model in `x_a_fusion_model_bundle.zip` to generate dense vectors for the documents to be indexed.
    * Fusion query pipeline

      The query pipeline uses the trained model in `x_q_fusion_model_bundle.zip` to generate dense vectors for incoming questions on the fly, then compare those with the indexed dense vectors for answers to find answers, or with the indexed dense vectors for historical questions to find similar questions.

    Another option is to have two separate index stages, one for questions and another for answers. Then, at query time, two query stages compute query-to-question distance and query-to-answer distance. Both scores are ensembled into a final similarity score. The two options are illustrated in [Pipeline setup examples](#pipeline-setup-examples).

    ## How to configure the default pipelines

    If you have an AI license, then the following default index and query pipelines are included in any newly-created Fusion app:

    | Default index pipelines                                                                                                                                                      | Default query pipelines                                                                                                                                                                                                                                                                                              |
    | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `question-answering`: For encoding one field.                                                                                                                                | `question-answering`: Calculates vectors distances between an encoded query and one document vector field. Should be used together with `question-answering` index pipeline.                                                                                                                                         |
    | `question-answering-dual-fields`: For encoding two fields (question and answer pairs, for example). See [Configure the index pipeline](#configure-the-index-pipeline) below. | `question-answering-dual-fields`: Calculates vectors distances between an encoded query and two document vector fields. After that, scores are ensembled. Should be used together with the `question-answering-dual-fields` index pipeline. See [Configure the query pipeline](#configure-the-query-pipeline) below. |

    ### Configure the index pipeline

    <img src="https://mintcdn.com/lucidworks/NR6PWuMFSzL-y-FO/assets/images/4.2/QnA-index-pipeline.png?fit=max&auto=format&n=NR6PWuMFSzL-y-FO&q=85&s=06a8a73cd59ab80fb404bf7db981e6c1" alt="question-answering default index pipeline" width="600" height="264" data-path="assets/images/4.2/QnA-index-pipeline.png" />

    1. Open the Index Workbench.
    2. Load or create your datasource using the default question-answering index pipeline.
    3. In the [TensorFlow Deep Encoding stage](/docs/4/fusion-ai/reference/index-pipeline-stages/tensorflow-deep-encoding-index-stage), change the value of **TensorFlow Deep Learning Encoder Model ID** to the model ID of the `x_a_fusion_model_bundle.zip` model that was uploaded to the blob store.

       <Tip>   The `_a_` (answer) model allows you to encode longer text.</Tip>
    4. Change **Document Feature Field** to the document field name to be processed and encoded into dense vectors.
    5. Save the datasource.
    6. Index your data.

    ### Configure the query pipeline

    <img src="https://mintcdn.com/lucidworks/NR6PWuMFSzL-y-FO/assets/images/4.2/QnA-query-pipeline.png?fit=max&auto=format&n=NR6PWuMFSzL-y-FO&q=85&s=f7d264e163592dc5bdb5ba5875301dc4" alt="question-answering default query pipeline" width="612" height="597" data-path="assets/images/4.2/QnA-query-pipeline.png" />

    1. Open the Query Workbench.
    2. Load or create your datasource using one of the default question-answering query pipelines.
    3. In the [Query Fields stage](/docs/4/fusion-server/reference/pipeline-stages/query/search-fields-query-stage), update **Return Fields** to return additional fields that should be displayed with each answer, such as fields corresponding to title, text, or ID.\
       It is recommended that you remove the asterisk (`*`) field and specify each individual field you want to return, as returning too many fields will affect runtime performance.\
       Do not remove `compressed_document_vector_s`, `document_clusters_ss`, and `score` as these fields are necessary for later stages
    4. In the [TensorFlow Deep Encoding stage](/docs/4/fusion-ai/reference/query-pipeline-stages/tensorflow-deep-encoding-query-stage), change **TensorFlow Deep Learning Encoder Model ID** value to the model ID of the `x_q_fusion_model_bundle.zip` model that was uploaded to the blob store.

       <Tip>   The (`_q_`) (question) model is slightly more efficient for short natural-language questions.</Tip>
    5. Save the query pipeline.

    ## Pipeline Setup Examples

    ### Example 1: Index and retrieve question and answer separately

    Based on your search Web page design, you can put best-matched questions and answers in separate sections, or if you only want to retrieve answers and serve to chatbot app, please index them separately in different documents.

    For example, in the picture below, we construct the input file for the index pipeline such that the text part of the question/answer is stored in `text_t`, and we add an additional field `type_s` whose value is "question" or "answer" to separate the two types.

    In the TensorFlow Deep Encoding stage, we specify **Document Feature Field** as `text_t` so that `compressed_document_vector_s` is generated based on this field.

    At search time, we can apply a filter query on the `type_s` field to return either a question or an answer.

    You can achieve a similar result by using the default `question-answering` index and query pipelines.

    ### Example 2: Index and retrieve question and answer together.

    If you prefer to show question and answer together in one document (that is, treat the question as the title and the answer as the description), you can index them together in the same document. It’s similar to the `question-answering-dual-fields` index and query pipelines default setup.

    For example, in the picture below, we added two TensorFlow Deep Encoding stages and named them Answers Encoding and Questions Encoding respectively. In the Questions Encoding stage, we specify **Document Feature Field** to be question\_t, and changed the default values for **Vector Field**, **Clusters Field** and **Distances Field** to question\_vector\_ds, question\_clusters\_ss and question\_distances\_ds respectively. In the Answers Encoding stage, we specify **Document Feature Field** to be answer\_t, and changed the default values for **Vector Field**, **Clusters Field** and **Distances Field** to answer\_vector\_ds, answer\_clusters\_ss and answer\_distances\_ds respectively. (Detailed information of the above field setup please refer to the “Appendix C: Detailed Pipeline Setup” section.)

    Since we have two dense vectors generated in the index (compressed\_question\_vector\_s and compressed\_answer\_vector\_s), at query time, we need to compute query to question distance and query to answer distance. This can be setup as the picture shown below. We added two **Vectors distance per Query/Document** stages and named them QQ Distance and QA Distance respectively. In the QQ Distance stage, we changed the default values for **Document Vector Field** and **Document Vectors** **Distance Field** to compressed\_question\_vector\_s and qq\_distance respectively. In the QA Distance stage, we changed the default values for **Document Vector Field** and **Document Vectors** **Distance Field** to compressed\_answer\_vector\_s and qa\_distance respectively. (Detailed information of the above field setup please refer to the “Appendix C: Detailed Pipeline Setup” section.)

    Now we have two distances (query to question distance and query to answer distance), we can ensemble them together with Solr score to get a final ranking score. This is recommended especially when you have limited FAQ dataset and want to utilize both question and answer information. This ensemble can be done in the **Compute mathematical expression** stage as shown below.

    ## Query pipeline evaluation

    Stages and configurations of the query pipeline will impact ranking results. For example, we may need to make decisions about whether to use clustering option in the [TensorFlow Deep Encoding stage](/docs/4/fusion-ai/reference/query-pipeline-stages/tensorflow-deep-encoding-query-stage), what should be the weights of each ranking score in the **Compute mathematical expression** stage, whether adding other Fusion stages (such as text tagger, ML stage) would help. Comparing two different query pipelines with different models and setups may be needed as well.

    The **Query Pipeline evaluation** job in the training docker image can help evaluate the rankings of Fusion returned results from different pipeline setups, additionally help search for the best set of weights in the ensemble score.

    In order to evaluate the rankings, we need to know the ground truth answers for some testing questions. For example, user can provide around 200 testing questions, and for each question, we need to know which indexed answers are the correct answers in Fusion, so that we can compute positions of correct answers in the current ranking. User needs to provide a file in CSV format which contains the testing questions (**Testing query field** parameter in the job) and correct answer text or id (**Ground truth field** parameter in the job), put this file in the mapped input folder where we put other training data files, then specify the file name in the **Evaluation file name** parameter. NOTE: if there are multiple matching answers for a question, please put question and answer pairs in different rows. In Fusion, there should be a returned field which contains values that match the answer text or id, please specify this field in the **Answer or id field in Fusion** parameter. NOTE: if use answer text, please make sure the formatting of answer text in the evaluation file is the same as the answer text in Fusion so that we can find matches. Several Fusion access parameters are also needed in order to grab results from Fusion in batch, such as login username, password, host ip, app name, collection and pipeline name.

    The job will provide a variety of metrics (controlled by \*\*Metrics list *parameter) at different positions (controlled by *Metrics\@k list** parameter) in the logs for the chosen final ranking score (specified in **Ranking score** parameter). For example, if choose **Ranking score** as “ensemble\_score”, the program will rank results by the ensemble score returned in **Compute mathematical expression** stage. If choose **Ranking score** as “score” (default field name for Solr score in Fusion), then the ranking evaluation will be based only on Solr score. In addition to the metrics in logs, a CSV results evaluation file will be generated. It will provide correct answer positions for each testing question as well as top returned results for each field specified in **Return fields** parameter. User can specify the file name for this results file in the **Ranking results file name** parameter, then download the file from `http://<external hostname>:5550/evaluation`.

    Another function of this job is to help choose weights for different ranking scores such as Solr score, query to question distance, query to answer distance in **Compute mathematical expression** stage. If interested in performing this weights selection, please choose \*\*Whether perform weights selection *parameter to true, list the set of score names in *List of ranking scores for ensemble** parameter. Since we can use different scaling methods for Solr score in the stage, please choose which Solr scale function you used in the stage in **Solr scale function** parameter. **Target metric to use for weight selection** parameter allows to specify metric that should be optimized during weights selection, for example `recall@3`. Metric values at different positions for different weights combinations will be shown in the log, sorted descendingly based on metric specified above. NOTE: Weights selection can take a while to run for big evaluation datasets, thus if only interested in comparing pipelines, please turn this function off by specifying **Whether perform weights selection** parameter to false.

    There are a few additional advanced parameters that might be useful but not required to provide. **Additional query parameters** allows to provide extra query parameters like `rowsFromSolrToRerank` in a dictionary format. **Sampling proportion** and **Sampling seed** provides a possibility to run evaluation job only on a sample of data.

    <Tip>
      Please make sure the Ranking score, answer text or id, and list of ranking scores for ensemble (if perform weights selection) are returned by Fusion by checking the fields returned in the Query Workbench. User can setup the returned fields in Return Fields section of Query Fields stage.
    </Tip>
  </Accordion>
</AccordionGroup>

1. Upload the question and answer models to the blob store.
2. Configure the `question-answering` index pipeline so that it uses the answer model.
3. Configure the `question-answering` query pipeline so that it uses the question model.
