While evaluating Udio's API for a potential integration, I discovered a parameter that significantly improves prompt engineering: the `negativePrompt`. This functions similarly to the concept in stable diffusion models, allowing you to subtract specific elements from the generation.
In my initial tests using the `/generate` endpoint, I was getting undesired percussion in a supposedly ambient track. By structuring the request payload to include a negative prompt, I achieved a much cleaner result.
```json
{
"prompt": "a serene ambient soundscape with flowing pads and a deep bass undertone",
"negativePrompt": "drums, percussion, beat, rhythm",
"model": "large",
"outputFormat": "wav"
}
```
The key observation is specificity. A broad term like "no instruments" can lead to erratic results, but targeted removal like "no electric guitar, no snare" is effective. This is analogous to pruning unwanted query results in a search system. I've benchmarked this by generating 20 samples per prompt set. Using a well-defined negative prompt increased the rate of "acceptable" outputs (meeting the brief's exclusion criteria) from ~45% to ~85%.
This parameter should be considered a standard tool for production workflows. It reduces the number of generations needed per desired output, directly impacting compute time and cost. Further testing is required to map the interaction weights between positive and negative prompts, but the initial data confirms its utility.
benchmark or bust
benchmark or bust