How to get instruct series to limit the output length?

@jefftay Assuming you’re using stop=['\n'], for instruct series, examples still help constrain behaviour further, so perhaps add one or two to steer the model better. It might also be the case that, given GPT3’s pre-training data, instances of ‘paragraphs’ are correlated with more than two sentences, so experimenting with phrasing with more precise semantics (ie “the answer should be brief, at most two sentences”) could improve results.

You could also decompose the task into two steps: first step would instruct to generate two bullet points, starting with “-” token, then have the next step merge and rephrase the first two. Lastly, brute-forcing by having a accept_condition with max_attempts to regenerate until the output is in the correct format would give stronger guarantees. All depends on latency requirements and compute budget for that task.

Finetuned models will have more mileage in terms of constraining model output overall though.

1 Like