Systems and methods for generating playlists by applying search prompts to a model configured to generate structured queries
An electronic device associated with a media-providing service stores, in a vector space, a plurality of respective vector representations for respective media content items. The electronic device receives a user input, including a text string. The electronic device generates, using a neural network, a structured query based on the text string. The electronic device determines, based on the structured query, whether to generate a vector representation of a portion of the text string. When the electronic device determines to generate the vector representation of the portion of the text string, it generates the vector representation of the portion of the text string, wherein the vector representation is embedded in the vector space, and identifies a set of media items using the vector representation of the portion of the text string. And the electronic device provides one or more select media items from the set of media items to a user.
1 . A method, comprising:
at an electronic device associated with a media-providing service, the electronic device having one or more processors and memory storing instructions for execution by the one or more processors:
storing, in a vector space, a plurality of respective vector representations for respective media content items;
receiving a user input that includes a first text string;
generating, using a neural network, a structured query based on a first portion of the first text string;
identifying, based on the structured query, a pool of candidate media items, selected from the respective media content items represented by the plurality of respective vector representations;
determining, based on the structured query, to generate a vector representation of a second portion of the first text string;
in accordance with the determination to generate the vector representation of the second portion of the first text string:
generating the vector representation of the second portion of the first text string, wherein the vector representation is embedded in the vector space in which the plurality of respective vector representations for respective media content items is stored; and
identifying a first set of media items from the pool of candidate media items using the vector representation of the second portion of the first text string;
providing one or more select first media items from the first set of media items to a user of the media-providing service;
receiving a second user input that includes a second text string, different than the first text string;
determining, by the neural network based on at least a portion of the second text string, to identify a second set of media items using the neural network without generating a structured query; and
based on the determination to identify the second set of media items using the neural network without generating a structured query:
forgoing generating a structured query;
identifying, directly using the neural network, a second set of media items; and
providing one or more select second media items from the second set of media items to the user of the media-providing service.
2 . The method of claim 1 , further comprising:
selecting, using a search algorithm, the pool of candidate media items based on at least a portion of the structured query; and
providing a filtered pool of candidate media items as the one or more select first media items to the user;
wherein identifying the first set of media items using the vector representation of the second portion of the first text string includes filtering the pool of candidate media items using the vector representation of the second portion of the first text string to produce the filtered pool of candidate media items.
3 . The method of claim 1 , further comprising:
identifying, at an output of the neural network, at least one media item based on the first text string; and
combining the at least one media item with one or more other media items identified using the vector representation of the second portion of the first text string.
4 . The method of claim 1 , wherein:
the second set of media items is identified further in accordance with a determination to not generate a vector representation of the second text string.
5 . The method of claim 1 , further comprising:
receiving a third user input that includes a third text string;
in response to receiving the third user input that includes the third text string, refining the one or more select first media items provided to the user of the media-providing service.
6 . The method of claim 1 , wherein the neural network is a first neural network,
generating the vector representation of the second portion of the first text string includes applying the second portion of the first text string to a second neural network, and the method further includes:
training the second neural network by providing a plurality of synthetic prompts to the second neural network, wherein the plurality of synthetic prompts includes two or more respective prompts for a same set of media-item descriptors associated with the respective media content items.
7 . The method of claim 6 , wherein the training includes applying a contrastive loss training objective to the plurality of synthetic prompts.
8 . The method of claim 7 , wherein:
the contrastive loss training objective applied to the plurality of synthetic prompts while training the second neural network is a supervised learning technique; and
the first neural network is a language model fine-tuned or instructed to generate structured queries based on text strings.
9 . A computer system associated with a media-providing service, comprising:
one or more processors; and
memory storing one or more programs for execution by the one or more processors, the one or more programs comprising instructions for:
storing, in a vector space, a plurality of respective vector representations for respective media content items;
receiving a user input that includes a first text string;
generating, using a neural network, a structured query based on a first portion of the first text string;
identifying, based on the structured query, a pool of candidate media items, selected from the respective media content items represented by the plurality of respective vector representations;
determining, based on the structured query, whether to generate a vector representation of a second portion of the first text string;
in accordance with a determination to generate the vector representation of the second portion of the first text string:
generating the vector representation of the second portion of the first text string, wherein the vector representation is embedded in the vector space in which the plurality of respective vector representations for respective media content items is stored; and
identifying a first set of media items from the pool of candidate media items using the vector representation of the second portion of the first text string;
providing one or more select first media items from the first set of media items to a user of the media-providing service;
receiving a second user input that includes a second text string, different than the first text string;
determining, by the neural network based on at least a portion of the second text string, to identify a second set of media items using the neural network without generating a structured query; and
based on the determination to identify the second set of media items using the neural network without generating a structured query:
forgoing generating a structured query;
identifying, directly using the neural network, a second set of media items; and
providing one or more select second media items from the second set of media items to the user of the media-providing service.
10 . The computer system of claim 9 , wherein the one or more programs further comprise instructions for:
selecting, using a search algorithm, the pool of candidate media items based on at least a portion of the structured query; and
providing a filtered pool of candidate media items as the one or more select first media items to the user;
wherein identifying the first set of media items using the vector representation of the second portion of the first text string includes filtering the pool of candidate media items using the vector representation of the second portion of the first text string to produce the filtered pool of candidate media items.
11 . The computer system of claim 9 , wherein the one or more programs comprising instructions for:
identifying, at an output of the neural network, at least one media item based on the first text string; and
combining the at least one media item with one or more other media items identified using the vector representation of the second portion of the first text string.
12 . The computer system of claim 9 , wherein:
the second set of media items is identified further in accordance with a determination to not generate a vector representation of the second text string.
13 . The computer system of claim 9 , wherein one or more programs comprising instructions for:
receiving a third user input that includes a third text string;
in response to receiving the third user input that includes the third text string, refining the one or more select first media items provided to the user of the media-providing service.
14 . The computer system of claim 9 , wherein the neural network is a first neural network,
generating the vector representation of the second portion of the first text string includes applying the second portion of the first text string to a second neural network, and
the one or more programs comprising instructions for:
training the second neural network by providing a plurality of synthetic prompts to the second neural network, wherein the plurality of synthetic prompts includes two or more respective prompts for a same set of media-item descriptors associated with the respective media content items.
15 . The computer system of claim 14 , wherein the training includes applying a contrastive loss training objective to the plurality of synthetic prompts.
16 . The computer system of claim 15 , wherein:
the contrastive loss training objective applied to the plurality of synthetic prompts while training the second neural network is a supervised learning technique; and
the first neural network is a language model fine-tuned or instructed to generate structured queries based on text strings.
17 . A non-transitory computer-readable storage medium storing one or more programs configured for execution by a computer system, the one or more programs comprising instructions for:
storing, in a vector space, a plurality of respective vector representations for respective media content items;
receiving a user input that includes a first text string;
generating, using a neural network, a structured query based on a first portion of the first text string;
identifying, based on the structured query, a pool of candidate media items, selected from the respective media content items represented by the plurality of respective vector representations;
determining, based on the structured query, whether to generate a vector representation of a second portion of the first text string;
in accordance with a determination to generate the vector representation of the second portion of the first text string:
generating the vector representation of the second portion of the first text string, wherein the vector representation is embedded in the vector space in which the plurality of respective vector representations for respective media content items is stored; and
identifying a first set of media items from the pool of candidate media items using the vector representation of the second portion of the first text string;
providing one or more select media items from the first set of media items to a user of a media-providing service;
receiving a second user input that includes a second text string, different than the first text string;
determining, by the neural network based on at least a portion of the second text string, to identify a second set of media items using the neural network without generating a structured query; and
based on the determination to identify the second set of media items using the neural network without generating a structured query:
forgoing generating a structured query;
identifying, directly using the neural network, a second set of media items; and
providing one or more select second media items from the second set of media items to the user of the media-providing service.
18 . The non-transitory computer-readable storage medium of claim 17 , wherein the one or more programs comprising instructions for:
selecting, using a search algorithm, the pool of candidate media items based on at least a portion of the structured query; and
providing a filtered pool of candidate media items as the one or more select media items to the user;
wherein identifying the first set of media items using the vector representation of the second portion of the first text string includes filtering the pool of candidate media items using the vector representation of the second portion of the first text string to produce the filtered pool of candidate media items.