
\begin{center}
\begin{tikzpicture}

\def\ssep{1.9cm}

\tikzstyle{snode} = [minimum width=2.5cm,minimum height=1.5cm,inner sep=2pt,draw,thick,fill=white];

\begin{scope}

\node [snode,anchor=west] (step0) at (0,0) {Initialization};
\node [anchor=north west,align=left] (step0text) at ([xshift=0.5cm]step0.north east) {\small{Initialize the task pool with a number of instructions}\\[-0.1cm] \small{and corresponding input-output samples.}};
\node [anchor=north west] (step0sample1) at ([yshift=-0.1cm]step0text.south west) {\scriptsize{Sample 1:}};
\node [anchor=west,fill=gray!30,inner sep=3pt] (step0sample1text) at (step0sample1.east) {\scriptsize{$(\mathrm{Instruction},\mathrm{User}\text{-}\mathrm{input},\mathrm{Output})$}};
\node [anchor=north west] (step0sample2) at ([yshift=-2pt]step0sample1.south west) {\scriptsize{Sample 2:}};
\node [anchor=west,fill=gray!30,inner sep=3pt] (step0sample2text) at (step0sample2.east) {\scriptsize{$(\mathrm{Instruction},\mathrm{User}\text{-}\mathrm{input},\mathrm{Output})$}};
\node [anchor=north] (step0sample3) at ([yshift=-2pt]step0sample2.south) {\scriptsize{$\cdots$}};

\draw [decoration={brace,amplitude=4pt},decorate] ([xshift=0.2cm]step0sample1text.north east) --  ([xshift=0.2cm,yshift=-1.5cm]step0sample1text.north east);

\node [anchor=west,minimum width=1.3cm,minimum height=0.7cm,draw,fill=white,drop shadow] (pool) at ([xshift=0.5cm,yshift=0.1cm]step0sample2text.east) {\footnotesize{Task Pool}};

\node [snode,anchor=north west] (step1) at ([yshift=-\ssep]step0.south west) {Sampling};
\node [anchor=north west,align=left] (step1text) at ([xshift=0.5cm]step1.north east) {\small{Draw a few instructions from the pool}};

\node [anchor=north west,fill=gray!30,inner sep=3pt] (step1instruction1) at ([yshift=-0.1cm,xshift=0.1cm]step1text.south west) {\scriptsize{$\mathrm{Instruction}_a$}};
\node [anchor=north west,fill=gray!30,inner sep=3pt] (step1instruction2) at ([yshift=-3pt]step1instruction1.south west) {\scriptsize{$\mathrm{Instruction}_b$}};
\node [anchor=north west,fill=gray!30,inner sep=3pt] (step1instruction3) at ([yshift=-3pt]step1instruction2.south west) {\scriptsize{$\mathrm{Instruction}_c$}};

\node [anchor=west,minimum width=1.3cm,minimum height=0.7cm,draw,fill=white,drop shadow] (pool) at ([xshift=2.0cm,yshift=0pt]step1instruction2.east) {\footnotesize{Task Pool}};
\draw [->,thick] ([xshift=-3pt]pool.west) -- ([xshift=-1.85cm]pool.west) node [pos=0.5,above] {\scriptsize{sampling}};

\node [snode,anchor=north west,align=left] (step2) at ([yshift=-\ssep]step1.south west) {Instruction\\Generation};
\node [anchor=north west,align=left] (step2text) at ([xshift=0.5cm,yshift=0.2cm]step2.north east) {\small{Prompt the LLM to generate a new instruction based on}\\[-0.1cm] \small{the drawn instructions.}};

\node [anchor=north west,minimum width=5cm,align=left,draw,thin,rounded corners=0.3cm] (prompt1) at ([yshift=-0.1cm,xshift=0.15cm]step2text.south west) {\tiny{\texttt{You are provided several different instructions for performing}}\\ [-0.25cm] \tiny{\texttt{some tasks. Please generate an instruction based on these.}} \\ [-0.2cm] \tiny{\texttt{Task 1:} \ctext[rgb]{0.85, 0.85, 0.85}{$\mathrm{Instruction}_a$}} \\ [-0.2cm] \tiny{\texttt{Task 2:} \ctext[rgb]{0.85, 0.85, 0.85}{$\mathrm{Instruction}_b$}} \\ [-0.2cm] \tiny{\texttt{Task 3:} \ctext[rgb]{0.85, 0.85, 0.85}{$\mathrm{Instruction}_c$}} \\ [-0.2cm] \tiny{\texttt{New Task:} \underline{\ctext[RGB]{255,204,204}{$\mathrm{Instruction}_{\mathrm{new}}$}}}};

\node [snode,anchor=north west,align=left] (step3) at ([yshift=-\ssep-0.2cm]step2.south west) {Sample\\Generation};
\node [anchor=north west,align=left] (step3text) at ([xshift=0.5cm,yshift=0.1cm]step3.north east) {\small{Given the newly-generated instruction and a few}\\[-0.1cm] \small{input-output samples, generate a new sample.}};

\node [anchor=north west,minimum width=8.1cm,align=left,draw,thin,rounded corners=0.3cm] (prompt2) at ([yshift=-0.1cm,xshift=0.15cm]step3text.south west) {\tiny{\texttt{You are provided with a set of input-output samples tasks, }}\\ [-0.25cm] \tiny{\texttt{each composed of an instruction, a user input, and an output.}} \\ [-0.25cm] \tiny{\texttt{Please generate a new sample based on these.}} \\ [-0.2cm] \tiny{\texttt{Sample 1:} \ctext[rgb]{0.85, 0.85, 0.85}{$\mathrm{Sample}_a$}} \\ [-0.2cm] \tiny{\texttt{Sample 2:} \ctext[rgb]{0.85, 0.85, 0.85}{$\mathrm{Sample}_b$}} \\ [-0.2cm] \tiny{\texttt{New Sample:} \ctext[RGB]{255,204,204}{$\mathrm{Instruction}_{\mathrm{new}}$} \ctext[RGB]{153,204,255}{$\mathrm{User\text{-}input}_{\mathrm{new}}$} \ctext[RGB]{153,204,255}{$\mathrm{Output}_{\mathrm{new}}$}}};

\node [snode,anchor=north west] (step4) at ([yshift=-\ssep-0.2cm]step3.south west) {Filtering};
\node [anchor=north west,align=left] (step4text) at ([xshift=0.5cm,yshift=0.1cm]step4.north east) {\small{Filter out invalid and low-quality samples.} \\[-0.1cm] \small{Add the remaining samples into the pool.}};

\draw [->,thick] ([yshift=-2pt]step0.south) -- ([yshift=2pt]step1.north);
\draw [->,thick] ([yshift=-2pt]step1.south) -- ([yshift=2pt]step2.north);
\draw [->,thick] ([yshift=-2pt]step2.south) -- ([yshift=2pt]step3.north);
\draw [->,thick] ([yshift=-2pt]step3.south) -- ([yshift=2pt]step4.north);
\draw [->,thick] ([yshift=-2pt]step4.south) -- ([yshift=-0.5cm]step4.south) -- ([yshift=-0.5cm,xshift=-0.8cm]step4.south west) -- ([xshift=-0.8cm]step1.west) -- ([xshift=-2pt]step1.west);

\end{scope}

\end{tikzpicture}
\end{center}
