> ## 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.

# Smart Answers Supervised Training

> Job configuration specifications

[localhost link]: http://localhost:3000/docs/lucidworks-search/09-developer-documentation/config-specs/jobs/smart-answers-supervised-training

[mintlify link]: https://doc.lucidworks.com/docs/lucidworks-search/09-developer-documentation/config-specs/jobs/smart-answers-supervised-training.md

[old doc.lw link]: https://doc.lucidworks.com/managed-fusion/5.9/7v5z8o.md

Train a [Smart Answers](https://doc.lucidworks.com/docs/lucidworks-search/10-machine-learning/smart-answers/overview.md) model on a supervised basis, with pre-trained or trained embeddings, and deploy the trained model to the ML Model Service.

See **Train a Smart Answers Supervised Model** for configuration instructions.

> [accordion] Train a Smart Answers Supervised Model
>
> The [Supervised solution for Smart Answers](https://doc.lucidworks.com/docs/lucidworks-search/10-machine-learning/smart-answers/faq-solution.md) begins with training a model using your existing data and the [Smart Answers Supervised Training job](https://doc.lucidworks.com/docs/lucidworks-search/09-developer-documentation/config-specs/jobs/smart-answers-supervised-training.md), as explained in this topic.  The job includes an auto-tune feature that you can use instead of manually tuning the configuration.
>
> > [card] Key questions to get you started
> >
> > Powered by Lucidworks Agent Studio
>
> ## Training job requirements
>
> **Storage**
>
> 150GB plus 2.5 times the total input data size.
>
> **Processor and memory**
>
> The memory requirements depend on whether you choose GPU or CPU processing:
>
> | GPU | CPU |
> | - | - |
> | <ul><li>one core</li> <li>11GB RAM</li></ul> | <ul><li>32 cores</li> <li>32GB RAM</li></ul> |
>
> > [!TIP]
> >
> > If your training data contains more than 1 million entries, use GPU.
>
> ## Prepare the input data
>
> 1. Format your input data as question/answer pairs, that is, a query and its corresponding response in each row.
>
>    You can do this in any format that Lucidworks Search supports.
>
>    If there are multiple possible answers for a unique question, then repeat the questions and put the pair into different rows to make sure each row has one question and one answer, as in the example JSON below:
>
>    ```json 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..."}]
>    ```
> 2. Index the input data in Lucidworks Search.
>
>    If you wish to have the training data in Lucidworks Search, index it into a separate collection for training data such as `model_training_input`. Otherwise you can use it directly from the cloud storage.
>
> ## Configure the training job
>
> 1. In Lucidworks Search, navigate to **Collections** > **Jobs**.
> 2. Select **Add** > **Smart Answers Supervised Training**:
>
>    ![Select the Smart Answers Supervised Training job](https://mintcdn.com/lucidworks/hRHvA40l_Bej4D7e/assets/images/5.1/qna-supervised-training-job0.png?fit=max\&auto=format\&n=hRHvA40l_Bej4D7e\&q=85\&s=6f552c1eb9b7f85d8c6f1334fd1d3933)
> 3. In the **Training Collection** field, specify the input data collection that you created when you [prepared the input data](#prepare-the-input-data).
>
>    > [!NOTE]
>    >
>    > You can also configure this job to read from or write to cloud storage.
> 4. Enter the names of the **Question Field** and the **Answer Field** in the training collection.
> 5. Enter a **Model Deployment Name**.
>
>    The new machine learning model will be saved in the blob store with this name.  You will reference it later when you configure your pipelines.
> 6. Configure the **Model base**.
>
>    There are several pre-trained word and [BPE](https://nlp.h-its.org/bpemb) embeddings for different languages, as well as a few pre-trained BERT models.
>
>    If you want to train custom embeddings, select `word_custom` or `bpe_custom`. This trains Word2vec on the provided data and specified fields. It might be useful in cases when your content includes unusual or domain-specific vocabulary.
>
>    If you have content in addition to the query/response pairs that can be used to train the model, then specify it in the **Texts Data Path**.
>
>    When you use the pre-trained embeddings, the log shows the percentage of processed vocabulary words. If this value is high, then try using custom embeddings.
>
>    The job trains a few (configurable) RNN layers on top of word embeddings or fine-tunes a BERT model on the provided training data. The result model uses an attention mechanism to average word embeddings to obtain the final single dense vector for the content.
>
>    > [!TIP]
>    >
>    > Dimension size of vectors for Transformer-based models is 768. For RNN-based models it is 2 times the number units of the last layer. To find the dimension size: download the model, expand the zip, open the log and search for `Encoder output dim size:` line. You might need this information when creating collections in Milvus.
> 7. *Optional:* Check **Perform auto hyperparameter tuning** to use auto-tune.
>
>    Although training module tries to select the most optimal default parameters based on the training data statistics, auto-tune can extend it by automatically finding even better training configuration through hyper-parameter search.
>    Although this is a resource-intensive operation, it can be useful to identify the best possible RNN-based configuration. Transformer-based models like BERT are not used during auto hyperparameter tuning as they usually perform better yet they are much more expensive on both training and inference time.
> 8. Click **Save**.
>
>    ![The saved job configuration](https://mintcdn.com/lucidworks/hRHvA40l_Bej4D7e/assets/images/5.1/qna-supervised-training-job1.png?fit=max\&auto=format\&n=hRHvA40l_Bej4D7e\&q=85\&s=0082d7dbab9b17fc8f76d14ad159c82a)
>
>    > [!NOTE]
>    >
>    > If using solr as the training data source ensure that the source collection contains the `random_*` dynamic field defined in its `managed-schema.xml`. This field is required for sampling the data. If it is not present, add the following entry to the `managed-schema.xml` alongside other dynamic fields `<dynamicField name="random_*" type="random"/>` and <fieldType indexed="true" name="random" /> alongside other field types.
> 9. Click **Run** > **Start**.
>
> After training is finished the model is deployed into the cluster and can be used in index and query pipelines.
>
> ## Next steps
>
> 1. See A Smart Answers Supervised Job’s Status and Output
> 2. Configure The Smart Answers Pipelines
> 3. Evaluate a Smart Answers Query Pipeline

## Configuration properties


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.