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

# Attribute a response to training data

Training data attribution surfaces the training data that influenced fine-tuned model outputs. By tracing model responses back to specific question-answer pairs from the training dataset, it helps debug model behavior and audit responses.

<Note>
  This method requires a fine-tuned model created with Seekr's [fine-tuning feature](/flow/sdk/fine-tuning). Only models built after September 22nd, 2025 are supported.
</Note>

## Retrieve influential fine-tuning data

**Endpoint:** [`GET /v1/flow/explain/models/{model_id}/influential-finetuning-data`](/flow/reference/get_influential_training_data_route_v1_flow_explain_models__model_id__influential_finetuning_data_get)

<CodeGroup>
  ```python Python theme={null}
  import os
  from seekrai import SeekrFlow

  client = SeekrFlow(api_key=os.environ["SEEKR_API_KEY"])

  model_id = "deployment-<your-deployment-id>"

  influential_data = client.explainability.get_influential_finetuning_data(
      model_id=model_id,
      question="What is SeekrFlow?"
  )
  print(influential_data)
  ```
</CodeGroup>

If you already have a model response from a prior `chat.completions` call, provide it as `answer` to skip an extra generation:

<CodeGroup>
  ```python Python theme={null}
  chat_response = client.chat.completions.create(
      model=model_id,
      messages=[{"role": "user", "content": "What is SeekrFlow?"}]
  )

  influential_data = client.explainability.get_influential_finetuning_data(
      model_id=model_id,
      question="What is SeekrFlow?",
      answer=chat_response.choices[0].message.content,
  )
  ```
</CodeGroup>

## Reading the result

The response contains `results`, a list of influential question-answer pairs, along with the `answer` used (echoed back if you provided one, otherwise generated internally) and the schema `version`. Each result carries its `id`, the source `file_id` (use it to trace back and edit the training documents), the `messages` content in `Q: <question>\nA: <answer>` form, and an `influence_level` of `high`, `medium`, or `low`. Irrelevant pairs are filtered out and not returned. For the complete response schema, see the endpoint reference above.

## Best practices

* **Interpreting influence levels:** `high` means the Q/A pair strongly shaped the response; `medium` means moderate impact; `low` means minimal contribution. Look for recurring `high` pairs to understand the training patterns driving a response.
* **Unexpected results:** If unrelated pairs are surfacing with high influence, review and refine your fine-tuning dataset.
* **Empty results:** The model may simply not have found training pairs relevant to the prompt. This is not an error.

## Common errors

* **TypeError** – Raised by the SDK when a required parameter such as `question` is missing or invalid.
* **404 Not found** – The provided `model_id` does not exist.

For all status codes, see the [endpoint reference](/flow/reference/get_influential_training_data_route_v1_flow_explain_models__model_id__influential_finetuning_data_get).
