Cloud AI: Machine Learning & Generative AI

Transformers & Attention

Every foundation model on every cloud runs on the transformer. Knowing how tokens, attention and context windows work explains both answer quality and cost.

Multicloud AI & ERP / Cloud AI: Machine Learning & Generative AI

Transformers & Attention: diagram comparing AWS, Azure and Google Cloud
How a transformer turns a prompt into an answer, and how AWS, Azure and Google Cloud each implement it.

Why it matters

Generative AI bills are measured in tokens, and quality depends on what fits into the context window. Teams that understand the mechanics write cheaper prompts, choose better models and avoid surprises at scale.

How it works

From prompt to answer

Text is split into tokens, roughly four characters each in English. Attention layers let every token weigh every other token in the context, which is how models capture meaning. The model then predicts the answer one token at a time, streaming it back.

Cost and context

You pay for input and output tokens separately, and output usually costs more. The context window limits how much the model sees at once. Prompt caching discounts repeated context such as long system prompts or documents.

AWS, Azure and Google Cloud compared

AWSAzureGoogle Cloud
Model platformAmazon BedrockMicrosoft FoundryAgent Platform, Model Garden
First-party modelsAmazon Nova 2Phi, MAIGemini, Gemma
Partner modelsClaude, Llama, Mistral and moreOpenAI, Claude, Llama and moreClaude, Llama and 200+ models
Prompt cachingBedrock prompt cachingPrompt cachingContext caching
Self-hosting open modelsSageMaker JumpStartManaged computeAgent Platform endpoints, GKE

What makes each cloud different

AWS

Amazon Bedrock offers one API across many model families, including Anthropic Claude and Amazon's Nova 2 models, with prompt caching and intelligent prompt routing to cheaper models when they are good enough.

Azure

Microsoft Foundry (formerly Azure AI Foundry) hosts OpenAI's models alongside Claude, Llama and Microsoft's Phi small models, with a model router that picks a model per request.

Google Cloud

Google's Gemini models offer long context windows and native multimodal input, Gemma gives open weights you can host, and Model Garden lists more than 200 first-party and partner models.

Design decisions that matter

  1. 01Measure tokens per task

    Know the cost of each feature.

  2. 02Shorter, structured prompts

    Less input, clearer output.

  3. 03Cache stable context

    System prompts and reference documents.

  4. 04Right model per task

    Small models for simple work.

Common mistakes we see

  • Stuffing the context window. More tokens, higher cost, often worse answers.
  • One large model for everything. Paying premium prices for simple tasks.
  • Ignoring output length. Verbose answers cost more.

A practical 30-day plan

  1. Week 1

    Log tokens and cost per AI feature.

  2. Week 2

    Trim prompts and set output limits.

  3. Week 3

    Enable prompt caching for repeated context.

  4. Week 4

    Test a smaller model on the simplest tasks.

How NTS helps

NTS helps teams build generative AI on Bedrock, Microsoft Foundry and Agent Platform with the economics under control: model selection, prompt design, caching and cost tracking per feature.

What you get

  • Model selection for your tasks and budget
  • Context and token cost analysis
  • Optimized hosting or API usage
  • Benchmarks on your own data

Typical outcomes

  • The right model for each task
  • Predictable AI costs
  • Better quality through informed choices

How we work with you

  1. 1Assess

    A focused review of your transformer models across AWS, Azure and Google Cloud. We look for the gaps we find most often: stuffing the context window, one large model for everything and ignoring output length.

  2. 2Design

    A target architecture and roadmap built on the decisions that matter most: measure tokens per task, shorter, structured prompts, cache stable context and right model per task.

  3. 3Build

    Hands-on delivery alongside your team. We log tokens and cost per AI feature, trim prompts and set output limits, enable prompt caching for repeated context, and finally test a smaller model on the simplest tasks.

  4. 4Run and improve

    We re-evaluate new models as they launch and switch when the benefit is clear.

Why teams choose NTS for transformer models

  • Practical model knowledge

    We explain trade-offs between model sizes, context windows and costs in plain terms.

  • Your data, your benchmark

    We test models on your tasks instead of public leaderboards.

  • Cost-aware design

    We cut token usage without losing quality.

Book a free 30-minute review

Talk to an NTS architect about your transformer models on AWS, Azure and Google Cloud.