Skip to content

Sampling for ChatGPT

Nicolay Rusnachenko edited this page Feb 22, 2023 · 13 revisions

Recent advances of chatbot development and its application in Stance Detection domain makes prompt-based studies even more relevant as before. Due to the simplicity of syntax constructure of English texts and leveraged amount of data, makes it the main in the sense of deepest understanding of the questions to the best of my personal knowledge at present. Everything mentioned above makes the further advances of prompting application for ChatGPT in this field become very important.

In order to perform the latter, a side-project arekit-prompt-sampler for sampling large documents into small piece of texts with further translation and wrapping into promptings:

TODO: Complete description with the invented class!

In AREkit since 0.23.1, we provide PromptedSampleRowProvider for prompting:

class PromptedSampleRowProvider(CroppedSampleRowProvider):
    """ Sample, enriched with the prompt technique.
    """

    def __init__(self, crop_window_size, label_scaler, text_provider, prompt):
        # Initialization details
        ...

    def _fill_row_core(self, row, text_opinion_linkage, index_in_linked, etalon_label,
                       parsed_news, sentence_ind, s_ind, t_ind):

        row = super(PromptedSampleRowProvider, self)._fill_row_core(
           row=row, text_opinion_linkage=text_opinion_linkage, index_in_linked=index_in_linked,
           etalon_label=etalon_label, parsed_news=parsed_news, sentence_ind=sentence_ind,
           s_ind=s_ind, t_ind=t_ind)

        # Keep the original text
        original_text = row[BaseSingleTextProvider.TEXT_A]

        # Enrich this text with propt details, based on input information
        row[BaseSingleTextProvider.TEXT_A] = self.__prompt.format(
            text=original_text,
            s_ind=row[const.S_IND],
            t_ind=row[const.T_IND],
            label=row[const.LABEL] if const.LABEL in row else None)

        return row
Clone this wiki locally