scaling llm applications: architecture patterns for performance and cost optimization | pilput