🌏
Global Scientific Platform
Serving Researchers Since 2012

Brandora: Automating Brand-Compliant Marketing Content Creation with Retrieval- Grounded Cloud Generative AI

DOI : 10.5281/zenodo.24135651
Download Full-Text PDF Cite this Publication

Text Only Version

Brandora: Automating Brand-Compliant Marketing Content Creation with Retrieval- Grounded Cloud Generative AI

Mohith Mohan

Dept. of CSE (AIML) Dayananda Sagar University Bengaluru, India

Niyam MD

Dept. of CSE (AIML) Dayananda Sagar University Bengaluru, India

Astha Chakrabarty

Dept. of CSE (AIML) Dayananda Sagar University Bengaluru, India

Devika Sharma

Dept. of CSE (AIML) Dayananda Sagar University Bengaluru, India

Abstract – General-purpose generative models used for ad- vertising often invent prices, discounts, certications and en- vironmental claims that a brand cannot support. This paper presents Brandora, a hybrid edge and cloud generative AI system that drafts advertisement copy and visuals grounded in a companys own product catalogue and brand guidelines. A retrieval-augmented generation pipeline retrieves the catalogue records closest to a marketers brief and always adds every mandatory guideline to the context of a locally hosted large language model, which returns a structured brief listing its sources and the requested details it could not support. A text- free prompt is sent to a serverless text-to-image model on Cloudare Workers AI, and the approved copy is typeset onto the returned image, which avoids the malformed lettering that diffusion models produce. A reviewer approves every poster and each decision is written to an audit log. The paper also species extensions to the same architecture and an evaluation protocol of sixty briefs, including adversarial requests, for measuring guideline violations, grounding precision, image text artifacts, latency and reviewer effort. On 200 development queries, the hybrid retrieval stage ranks the correct product rst in 97.5 percent of cases.

Index Termsgenerative AI, retrieval-augmented generation, large language models, text-to-image diffusion, serverless cloud inference, marketing automation, brand compliance, hallucina- tion mitigation, human-in-the-loop, responsible AI

  1. Introduction

    Marketing teams produce copy and visuals for many prod- ucts across many channels, and each asset must respect the brand voice, the exact catalogue price and the advertising rules of its market. Large language models (LLMs) now write uent copy from short instructions [1], [2], and latent diffusion models produce photographic scenes from text [3], so rst drafts have become cheap [4], [5].

    Fluency is the easy part. An LLM asked for an Instagram post about a cotton T-shirt will often add a festive discount or call the fabric eco-friendly. These are hallucinations in the sense of [6], and in advertising they carry legal weight: Indias Central Consumer Protection Authority (CCPA) regulates mis- leading advertisements [7] and since October 2024 requires environmental claims such as organic to be substantiated [8]. Images have a separate problem. Diffusion models render

    words poorly [9], so a model asked for a nished poster draws misspelled headlines and pseudo-text.

    Brandora keeps each model on the task it does reliably. The LLM writes copy from retrieved catalogue facts and brand rules, the image model produces a scene with no text, a deterministic compositor sets the copy in real fonts, and a person approves the result. The contributions are:

    • a retrieval-grounded copy pipeline with deterministic injection of mandatory guidelines, so a brand rule reaches the model even when semantic similarity ranks it low;

    • a split edge and cloud deployment in which catalogue data and copy generation stay local and only a text-free visual prompt goes to a serverless GPU service;

    • a compositing and review stage that separates image synthesis from typography and logs every decision with the original and edited text;

    • extensions designed against the same interfaces, and an evaluation protocol with baselines and metrics.

  2. Related Work

    1. Generative Models and Grounding

      Instruction-tuned LLMs [2] made automated copywriting practical, and open-weight models such as Llama 3 [10] run on a single workstation, which keeps catalogue data off third- party servers. Dwivedi et al. [5] list fabricated content among the main risks of such systems. Retrieval-augmented gener- ation (RAG) conditions a generator on documents retrieved per query [11], typically with dense retrievers [12]; BM25

      [13] remains strong for exact identiers, and HNSW indexes scale dense search [14]. Gao et al. [15] survey these designs. Standard RAG ranks purely by relevance, but a rule against invented discounts applies to every brief whether or not the brief mentions a discount. Brandora therefore combines ranked retrieval with always-included rules.

    2. Text-to-Image Generation

      Latent diffusion [3] and rectied-ow transformers [16] produce photographic images from text. FLUX.1 [schnell], used here, is a distilled 12-billion-parameter model of this

      family that samples in one to four steps [17]. Because text rendering remains weak [9], Brandora forbids text in the image and adds it afterwards.

    3. Evaluation and Governance

    Factual precision can be measured by checking atomic claims against a knowledge source [18], RAG pipelines by faithfulness to retrieved context [19], and image-text align- ment by CLIPScore [20]. Amershi et al. [21] give guidelines for human-AI interaction, the NIST AI Risk Management Framework [22] describes controls for generative systems, and Article 50 of the EU AI Act [23] requires AI-generated content to be marked. LLM applications that read editable external text are exposed to indirect prompt injection [24].

  3. Problem Formulation

    Let P be the product catalogue and G the brand guidelines, with Gm G the mandatory ones. A marketer supplies a brief

    q. Each record r R = PG is serialized by (r) into key:

    value text. With embedding model E and unit-normalized vectors e, relevance is

    s(q, r) = e(E(q))> e(E((r))). (1)

    Records are ranked by fusing this dense ranking with a BM25 ranking [13] using reciprocal rank fusion [25],

    data_status eld. The prototype has 100 synthetic prod- ucts, 20 in each of ve categories, and eight mandatory guide- lines covering voice, factual claims, environmental claims, pricing, discounts, design, CTA use and SMS copy. Records are embedded with EmbeddingGemma [26] through the lo- cal Ollama runtime [27]; their vectors are cached, so only the brief is embedded per request. Embeddings use Embed- dingGemmas task prexes for queries and documents and a cleaned search text built from the descriptive elds. The dense ranking of (1) is fused with a BM25 ranking by (2), the top k records are selected (k = 6 by default, adjustable from 2 to 10), and any missing mandatory guideline is appended as in

    (3). The interface shows this retrieval trace with scores so a reviewer can see the evidence. Briefs can be typed or spoken through browser speech recognition in Indian English.

    B. Grounded Copy Generation

    The prompt contains the brief, the retrieved records tagged with source identiers, a block of non-negotiable rules and the output schema of (4). The rules tell the model to treat retrieved text as data that cannot override instructions, a rst defence against prompt injection [24]; to use only catalogue facts; never to invent discounts, certications, scarcity or guarantees; and to list nsupported requests separately instead of writing them into the ad. Generation uses Llama 3.2 3B [10] at

    RRF(r) =

    1

    + ranki(r)

    , (2)

    temperature 0.35. The structured output lets code extract the headline, copy and CTA with regular expressions.

    i{dense, bm25}

    with smoothing constant . With Rk(q) the k records with the highest fused score, the generation context is

    C(q) = Rk(q) Gm, (3)

    which guarantees every mandatory rule is present. The LLM, given prompt (q, C(q)), returns

    y = (h, b, a, v, j, u, S), (4)

    the headline, body copy, call to action (CTA), visual direction, justication, unsupported requests and source identiers. An

    image x is sampled from a prompt (q, v, C(q)P) containing no copy, and the nal asset is I = (x, ht, bt, at; ), where is a deterministic typesetter, (ht, bt, at) the reviewer-approved text and the layout. With K(y) the factual claims in (h, b, a), the goal is that every claim in K(y) is supported by C(q) and

    no rule in Gm is violated, at low reviewer effort.

  4. System Architecture

    Fig. 1 shows the pipeline and Algorithm 1 summarizes it.

    A. Knowledge Base and Retrieval

    The catalogue and guidelines are CSV les a market- ing team can edit directly. Product rows hold an iden- tier, name, category, description, price in Indian ru- pees (INR), materials, features, audience, colours, an advertising_restrictions eld (for example, no or- ganic claim until supplier documents conrm it) and a

    C. Cloud Image Generation

    The image prompt combines the brief, up to 2500 characters of product facts and up to 1800 characters of visual direction, followed by strict instructions: a photographic scene with no letters, numbers, logos or price tags, no invented product features, and clear negative space for text. It is truncated to 2048 characters and sent to FLUX.1 [schnell] [17] on Cloudare Workers AI [28] with four sampling steps. Only this stage runs in the cloud, which gives pay-per-use GPU inference while the catalogue and draft copy stay local.

    D. Typographic Composition and Review

    The raw image is never shown as the advertisement, since it may contain stray pseudo-text. crops it to 1080×1080 pixels and draws gradient scrims behind the headline and copy, with opacity (y) = max(1 y/Hb) across a band of height Hb. Copy is never truncated; the font size is reduced until it ts: f = max f [fmin, f0] : H(wrap(b, f, w)) Havail ,

    (5)

    with f0 = 28, fmin = 14, w = 900 and Havail = 236 pixels. Following [21], an editor lets the reviewer change the text, fonts, colours, positions, alignment, shadows and scrims. Download unlocks only after approval, and each approval or rejection appends a JSON record with timestamp, brief, original and nal text, an edit ag and review time. This log documents human oversight as recommended in [22] and feeds the preference-learning extension.

    Hybrid retriever dense + BM25 + mandatory rules

    LLM copywriter Llama 3.2 3B, Ollama

    regenerate on violation

    copy elds h, b, a

    Typographic compositor

    Text-free image prompt builder

    Cloud (serverless GPU)

    C2PA provenance (proposed)

    FLUX.1 [schnell] Workers AI, 4 steps

Structured brief

h, b, a, v, j, u, S

Compliance verier (proposed)

Knowledge base products.csv, guidelines.csv

Poster editor approve / reject

Marketer brief (text or voice)

Audit log review log.jsonl

Fig. 1. Brandora architecture. All components run on the local machine except the shaded image model, which runs on Cloudares serverless GPU service; only the text-free image prompt leaves the machine. Solid boxes are implemented and dashed boxes are proposed extensions.

Algorithm 1 Brandora generation and review pipeline

Require: brief q, catalogue P, guidelines G, depth k

Ensure: approved asset I or rejection

1: RP G; V CachedEmbed((R))

2: eq EMBED(q); compute s(q, r) by (1) and BM25 ranks; fuse by (2)

3: C TopK(R, RRF, k) Gm

4: y LLM((q, C)); (h, b, a, v) Parse(y)

5: x FLUX((q, v, C P)) on Workers AI

6: I0 (x, h, b, a; 0)

7: (d, ht, bt, at, ) Review(I )

TABLE I

Implementation Status of Brandora Modules

Module Status

CSV knowledge base and record serialization Implemented Dense retrieval with cached embeddings Implemented Hybrid dense and BM25 retrieval with rank fu- Implemented sion

Mandatory-guideline injection and retrieval trace Implemented Grounded structured copy generation Implemented Text-free FLUX.1 image generation on Workers Implemented AI

0

8: Log(d, q, (h, b, a), (ht, bt, at), treview)

9: if d = approve then

10: return (x, ht, bt, at; )

11: else

12: return rejection

Deterministic typographic composition Implemented Interactive poster editor with approve/reject log Implemented Voice brief input and latency proling Implemented Ofine text-to-speech audio ads Partial Automated compliance verier with regeneration Proposed Approximate nearest-neighbor index for large Proposed catalogues

13: end if

  1. Extended Modules

    The following modules reuse the structured output, retrieval trace, compositor and audit log. Table I gives the status of every module.

    1. Compliance Verier

      Deterministic checks parse every price and compare it with the catalogue, ag discount, coupon and urgency phrases, ag environmental terms the catalogue does not substantiate [8], and require one CTA. The copy is then split into atomic claims [18], and a claim c is supported if

      Multilingual multi-channel variant generation Proposed Product-faithful imagery and image checks Proposed Preference learning from reviewer edits Proposed

      Provenance metadata and AI disclosure Proposed

      Serverless multi-user deployment Proposed

    2. Scale, Channels and Languages

      The prototype scans every record exactly, which suits 108 records. For catalogues of 104 products or more, an HNSW index [14] would replace the exact dense scan, with metadata lters on category and publication status, and the BM25

      max

      pC(q)P

      Pentail((p) c) , (6)

      fusion of (2) would stay unchanged. Channel proles add hard limits, such as 160 characters for a single SMS segment, and

      using an inference model or an LLM judge [29]. Violations are fed back for up to R regeneration rounds [30]; drafts that still fail reach the reviewer with the failing rules highlighted.

      the system produces several variants per brief for A/B tests, including Hindi and Kannada versions that the verier also checks.

    3. Image Fidelity, Learning and Provenance

    When a product photograph exists, inpainting would keep

    TABLE II

    Production Retrieval by Query Type (200 Development Queries, 100 Products, 8 Guidelines)

    the real product and generate only the background; every

    image would pass an OCR text check [31] and a CLIPScore check [20] before composition. Each edited-then-approved review is a preference pair, so the local model can be adapted with low-rank adapters [32] trained by direct preference opti- mization [33]. Approved posters would carry a C2PA manifest

    [34] recording models, sources and the reviewer decision, supporting the EU AI Acts marking duty [23].

  2. Evaluation

    Query type Hit@1 (95% CI) Hit@3 R@6 MRR Product named 100.0 [96.3100] 100 100 1.000

    Descriptive 95.0 [88.897.8] 100 100 0.975

    All queries 97.5 [94.398.9] 100 100 0.988

    TABLE III

    Retrieval Ablation on 200 Developmen Queries

    A. Protocol

    The benchmark crosses ve categories, three channels (In- stagram, SMS, email) and four brief types (standard, price request, discount request, environmental-claim request), giving 60 briefs. B0 is the same LLM with guidelines but no retrieval, B1 uses retrieval without mandatory-rule injection, B2 is Brandora, and B3 adds the verier with R = 2. Images compare FLUX.1 prompted for a nished poster with the text- free image after composition. The guideline violation rate and grounding precision are

    All combined (production) 97.5 100.0 0.988

    Conguration

    Dense baseline

    Hit@1 (%)

    89.0

    Hit@3 (%)

    96.5

    MRR

    0.934

    + Task prexes

    92.0

    98.5

    0.952

    + Prexes and clean text

    95.0

    99.0

    0.971

    BM25 alone

    100.0

    100.0

    1.000

    C. Pilot Observation

    The audit log holds seven reviewer decisions: 5 were approved (71.4%, 95% CI 35.991.8%) and the text was edited in 2 (28.6%, CI 8.264.1%). Seven decisions are too few to support a conclusion. In one early review, an Instagram brief on the Everyday Organic Cotton Tee, the reviewer cut the text from 46 words to 16, which suggests the drafts were

    1

    q |K+(yq)|

    longer than the reviewer wanted. The copy stayed within the

    GVR =

    |Q|

    qQ

    .J, V(yq) /= , GP =

    , (7)

    q |K(yq)|

    catalogues listed features but used the full product name, which contains Organic, although the products restriction

    where V is the set of violated mandatory rules, labeled by two annotators, and K+ the supported claims. Reviewer effort uses the normalized edit distance

    NED = Lev(yo, yf ) / max (|yo|, |yf |) (8)

    with Levenshtein distance [35] between original and nal text. Further metrics are price exactness, Recall@6 and per-stage latency.

    B. Results

    Table II reports the production retrieval conguration on 200 development queries, 100 that name the product and 100 that only describe it. The correct product is ranked rst for every named query and for 95.0% of descriptive queries (97.5% overall, MRR 0.988), and it appears within the top three and the top six for all queries. Table III adds components one at a time. Hit@1 rises from 89.0% for the dense baseline to 92.0% with task prexes and 95.0% with clean search text. BM25 alone reaches 100.0%, above the combined production conguration at 97.5%, so this development set does not show the hybrid improving on keyword search. A likely reason is that the development queries reuse catalogue wording, which favors exact keyword matching, and a held-out set of paraphrased queries is needed to test this. The retrieval settings were tuned against these queries, so the gures are development-set results and not an estimate for unseen briefs. The copy-compliance and image benchmarks described in the protocol have not yet been run.

    forbids organic claims. A claim carried inside a product name passes every rule that inspects descriptive text, so the verier needs a check for it.

  3. Discussion and Limitations

    Mandatory-rule injection guarantees that rules reach the model, not that a 3B-parameter model follows them, and prompt instructions reduce but do not remove prompt injection [24]. Until the verier exists, the reviewer is the enforcement step, which is why download requires approval. The catalogue is synthetic, so results measure faithfulness to supplied facts rather than their truth, and generated images show a plausible product that may differ from the real item. The retrieval results come from development queries that share wording with the catalogue and were used for tuning, so they overstate performance on unseen briefs. Keeping catalogue data and copy generation local means unreleased product details stay with the business when the local model writes the copy. The current application can route copy generation to Cloudare- hosted writers before falling back to the local model, so a local-only mode is needed for that privacy property to hold. The image stage receives only a text-free visual prompt, and its usage quotas and prices may change.

  4. Conclusion

Brandora generates advertisement copy and visuals from a companys own catalogue and rules: retrieval with mandatory- rule injection keeps brand constraints in every prompt, a local LLM drafts structured copy that names its sources and gaps,

a serverless diffusion model produces a text-free scene, and deterministic composition with logged human review produces the nal poster. Next steps are to evaluate retrieval on a held- out query set, run the benchmark across the four congura- tions, build the verier and image checks, and collect enough reviews to test preference learning. Linking approved variants to click-through data would later show which grounded mes- sages perform best per channel.

Acknowledgment

The authors thank [faculty guide name and department] for guidance on this capstone project.

References

  1. T. Brown et al., Language models are few-shot learners, in Proc. Adv. Neural Inf. Process. Syst. (NeurIPS), vol. 33, 2020, pp. 18771901.

  2. L. Ouyang et al., Training language models to follow instructions with human feedback, in Proc. Adv. Neural Inf. Process. Syst. (NeurIPS), vol. 35, 2022, pp. 2773027744.

  3. R. Rombach, A. Blattmann, D. Lorenz, P. Esser, and B. Ommer, High-resolution image synthesis with latent diffusion models, in Proc. IEEE/CVF Conf. Comput. Vis. Pattern Recognit. (CVPR), 2022, pp. 1068410695.

  4. T. Davenport, A. Guha, D. Grewal, and T. Bressgott, How articial intelligence will change the future of marketing, J. Acad. Mark. Sci., vol. 48, no. 1, pp. 2442, 2020.

  5. Y. K. Dwivedi et al., Opinion paper: So what if ChatGPT wrote it? Multidisciplinary perspectives on opportunities, challenges and implica- tions of generative conversational AI for research, practice and policy, Int. J. Inf. Manage., vol. 71, Art. no. 102642, 2023.

  6. Z. Ji et al., Survey of hallucination in natural language generation,

    ACM Comput. Surv., vol. 55, no. 12, Art. no. 248, 2023.

  7. Central Consumer Protection Authority, Government of India, Guide- lines for Prevention of Misleading Advertisements and Endorsements for Misleading Advertisements, 2022, New Delhi, India, Jun. 2022.

  8. Central Consumer Protection Authority, Government of India, Guide- lines for Prevention and Regulation of Greenwashing or Misleading Environmental Claims, 2024, New Delhi, India, Oct. 2024.

  9. J. Chen et al., TextDiffuser: Diffusion models as text painters, in Proc. Adv. Neural Inf. Process. Syst. (NeurIPS), vol. 36, 2023.

  10. A. Grattaori et al., The Llama 3 herd of models, arXiv:2407.21783, 2024.

  11. P. Lewis et al., Retrieval-augmented generation for knowledge-intensive NLP tasks, in Proc. Adv. Neural Inf. Process. Syst. (NeurIPS), vol. 33, 2020, pp. 94599474.

  12. V. Karpukhin et al., Dense passage retrieval for open-domain question answering, in Proc. Conf. Empirical Methods Natural Lang. Process. (EMNLP), 2020, pp. 67696781.

  13. S. Robertson and H. Zaragoza, The probabilistic relevance framework: BM25 and beyond, Found. Trends Inf. Retr., vol. 3, no. 4, pp. 333389, 2009.

  14. Y. A. Malkov and D. A. Yashunn, Efcient and robust approxi- mate nearest neighbor search using hierarchical navigable small world graphs, IEEE Trans. Pattern Anal. Mach. Intell., vol. 42, no. 4, pp. 824836, Apr. 2020.

  15. Y. Gao et al., Retrieval-augmented generation for large language models: A survey, arXiv:2312.10997, 2023.

  16. P. Esser et al., Scaling rectied ow transformers for high-resolution image synthesis, in Proc. 41st Int. Conf. Mach. Learn. (ICML), 2024.

  17. Black Forest Labs, FLUX.1 [schnell], model card, 2024. [Online].

    Available: https://huggingface.co/black-forest-labs/FLUX.1-schnell

  18. S. Min et al., FActScore: Fine-grained atomic evaluation of factual precision in long form text generation, in Proc. Conf. Empirical Methods Natural Lang. Process. (EMNLP), 2023.

  19. S. Es, J. James, L. Espinosa-Anke, and S. Schockaert, RAGAS: Automated evaluation of retrieval augmented generation, in Proc. 18th Conf. Eur. Chapter Assoc. Comput. Linguist.: Syst. Demonstrations (EACL), 2024, pp. 150158.

  20. J. Hessel, A. Holtzman, M. Forbes, R. Le Bras, and Y. Choi, CLIP- Score: A reference-free evaluation metric for image captioning, in Proc. Conf. Empirical Methods Natural Lang. Process. (EMNLP), 2021, pp. 75147528.

  21. S. Amershi et al., Guidelines for human-AI interaction, in Proc. CHI Conf. Human Factors Comput. Syst., 2019, pp. 113.

  22. National Institute of Standards and Technology, Articial Intelligence Risk Management Framework (AI RMF 1.0), NIST AI 100-1, Gaithers- burg, MD, USA, Jan. 2023.

  23. European Parliament and Council, Regulation (EU) 2024/1689 laying down harmonised rules on articial intelligence (Articial Intelligence Act), Off. J. Eur. Union, Jul. 2024.

  24. K. Greshake, S. Abdelnabi, S. Mishra, C. Endres, T. Holz, and M. Fritz, Not what youve signed up for: Compromising real-world LLM- integrated applications with indirect prompt injection, in Proc. 16th ACM Workshop Artif. Intell. Secur. (AISec), 2023, pp. 7990.

  25. G. V. Cormack, C. L. A. Clarke, and S. Buettcher, Reciprocal rank fusion outperforms Condorcet and individual rank learning methods, in Proc. 32nd Int. ACM SIGIR Conf. Res. Develop. Inf. Retr., 2009, pp. 758759.

  26. Google DeepMind, EmbeddingGemma, model card, 2025. [Online].

    Available: https://ai.google.dev/gemma/docs/embeddinggemma

  27. Ollama, Ollama: Get up and running with large language models locally, 2024. [Online]. Available: https://github.com/ollama/ollama

  28. Cloudare, Workers AI documentation, 2025. [Online]. Available: https://developers.cloudare.com/workers-ai/

  29. L. Zheng et al., Judging LLM-as-a-judge with MT-Bench and Chatbot Arena, in Proc. Adv. Neural Inf. Process. Syst. (NeurIPS) Datasets Benchmarks Track, vol. 36, 2023.

  30. A. Madaan et al., Self-Rene: Iterative renement with self-feedback, in Proc. Adv. Neural Inf. Process. Syst. (NeurIPS), vol. 36, 2023.

  31. R. Smith, An overview of the Tesseract OCR engine, in Proc. 9th Int. Conf. Document Anal. Recognit. (ICDAR), 2007, pp. 629633.

  32. E. J. Hu et al., LoRA: Low-rank adaptation of large language models, in Proc. Int. Conf. Learn. Represent. (ICLR), 2022.

  33. R. Rafailov, A. Sharma, E. Mitchell, S. Ermon, C. D. Manning, and C. Finn, Direct preference optimization: Your language model is secretly a reward model, in Proc. Adv. Neural Inf. Process. Syst. (NeurIPS), vol. 36, 2023.

  34. Coalition for Content Provenance and Authenticity, C2PA technical specication, 2024. [Online]. Available: https://c2pa.org/specications/

  35. V. I. Levenshtein, Binary codes capable of correcting deletions, inser- tions, and reversals, Soviet Phys. Doklady, vol. 10, no. 8, pp. 707710, 1966.