Skip to content

Embed silently fails on append #37627

Description

@dainiusjocas

Describe the bug
As of 8.738.17, when a partial update appends to an array field and an embedding is calculated from that field, the synthetic tensor field is silently not updated.

To Reproduce
Steps to reproduce the behavior:

  1. Here is the full application.
  2. Schema
schema doc {
  document doc {
    struct chunk {
      field text type string {}
      field sentiment type int {}
    }
    field chunks type array<chunk> {
      indexing: summary
    }
  }
  # Simply take a value from the document field which was fed and embed it.
  # truncated to just 1 dense dimension for simplicity
  field embeddings type tensor<float>(offset{}, x[1]) {
    indexing {
      input chunks |
      for_each{ get_field text } |
      embed e5 |
      attribute
    }
    attribute {
        distance-metric: angular
    }
  }
  field text type array<string> {
    indexing: input chunks | for_each{ get_field text } | index
  }
}
  1. Upsert a doc:
curl -v -X PUT -H "Content-Type:application/json" --data '
  {
  "create": true,
  "update": "id:doc:doc::1",
  "fields": {
    "chunks": {
      "add": [
        {"text": "three", "sentiment": 20}
      ]
    }
  }
}' \
  http://localhost:8080/document/v1/doc/doc/docid/1
  1. See the doc contents:
vespa visit --field-set="[all]" | jq

Returns:

{
  "id": "id:doc:doc::1",
  "fields": {
    "chunks": [
      {
        "text": "three",
        "sentiment": 20
      }
    ],
    "text": [
      "three"
    ]
  }
}

See that embeddings field is not returned.
While after a regular PUT, all embeddings are calculated.

Expected behavior
Something along the lines:

  • maybe a note in the documentation.
  • feed response could signal that something was not updated, maybe a custom header
  • embedder could have a mode where tensor labels are made as a hash from the content.
    But a tough problem.

Environment (please complete the following information):

  • OS: MacOS, docker
  • Infrastructure: self-hosted

Vespa version
8.738.17

Additional context
Demo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions