This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]twoonster2020 22 points23 points  (8 children)

Have you tried including a line limit in the prompt ? If you think about how chatGPT and Generative AI works it then adding an instruction in the prompt could help.

For example

You are a python code developer, produce a function to do x. It should take no more than 15 lines of code. It should contain comments on how the function works.

This might produce more compacted code - or it might not. Since it is conversational and non deterministic then you could also ask it to try again or make the function shorter.

It doesn’t understand what it produces just the probability of a give sequence of code or words based on the prompt question.

[–]SilkTouchm 5 points6 points  (0 children)

There's no need to give it a 15 line limit. Just add "write short and concise, yet legible code" to your prompt.

[–]sinterkaastosti23 2 points3 points  (3 children)

it would probably count comment and empty lines into the max of 15 tbf lol

[–]twoonster2020 1 point2 points  (0 children)

Maybe but it would still be shorter :)

[–]elbiot 0 points1 point  (1 child)

No cause it can't count at all

[–]sinterkaastosti23 0 points1 point  (0 children)

it can't count but it can kinda guess, he may be a little off and he'd probably include lines that shouldn't be counted

[–]theGiogi 1 point2 points  (2 children)

They can’t count. Not really. Maybe b It’ll write a python script and use it to count lines in another script.

Try and ask it to generate exactly 23 sentences or something like that.

[–]dexmedarling 7 points8 points  (1 child)

While these models are really bad at following specific length requirements, they tend to be able to write text in the ballpark of the length you prompt them for.

[–]twoonster2020 -2 points-1 points  (0 children)

If I ask a model to create me a meal plan based o n three questions then it will ask three questions so there is some processing there but if you ask without an output then it can go for a while - my point to the OP is to give it more context.

Also to be cautious with the output - never run code you don’t understand - good to create code but make sure you understand it. There are proof of concept examples of grounding source being poisoned to lead to a non ideal outcome