Silicon Valley is home to the biggest supply of the world's greatest tech talent. But the demand is so high that companies seeking to hire, motivate, and retain that talent must do some clever things. Otherwise, the people that they hire could get bored and seek more excitement elsewhere.

Here are two companies and the five clever things they do to attract and retain top talent.

(1) Passive Candidate Acquisition, (2) Employee Referral Incentives, (3) Opportunity, Mission and Culture

With subscription revenues growing at 75% a year and over 700 people in San Francisco, New York, the UK, France, Singapore, Japan and Australia, Anaplan -- a cloud-based business planning service -- needs engineers and sales and marketing talent.

Anaplan uses three powerful tools to recruit and retain its talent. As CEO Frank Calderoni explained in a September 2017 interview, Anaplan has a great "internal talent acquisition team that knows how to reach out to 'passive' job candidates [talented employees at other companies who are not looking for a new job]; a friends and family program that offers incentives to employees who refer successful candidates, and a compelling mission, growth opportunity and culture of authenticity, collaboration, inclusion, creativity, openness, and directness."

Anaplan seeks out people with specific traits. As Calderoni said, "We recruit people who get stuff done, who have a strong sense of purpose and desire to be successful, and have the soft skills needed to work well with others. We look for engineers who have built similar products. And we hire sales people who have sold similar products to enterprises."

Anaplan has to overcome special challenges when it recruits in San Francisco. "All regions where we recruit are high cost. Why do they come? Why do they stay? We have a strong business with a good future where they can develop. They like the people and there is a good balance between work and fun,"  he said.

(4) SemiPublic Equity (5) Hawaiian Mansion

Y Media Labs is an interactive digital agency specializing in mobile solutions, in Redwood City, Calif. with 270 people in the Bay Area -- it grew 50% in 2016 and it is hiring many types of people. As CEO Ashish Toshniwal explained, "We are hiring engineers, designers, product strategists, and account managers. We hire from other agencies and from product startups as well as from companies like Apple. We hired a chief creative officer from another agency and a president who was with Audi, Nike, and Visa. We compete for talent with Google, Facebook, and Uber. We can't match their salaries, but if we are close we can offer equity and aggressive growth."

Y Media has a very high employee retention rate. As Toshniwal said, "We keep 89% of the people we have hired. We have a nucleus of people in the company who like to hang out with each other on weekends. We have a strong culture that rewards people who work together well and deliver great work for clients."

One of Y Media's unusual tactics for getting liquidity for its founders was to sell a share of the company to MDC Partners, a Manhattan-based publicly-traded marketing and communications firm, in May 2015. Toshniwal believes that Y Media's equity will grow. "Going forward the valuation of our company's equity will grow along with the company. We had a fantastic 2016 so we hired a mansion in Hawaii. It was very popular in the company," he said.

If these techniques work in Silicon Valley, they could probably work for your company as well.